/** Update the attributes´ value based on the associated components. */ public void applyValues() { MarvinPluginWindowComponent filterComp; enumComponents = hashComponents.elements(); while (enumComponents.hasMoreElements()) { filterComp = enumComponents.nextElement(); if (filterComp.getAttributes() != null) { filterComp.getAttributes().set(filterComp.getAttributeID(), getValue(filterComp)); } } }
/** * @param plgComp - graphical component; * @return the value associated with the specified component */ public Object getValue(MarvinPluginWindowComponent plgComp) { String l_id = plgComp.getAttributeID(); MarvinAttributes attr = plgComp.getAttributes(); JComponent comp = plgComp.getComponent(); switch (plgComp.getType()) { case COMPONENT_TEXTFIELD: return stringToType(((JTextField) comp).getText(), attr.get(l_id)); case COMPONENT_COMBOBOX: return (((JComboBox) comp).getSelectedItem()); case COMPONENT_SLIDER: return (((JSlider) comp).getValue()); case COMPONENT_TEXTAREA: return (((JTextArea) comp).getText()); case COMPONENT_CHECKBOX: return (((JCheckBox) comp).isSelected()); case COMPONENT_MATRIX_PANEL: return (((MarvinMatrixPanel) comp).getValue()); } return null; }