Package fr.soleil.comete.swing

Examples of fr.soleil.comete.swing.ComboBox


        Label stringLabel = new Label();
        Label numberLabel = new Label();
        Label booleanLabel = new Label();

        ComboBox stringCombo = new ComboBox();
        NumberComboBox numberCombo = new NumberComboBox();
        BooleanComboBox booleanCombo = new BooleanComboBox();
        StringMatrixComboBoxViewer matrixCombo = new StringMatrixComboBoxViewer();
        matrixCombo.setLinkPopupVisibilityWithEditable(false);

        stringCombo.setObjectArray(new Object[] { "value1", "value2", "value3" });
        stringCombo.setDisplayedList(new String[] { "Label 1", "Label 2", "Label 3" });
        // stringCombo.setEditable(false);

        numberCombo.setObjectArray(new Object[] { Double.valueOf(1), Double.valueOf(2), Double.valueOf(3) });
        numberCombo.setDisplayedList(new String[] { "Label 1", "Label 2", "Label 3" });
        // numberCombo.setEditable(false);
View Full Code Here


    }

    protected void initSymbolPanel() {
        symbolPanel = new JPanel(new GridBagLayout());

        symbolListComboBox = new ComboBox();

        insertSymbolButton = new JButton("Insert");
        insertSymbolButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
View Full Code Here

        stringBox.setSettable(deleteConfigButton, false);
        stringBox.setConfirmation(deleteConfigButton, true);
        deleteConfigButton.setText(DELETE);
        deleteConfigButton.setButtonLook(true);

        configurationComboBox = new ComboBox();
    }
