diff --git a/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java new file mode 100644 index 0000000..77fd3d2 --- /dev/null +++ b/src/main/java/pro/litvinovg/w2phtml/gui/ConfigurationReader.java @@ -0,0 +1,69 @@ +package pro.litvinovg.w2phtml.gui; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +import com.sun.star.uno.XComponentContext; + +import pro.litvinovg.xml.Debug; + +public class ConfigurationReader { + + List checkBoxes = new ArrayList(); + List textFields = new ArrayList(); + List labels = new ArrayList(); + private XComponentContext context; + + + public ConfigurationReader(HashMap configuration, XComponentContext context) { + this.context = context; + readOptions(configuration); + } + + private void readOptions(HashMap configuration) { + Set options = configuration.keySet(); + for (String optionName : options) { + //Debug.printLog(string, context); + String optionValue = null; + Component component = configuration.get(optionName); + if (component.getClass().equals(JTextField.class)) { + optionValue = ((JTextField) component).getText(); + } else if (component.getClass().equals(JCheckBox.class)) { + optionValue = Boolean.toString(((JCheckBox) component).isSelected()); + } else if (component.getClass().equals(JLabel.class)) { + optionValue = ((JLabel) component).getText(); + } + Debug.printLog(optionName + " : " + optionValue, context); + + } + /*for (Component component : components) { + if (component.getClass().equals(JTextField.class)) { + textFields.add(component); + } else if (component.getClass().equals(JCheckBox.class)) { + checkBoxes.add(component); + } else if (component.getClass().equals(JLabel.class)) { + labels.add(component); + } + } + for (Iterator iterator = checkBoxes.iterator(); iterator.hasNext();) { + JCheckBox checkBox = (JCheckBox) iterator.next(); + checkBox.get + + }*/ + + } + + public String[] getCommandLine() { + return null; + } + +}