Package fr.soleil.gui.flyscan.listeners

Examples of fr.soleil.gui.flyscan.listeners.ConfigurationEditionStateListener


                }
            });

            final ConfigurationGUI panel = new ConfigurationGUI(configuration, plugins, panelError, isExpert, isEnabled);
            if (isEnabled) {
                panel.addBeingEditedListener(new ConfigurationEditionStateListener() {

                    @Override
                    public void setConfigurationBeingEdited(boolean isBeingEdited) {
                        int selectedIndex = tabbedPane.indexOfComponent(panel);
                        if (selectedIndex > -1) {
View Full Code Here


                            minValue = null;
                            included = false;
                        }
                        editorComponent = new MatrixNumberEditorComponent(values, title, minValue, included);
                        final MatrixNumberEditorComponent matrixEditorComponent = (MatrixNumberEditorComponent) editorComponent;
                        matrixEditorComponent.addBeingEditedListener(new ConfigurationEditionStateListener() {
                            @Override
                            public void setConfigurationBeingEdited(boolean isBeingEdited) {
                                fireEditionStateChanged(isBeingEdited, entry, entryContainer,
                                        matrixEditorComponent.getStringValue(), matrixEditorComponent, labelName,
                                        tabTitle);
                            }
                        });
                    }

                    break;
                case TRAJECTORY:
                    if (entry instanceof TrajectoryEntry) {
                        String location = getErrorLocation(entry, entryContainer);
                        Trajectory trajectory = ((TrajectoryEntry) entry).getTrajectory();
                        if (trajectory instanceof ContinuousTrajectory) {
                            editorComponent = new ContinuousTrajectoryComponent(panelError, errorsMap,
                                    (ContinuousTrajectory) trajectory, location, this, labelName, tabTitle);
                        } else if (trajectory instanceof IntervalStepByStepTrajectory) {
                            editorComponent = new IntervalStepByStepTrajectoryComponent(panelError, errorsMap,
                                    (IntervalStepByStepTrajectory) trajectory, location, this, labelName, tabTitle);
                        } else if (trajectory instanceof TabStepByStepTrajectory) {
                            editorComponent = new TabStepByStepTrajectoryComponent(panelError, errorsMap,
                                    (TabStepByStepTrajectory) trajectory, location, this, labelName, tabTitle);
                        }
                        final ATrajectoryComponent<?> aTrajectoryComponent = (ATrajectoryComponent<?>) editorComponent;
                        aTrajectoryComponent.addBeingEditedListener(new ConfigurationEditionStateListener() {

                            @Override
                            public void setConfigurationBeingEdited(boolean isBeingEdited) {
                                Trajectory traj = aTrajectoryComponent.getTrajectory();
                                fireEditionStateChanged(isBeingEdited, entry, entryContainer,
                                        traj.getStringTrajectory(), aTrajectoryComponent, labelName, tabTitle);
                            }
                        });
                    }
                    break;
                default:
                    break;

            }
        } else if (entry instanceof FakeEntry) {
            Parameter param = ((FakeEntry) entry).getParam();
            description = param.getDescription();
            editorComponent = getEditorComponent(entry, labelName, param, entryContainer, tabTitle);
        }

        // Editor
        if (editorComponent == null && !entry.getKey().equals(ParsingUtil.LEVEL) && customParametersPanel != null
                && plugin != null && plugin.isAcceptCustomParameter()) {
            customParametersPanel.addNewCustomParameter(entry, entryContainer);
        }

        if (editorComponent != null) {
            isEditable = isEditable && ((!entry.isExpert()) || (entry.isExpert() && isExpert));
            editorComponent.setEnabled(isEditable);

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

            if (plugin != null) {
                for (Parameter parameter : plugin.getParameters()) {
                    if (parameter.getName().equalsIgnoreCase(entry.getKey()) && parameter.getConstraints() != null) {
                        constraints.addAll(parameter.getConstraints());
                    }
                }
            }

            List<Constraint> nonSatisfiedConstraints = getNonSatisfiedConstraints(entry, entry.getValue(), constraints);

            if (!nonSatisfiedConstraints.isEmpty()) {
                String location = getErrorLocation(entry, entryContainer);
                warnConstraintsAreNotSatisfied(tabTitle, editorComponent, labelName, nonSatisfiedConstraints, location);
            }

            // Listen to edition state change
            if (editorComponent instanceof CheckBox) {
                final CheckBox checkBox = (CheckBox) editorComponent;
                checkBox.addItemListener(new ItemListener() {

                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        Object obj = e.getSource();
                        if (obj instanceof CheckBox) {
                            fireEditionStateChanged(true, entry, entryContainer, checkBox.isSelected() ? "true"
                                    : "false", checkBox, labelName, tabTitle);
                        }

                    }
                });
            } else if (editorComponent instanceof ComboBox) {
                final ComboBox comboBox = (ComboBox) editorComponent;
                comboBox.addItemListener(new ItemListener() {

                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        fireEditionStateChanged(true, entry, entryContainer, (String) comboBox.getSelectedValue(),
                                comboBox, labelName, tabTitle);

                    }
                });
            } else if (editorComponent instanceof MultivaluedListComponent) {
                final MultivaluedListComponent multivaluedListComponent = (MultivaluedListComponent) editorComponent;
                multivaluedListComponent.addBeingEditedListener(new ConfigurationEditionStateListener() {

                    @Override
                    public void setConfigurationBeingEdited(boolean isBeingEdited) {

                        String value = multivaluedListComponent.getValueStr();
View Full Code Here

        if (useDevStateRenderer) {
            List<String> unusedValues = getUnusedValues();

            final DevStateComboBox combo = new DevStateComboBox(unusedValues);

            combo.addBeingEditedListener(new ConfigurationEditionStateListener() {

                @Override
                public void setConfigurationBeingEdited(boolean isBeingEdited) {
                    refreshUsedValuesListAndCombos(combo);
View Full Code Here

TOP

Related Classes of fr.soleil.gui.flyscan.listeners.ConfigurationEditionStateListener

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.