/** * Adds the change listener. * * @param l the change listener */ public void addChangeListener(ChangeListener l) { m_PanelProperties.addChangeListener(l); }
/** * Adds the label and component as new row at the end. * * @param label the label to add, the mnemonic to use is preceded by "_" * @param comp the component to add * @return the index of the parameter */ public int addParameter(String label, Component comp) { return addParameter(false, label, comp); }
/** * Removes all properties. */ protected void clearProperties() { m_Identifiers.clear(); m_PanelProperties.clearParameters(); }
JPanel panel; removeAll(); setLayout(layout); fixDimensions(); con.insets = new Insets(m_GapVertical + 1, m_GapHorizontal, m_GapVertical + 1, m_GapHorizontal); layout.setConstraints(m_CheckBoxes.get(i), con); add(m_CheckBoxes.get(i)); con.insets = new Insets(m_GapVertical + 1, 5, m_GapVertical + 1, 5); layout.setConstraints(m_Labels.get(i), con); add(m_Labels.get(i)); con.insets = new Insets(m_GapVertical + 1, 5, m_GapVertical + 1, 5); layout.setConstraints(m_Parameters.get(i), con); add(m_Parameters.get(i)); con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(panel, con); add(panel);
/** * Sets the tiptext to display. * * @param index the index of the component * @param text the tiptext to use, null to turn off * @param check whether to set the tiptext for the checkbox * @param label whether to set the tiptext for the label * @param comp whether to set the tiptext for the component (must be {@link JComponent}) */ public void setToolTipText(int index, String text, boolean check, boolean label, boolean comp) { if (m_UseCheckBoxes && check) getCheckBox(index).setToolTipText(text); if (label) getLabel(index).setToolTipText(text); if (comp && (getParameter(index) instanceof JComponent)) ((JComponent) getParameter(index)).setToolTipText(text); }
con.insets = new Insets(m_GapVertical + 1, m_GapHorizontal, m_GapVertical + 1, m_GapHorizontal); layout.setConstraints(check, con); add(check); addChangeListenerTo(chooser); update();
/** * Returns the component at the specified location. * * @param index the index of the specified location * @return the component at the position */ public Component getProperty(int index) { return m_PanelProperties.getParameter(index); }
/** * For initializing the GUI. */ @Override protected void initGUI() { JPanel panel; super.initGUI(); setLayout(new BorderLayout()); m_PanelProperties = new ParameterPanel(); add(new BaseScrollPane(m_PanelProperties), BorderLayout.CENTER); m_PanelButtons = new JPanel(new BorderLayout()); add(m_PanelButtons, BorderLayout.SOUTH); panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); m_PanelButtons.add(panel, BorderLayout.WEST); m_ButtonLoad = new JButton(GUIHelper.getIcon("open.gif")); m_ButtonLoad.addActionListener((ActionEvent e) -> loadProperties()); panel.add(m_ButtonLoad); m_ButtonSave = new JButton(GUIHelper.getIcon("save.gif")); m_ButtonSave.addActionListener((ActionEvent e) -> saveProperties()); panel.add(m_ButtonSave); }
/** * Returns the component associated with the identifier. * * @param identifier the identifier of the property to return * @return the associated component, null if none found */ public Component getProperty(String identifier) { int index; index = m_Identifiers.indexOf(identifier); if (index == -1) return null; else return m_PanelProperties.getParameter(index); }
/** * Adds the label and component as new row at the end. * * @param checked whether the checkbox is checked * @param label the label to add, the mnemonic to use is preceded by "_" * @param comp the component to add * @return the index of the parameter */ public int addParameter(boolean checked, String label, Component comp) { return addParameter(-1, checked, label, comp); }
/** * Adds the chooser panel at the end. Cannot be used if checkboxes used. * * @param chooser the chooser panel to add * @return the index of the parameter * @see #useCheckBoxes() */ public int addParameter(AbstractChooserPanel chooser) { return addParameter(false, chooser); }
/** * Inserts the chooser panel as new row at the specified row. * * @param chooser the chooser panel to insert * @param index the row index to insert the label/editfield at, -1 will * add the chooser at the end */ public void addParameter(int index, AbstractChooserPanel chooser) { addParameter(index, false, chooser); }
/** * Inserts the label and component as new row at the specified row. * * @param index the row index to insert the label/editfield at, -1 will * add the component at the end * @param label the label to add, the mnemonic to use is preceded by "_" * @param comp the component to add * @return the index of the parameter */ public int addParameter(int index, String label, Component comp) { return addParameter(index, false, label, comp); }
/** * Adds the chooser panel at the end. Cannot be used if checkboxes used. * * @param chooser the chooser panel to add * @return the index of the parameter * @see #useCheckBoxes() */ public int addParameter(boolean checked, AbstractChooserPanel chooser) { return addParameter(-1, false, chooser); }
/** * Adds the chooser panel at the end. * * @param identifier the unique identifier of the property * @param label the label to add, the mnemonic to use is preceded by "_" * @param chooser the chooser panel to add * @throws IllegalArgumentException if the identifier already exists */ public void addProperty(String identifier, String label, AbstractChooserPanel chooser) { if (m_Identifiers.contains(identifier)) throw new IllegalArgumentException("Identifier '" + identifier + "' already present!"); m_Identifiers.add(identifier); m_PanelProperties.addParameter(label, chooser); }
/** * Adds a property. * * @param identifier the unique identifier of the property * @param label the label to add, the mnemonic to use is preceded by "_" * @param comp the component to add * @throws IllegalArgumentException if the identifier already exists */ public void addProperty(String identifier, String label, Component comp) { if (m_Identifiers.contains(identifier)) throw new IllegalArgumentException("Identifier '" + identifier + "' already present!"); m_Identifiers.add(identifier); m_PanelProperties.addParameter(label, comp); }