View Full Code Here

        model.updateDataModelDialogModel(currentDialogModel);
    }

    @Override
    protected void initPanelComponents() {
        dataModelSelectionComboBox = new ComboBox();
        dataModelSelectionTitle = new JLabel("Current datamodel:");
        setModelTarget = new TextField();

        dataModelDocumentListener = new DocumentListener() {
            @Override
View Full Code Here

    }

    protected void initSymbolPanel() {
        symbolPanel = new JPanel(new GridBagLayout());

        symbolListComboBox = new ComboBox();

        insertSymbolButton = new JButton("Insert");
        insertSymbolButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
View Full Code Here

        model.updateDataModelDialogModel(currentDialogModel);
    }

    @Override
    protected void initPanelComponents() {
        dataModelSelectionComboBox = new ComboBox();
        dataModelSelectionTitle = new JLabel("Current datamodel:");
        dataModelDocumentListener = new DocumentListener() {
            @Override
            public void removeUpdate(DocumentEvent e) {
                updateCombo(true);
View Full Code Here

    }

    protected void initSymbolPanel() {
        symbolPanel = new JPanel(new GridBagLayout());

        symbolListComboBox = new ComboBox();

        insertSymbolButton = new JButton("Insert");
        insertSymbolButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
View Full Code Here

     *
     * @return fr.esrf.tangoatk.widget.attribute.StringScalarEditor
     */
    private ComboBox getXWriteCombo() {
        if (xProxiesCombo == null) {
            xProxiesCombo = new ComboBox();
            xProxiesCombo.setVisible(false);
            xProxiesCombo.setToolTipText(X_INFO);
        }
        return xProxiesCombo;
    }
View Full Code Here

     *
     * @return fr.esrf.tangoatk.widget.attribute.StringScalarEditor
     */
    private ComboBox getYWriteCombo() {
        if (yProxiesCombo == null) {
            yProxiesCombo = new ComboBox();
            yProxiesCombo.setVisible(false);
            yProxiesCombo.setToolTipText(Y_INFO);
        }
        return yProxiesCombo;
    }
View Full Code Here

                    editorComponent = new MultivaluedListComponent(possibleValues, values, true);

                }
                    break;
                case ENUM:
                    editorComponent = new ComboBox();
                    if (ParsingUtil.ERROR_STRATEGY.equals(paramName)) {
                        ErrorStrategy[] values = ErrorStrategy.values();
                        for (ErrorStrategy s : values) {
                            ((ComboBox) editorComponent).addItem(s.name().toLowerCase());
                        }
                        for (ErrorStrategy s : values) {
                            String value = s.name().toLowerCase();
                            if (predefinedEntry.getValue().contains(value)) {
                                for (int i = 0; i < ((ComboBox) editorComponent).getItemCount(); i++) {
                                    if (((ComboBox) editorComponent).getItemAt(i).equals(value)) {
                                        ((ComboBox) editorComponent).setSelectedIndex(i);
                                    }
                                }

                            }
                        }
                    } else if (entryContainer instanceof Hook && ParsingUtil.ACTION.equals(paramName)) {
                        HookAction[] possibleValuesArray = HookAction.values();

                        List<String> possibleValues = new ArrayList<String>();
                        for (HookAction ha : possibleValuesArray) {
                            possibleValues.add(ha.toString());
                        }
                        List<String> values = new ArrayList<String>();
                        String s = entry.getValue().replace(ParsingUtil.BRACKET_OPENNING, "")
                                .replace(ParsingUtil.BRACKET_CLOSING, "").trim();
                        String[] tmp = s.split(ParsingUtil.COMMA);
                        for (String str : tmp) {
                            values.add(str);
                        }
                        editorComponent = new MultivaluedListComponent(possibleValues, values, false);

                    }
                    break;
                case NUMBER:
                    editorComponent = new WheelSwitch();
                    double val = Double.parseDouble(entry.getValue());
                    ((WheelSwitch) editorComponent).setNumberValue(val);
                    ((WheelSwitch) editorComponent).setFormatEditable(true);
                    break;
                case STRING:
                    editorComponent = new TextField();
                    ((TextField) editorComponent).setText(entry.getValue());
                    ((TextField) editorComponent).setColumns(50);
                    break;
                case INT:
                    WheelSwitch wheelSwitch = new WheelSwitch();
                    wheelSwitch.setFormat("%+7.0f");
                    double intVal = Double.parseDouble(entry.getValue());
                    wheelSwitch.setFormatEditable(true);
                    if (ParsingUtil.DIMENSION.equals(paramName) && (entryContainer instanceof Actuator)) {
                        wheelSwitch.setFormat("%+1.0f");
                    }
                    if (paramName.startsWith(ParsingUtil.DIMENSION)) {
                        wheelSwitch.setMinValue(0);
                        wheelSwitch.setMinIncluded(true);
                    }
                    wheelSwitch.setNumberValue(intVal);
                    editorComponent = wheelSwitch;
                    break;
                case DOUBLE:
                    editorComponent = new WheelSwitch();
                    double doubleVal = Double.parseDouble(entry.getValue());
                    ((WheelSwitch) editorComponent).setNumberValue(doubleVal);
                    ((WheelSwitch) editorComponent).setFormatEditable(true);
                    break;
                case MATRIX:
                    String valueStr = entry.getValue();
                    String[] valuesStr = valueStr.split("]");
                    List<Integer> values = new ArrayList<Integer>();
                    for (String s : valuesStr) {
                        if (!s.isEmpty()) {
                            s = s.replace("[", "").replace("]", "").trim();
                            Integer i = Integer.parseInt(s);
                            values.add(i);
                        }
                    }
                    if (values.size() == 1) {
                        editorComponent = new WheelSwitch();
                        ((WheelSwitch) editorComponent).setFormat("%+7.0f");
                        Integer iv = values.get(0);
                        ((WheelSwitch) editorComponent).setNumberValue(iv);
                        ((WheelSwitch) editorComponent).setFormatEditable(true);
                        if (ParsingUtil.DIMENSION.equals(paramName) && (entryContainer instanceof Actuator)) {
                            ((WheelSwitch) editorComponent).setFormat("%+1.0f");
                        }
                    } else {
                        String title;
                        Integer minValue;
                        boolean included;
                        if (paramName.startsWith(ParsingUtil.DIMENSION)) {
                            title = "dim ";
                            minValue = 0;
                            included = true;
                        } else {
                            title = paramName;
                            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) {
View Full Code Here

TOP

Related Classes of fr.soleil.comete.swing.ComboBox

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.