Package fr.soleil.lib.flyscan.model.parsing.configuration

Examples of fr.soleil.lib.flyscan.model.parsing.configuration.Entry


            }
        }

        assertNotNull(sensor);

        Entry measurementsEntry = null;

        for (Entry e : sensor.getEntries()) {
            if (e.getKey().equalsIgnoreCase("measurements")) {
                measurementsEntry = e;
            }
        }

        assertNotNull(measurementsEntry);

        List<Constraint> constraints = measurementsEntry.getConstraints();

        assertTrue(!constraints.isEmpty());

        Constraint constraint = constraints.get(0);

        assertTrue(constraint instanceof InConstraint);

        InConstraint inConstraint = (InConstraint) constraint;

        assertEquals(3, inConstraint.getPossibleValues().size());

        assertEquals(-100.0, inConstraint.getPossibleValues().get(0));

        assertEquals(100.0, inConstraint.getPossibleValues().get(1));

        assertEquals(150.0, inConstraint.getPossibleValues().get(2));

        boolean isConstraintSatisfied = false;

        Double measurement = new Double(measurementsEntry.getValue());

        assertEquals(3.14116, measurement);

        for (Double d : inConstraint.getPossibleValues()) {
            if (d == measurement) {
View Full Code Here


                                        JComponent comp = compAndLabel.getKey();
                                        if (comp instanceof WheelSwitch) {
                                            WheelSwitch w = ((WheelSwitch) comp);
                                            if (w.getValue() > 0) {
                                                Label labelName = compAndLabel.getValue();
                                                Entry entry = null;
                                                for (Entry e : section.getEntries()) {
                                                    if (e.getKey().equalsIgnoreCase(labelName.getText().trim())) {
                                                        entry = e;
                                                    }
                                                }
                                                displayError(entry, section, null, labelName, comp,
                                                        "Entries of recording section are mutually exclusive", GENERAL);
                                            }
                                        }

                                    }

                                }

                            } else {
                                for (final Entry entry : section.getEntries()) {
                                    // if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                    try {
                                        buidEntryGUI(objectPanel, sectionPanel, section, null, entry, GENERAL, null);
                                    } catch (FSParsingException e) {
                                        if (e.getComponent() != null && e.getLabelName() != null) {
                                            displayError(entry, section, null, e.getLabelName(), e.getComponent(),
                                                    e.getMessage(), GENERAL);
                                        }
                                        e.printStackTrace();
                                        LOGGER.log(Level.SEVERE, e.getMessage());
                                    }
                                    // }

                                }

                                for (final FSObject fsObject : section.getObjects()) {

                                    if (fsObject != null) {
                                        Plugin pluginObj = getPluginAndProcessParamsWithDefaultValues(plugins, section,
                                                fsObject);

                                        objectPanel = buildObjectPanel(fsObject);

                                        final GridBagConstraints sectionConstraints = new GridBagConstraints();
                                        sectionConstraints.gridx = 0;
                                        sectionConstraints.gridy = GridBagConstraints.RELATIVE;
                                        sectionConstraints.gridwidth = GridBagConstraints.REMAINDER;
                                        sectionConstraints.weightx = 1;
                                        sectionConstraints.weighty = 1;
                                        sectionConstraints.anchor = GridBagConstraints.NORTHWEST;
                                        sectionConstraints.fill = GridBagConstraints.HORIZONTAL;
                                        sectionConstraints.insets = new Insets(5, 5, 5, 5);

                                        sectionPanel.add(objectPanel, sectionConstraints);

                                        for (final Entry entry : fsObject.getEntries()) {
                                            if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                                try {
                                                    buidEntryGUI(objectPanel, sectionPanel, fsObject, pluginObj, entry,
                                                            GENERAL, null);
                                                } catch (FSParsingException e) {
                                                    if (e.getComponent() != null && e.getLabelName() != null) {
                                                        displayError(entry, section, fsObject, e.getLabelName(),
                                                                e.getComponent(), e.getMessage(), GENERAL);
                                                    }
                                                    e.printStackTrace();
                                                    LOGGER.log(Level.SEVERE, e.getMessage());
                                                }
                                            }

                                        }
                                    }

                                }
                            }

                            generalPanel.add(sectionPanel, constraints);
                        }

                    } else {

                        for (final FSObject fsObject : section.getObjects()) {

                            if (fsObject != null) {
                                // Choose plugin
                                Plugin pluginObj = getPluginAndProcessParamsWithDefaultValues(plugins, section,
                                        fsObject);

                                objectPanel = buildObjectPanel(fsObject);

                                if (fsObject instanceof ContinuousActuator) {

                                    continuousActuatorPanel.add(objectPanel, constraints);
                                    CustomParameterPanel customParametersPanel = buildCustomParametersPanel(
                                            (Actor) fsObject, pluginObj);
                                    if (customParametersPanel != null) {
                                        objectPanel.add(customParametersPanel, customParametersPanelConstraints);
                                    }

                                    for (final Entry entry : fsObject.getEntries()) {
                                        if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                            try {
                                                buidEntryGUI(objectPanel, continuousActuatorPanel, fsObject, pluginObj,
                                                        entry, CONTINUOUS_ACTUATORS, customParametersPanel);
                                            } catch (FSParsingException e) {
                                                if (e.getComponent() != null && e.getLabelName() != null) {
                                                    displayError(entry, section, fsObject, e.getLabelName(),
                                                            e.getComponent(), e.getMessage(), CONTINUOUS_ACTUATORS);
                                                }

                                                LOGGER.log(Level.SEVERE, e.getMessage());
                                            }
                                        }

                                    }
                                } else if (fsObject instanceof Actuator) {

                                    actuatorPanel.add(objectPanel, constraints);
                                    CustomParameterPanel customParametersPanel = buildCustomParametersPanel(
                                            (Actor) fsObject, pluginObj);
                                    if (customParametersPanel != null) {
                                        objectPanel.add(customParametersPanel, customParametersPanelConstraints);
                                    }

                                    for (final Entry entry : fsObject.getEntries()) {
                                        if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                            try {
                                                buidEntryGUI(objectPanel, actuatorPanel, fsObject, pluginObj, entry,
                                                        ACTUATORS, customParametersPanel);
                                            } catch (FSParsingException e) {
                                                if (e.getComponent() != null && e.getLabelName() != null) {
                                                    displayError(entry, section, fsObject, e.getLabelName(),
                                                            e.getComponent(), e.getMessage(), ACTUATORS);
                                                }

                                                LOGGER.log(Level.SEVERE, e.getMessage());
                                            }
                                        }

                                    }
                                } else if (fsObject instanceof Sensor) {

                                    sensorPanel.add(objectPanel, constraints);
                                    CustomParameterPanel customParametersPanel = buildCustomParametersPanel(
                                            (Actor) fsObject, pluginObj);
                                    if (customParametersPanel != null) {
                                        objectPanel.add(customParametersPanel, customParametersPanelConstraints);
                                    }

                                    for (final Entry entry : fsObject.getEntries()) {
                                        if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                            try {
                                                buidEntryGUI(objectPanel, sensorPanel, fsObject, pluginObj, entry,
                                                        SENSORS, customParametersPanel);
                                            } catch (FSParsingException e) {
                                                if (e.getComponent() != null && e.getLabelName() != null) {
                                                    displayError(entry, section, fsObject, e.getLabelName(),
                                                            e.getComponent(), e.getMessage(), SENSORS);
                                                }

                                                LOGGER.log(Level.SEVERE, e.getMessage());
                                            }
                                        }

                                    }
                                } else if (fsObject instanceof TimeBase) {

                                    timebasePanel.add(objectPanel, constraints);
                                    CustomParameterPanel customParametersPanel = buildCustomParametersPanel(
                                            (Actor) fsObject, pluginObj);
                                    if (customParametersPanel != null) {
                                        objectPanel.add(customParametersPanel, customParametersPanelConstraints);
                                    }

                                    for (final Entry entry : fsObject.getEntries()) {
                                        if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                            try {
                                                buidEntryGUI(objectPanel, timebasePanel, fsObject, pluginObj, entry,
                                                        TIMEBASE, customParametersPanel);
                                            } catch (FSParsingException e) {
                                                if (e.getComponent() != null && e.getLabelName() != null) {
                                                    displayError(entry, section, fsObject, e.getLabelName(),
                                                            e.getComponent(), e.getMessage(), TIMEBASE);
                                                }

                                                LOGGER.log(Level.SEVERE, e.getMessage());
                                            }
                                        }

                                    }
                                } else if (fsObject instanceof Hook) {
                                    hookPanel.add(objectPanel, constraints);
                                    CustomParameterPanel customParametersPanel = buildCustomParametersPanel(
                                            (Actor) fsObject, pluginObj);
                                    if (customParametersPanel != null) {
                                        objectPanel.add(customParametersPanel, customParametersPanelConstraints);
                                    }

                                    for (final Entry entry : fsObject.getEntries()) {
                                        if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                            try {
                                                buidEntryGUI(objectPanel, hookPanel, fsObject, pluginObj, entry, HOOKS,
                                                        customParametersPanel);
                                            } catch (FSParsingException e) {
                                                if (e.getComponent() != null && e.getLabelName() != null) {
                                                    displayError(entry, section, fsObject, e.getLabelName(),
                                                            e.getComponent(), e.getMessage(), HOOKS);
                                                }

                                                LOGGER.log(Level.SEVERE, e.getMessage());
                                            }
                                        }

                                    }
                                } else if (fsObject instanceof Monitor) {

                                    monitorPanel.add(objectPanel, constraints);
                                    CustomParameterPanel customParametersPanel = buildCustomParametersPanel(
                                            (Actor) fsObject, pluginObj);
                                    if (customParametersPanel != null) {
                                        objectPanel.add(customParametersPanel, customParametersPanelConstraints);
                                    }

                                    for (final Entry entry : fsObject.getEntries()) {
                                        if ((!entry.isExpert()) || (entry.isExpert() && isExpert)) {
                                            try {
                                                buidEntryGUI(objectPanel, monitorPanel, fsObject, pluginObj, entry,
                                                        MONITORS, customParametersPanel);
                                            } catch (FSParsingException e) {
                                                if (e.getComponent() != null && e.getLabelName() != null) {
View Full Code Here

                            valid = false;
                            displayError(dialog, "Key " + matchingEntryKey
                                    + " is already used within the configuration");
                        }
                        if (valid) {
                            Entry entry = new Entry(name, value);
                            actor.addEntry(entry);
                            customParameterPanel.addNewCustomParameter(entry, actor);

                            // Indicates that configuration has been changed
                            for (ConfigurationEditionStateListener listener : configurationGUI
View Full Code Here

     * @param errorStrategy String
     */
    public StepByStepActuator(String timeOut, String delay, String errorStrategy, EntryContainer parent) {
        super(ParsingUtil.ACTUATOR, parent);

        Entry timeOutEntry = new Entry(ParsingUtil.TIMEOUT, timeOut, false);
        addEntry(timeOutEntry);
        Entry delayEntry = new Entry(ParsingUtil.DELAY, delay, false);
        addEntry(delayEntry);
        Entry errorStrategyEntry = new Entry(ParsingUtil.ERROR_STRATEGY, errorStrategy, false);
        addEntry(errorStrategyEntry);

    }
View Full Code Here

     * @param errorStrategy String
     */
    public ContinuousActuator(String timeOut, String delay, String errorStrategy, EntryContainer parent) {
        super(ParsingUtil.CONTINUOUS_ACTUATOR, parent);

        Entry timeOutEntry = new Entry(ParsingUtil.TIMEOUT, timeOut, false);
        addEntry(timeOutEntry);
        Entry delayEntry = new Entry(ParsingUtil.DELAY, delay, false);
        addEntry(delayEntry);
        Entry errorStrategyEntry = new Entry(ParsingUtil.ERROR_STRATEGY, errorStrategy, false);
        addEntry(errorStrategyEntry);

    }
View Full Code Here

     *
     * @param errorStrategy String
     */
    public ContextMonitorBehavior(String errorStrategy, EntryContainer parent) {
        super(CONTEXT_MONITOR, parent);
        Entry errorStrategyEntry = new Entry(ERROR_STRATEGY, errorStrategy);
        addEntry(errorStrategyEntry);
    }
View Full Code Here

     * @param timeOut String
     * @param errorStrategy String
     */
    public HookBehavior(String timeOut, String errorStrategy, EntryContainer parent) {
        super(ParsingUtil.HOOK, parent);
        Entry timeOutEntry = new Entry(ParsingUtil.TIMEOUT, timeOut);
        addEntry(timeOutEntry);
        Entry errorStrategyEntry = new Entry(ParsingUtil.ERROR_STRATEGY, errorStrategy);
        addEntry(errorStrategyEntry);
    }
View Full Code Here

     * @param delay String
     * @param errorStrategy String
     */
    public SensorBehavior(String timeOut, String delay, String errorStrategy, EntryContainer parent) {
        super(SENSOR, parent);
        Entry timeOutEntry = new Entry(TIMEOUT, timeOut);
        addEntry(timeOutEntry);
        Entry errorStrategyEntry = new Entry(ERROR_STRATEGY, errorStrategy);
        addEntry(errorStrategyEntry);
    }
View Full Code Here

     * @param delay String
     * @param errorStrategy String
     */
    public TimeBaseBehavior(String timeOut, String delay, String errorStrategy, EntryContainer parent) {
        super(TIMEBASE, parent);
        Entry timeOutEntry = new Entry(TIMEOUT, timeOut);
        addEntry(timeOutEntry);
        Entry delayEntry = new Entry(DELAY, delay);
        addEntry(delayEntry);
        Entry errorStrategyEntry = new Entry(ERROR_STRATEGY, errorStrategy);
        addEntry(errorStrategyEntry);
    }
View Full Code Here

     * @param delay
     */
    public ActuatorBehavior(String errorStrategy, String timeOut, String delay, EntryContainer parent) {
        super(ACTUATOR, parent);

        Entry delayEntry = new Entry(ParsingUtil.DELAY, delay);
        addEntry(delayEntry);

        Entry timeOutEntry = new Entry(ParsingUtil.TIMEOUT, timeOut);
        addEntry(timeOutEntry);

        Entry errorStrategyEntry = new Entry(ParsingUtil.ERROR_STRATEGY, errorStrategy);
        addEntry(errorStrategyEntry);
    }
View Full Code Here

TOP

Related Classes of fr.soleil.lib.flyscan.model.parsing.configuration.Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.