List of usage examples for javax.swing JCheckBox getName
public String getName()
From source file:labr_client.xml.ObjToXML.java
public static void saveProfile(Component[] comps, String profile) { try {/*w w w . ja v a2 s .co m*/ if (comps != null) { JAXBContext context = JAXBContext.newInstance(LabrRequest.class); Marshaller m = context.createMarshaller(); //for pretty-print XML in JAXB m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); LabrRequest request = new LabrRequest(); for (Component comp : comps) { if (comp.getName() != null) { if (comp.getName().equals("name")) { request.patient.name.setValue(((JTextField) comp).getText()); request.patient.name.setX(comp.getX()); request.patient.name.setY(comp.getY()); request.patient.name.setWidth(comp.getWidth()); } else if (comp.getName().equals("firstName")) { request.patient.firstName.setValue(((JTextField) comp).getText()); request.patient.firstName.setX(comp.getX()); request.patient.firstName.setY(comp.getY()); request.patient.firstName.setWidth(comp.getWidth()); } else if (comp.getName().equals("birthDate")) { request.patient.birthDate.setValue(((JFormattedTextField) comp).getText()); request.patient.birthDate.setX(comp.getX()); request.patient.birthDate.setY(comp.getY()); request.patient.birthDate.setWidth(comp.getWidth()); } else if (comp.getName().equals("gender")) { request.patient.gender.setValue((String) (((JComboBox) comp).getSelectedItem())); request.patient.gender.setX(comp.getX()); request.patient.gender.setY(comp.getY()); } else if (comp.getName().equals("straatAndNumber")) { request.patient.straatAndNumber.setValue(((JTextField) comp).getText()); request.patient.straatAndNumber.setX(comp.getX()); request.patient.straatAndNumber.setY(comp.getY()); request.patient.straatAndNumber.setWidth(comp.getWidth()); } else if (comp.getName().equals("zip")) { request.patient.zip.setValue(((JTextField) comp).getText()); request.patient.zip.setX(comp.getX()); request.patient.zip.setY(comp.getY()); request.patient.zip.setWidth(comp.getWidth()); } else if (comp.getName().equals("city")) { request.patient.city.setValue(((JTextField) comp).getText()); request.patient.city.setX(comp.getX()); request.patient.city.setY(comp.getY()); request.patient.city.setWidth(comp.getWidth()); } else if (comp.getName().equals("country")) { request.patient.country.setValue((String) (((JComboBox) comp).getSelectedItem())); request.patient.country.setX(comp.getX()); request.patient.country.setY(comp.getY()); } else if (comp.getName().equals("nationalNumber")) { request.patient.nationalNumber.setValue(((JTextField) comp).getText()); request.patient.nationalNumber.setX(comp.getX()); request.patient.nationalNumber.setY(comp.getY()); request.patient.nationalNumber.setWidth(comp.getWidth()); } else if (comp.getName().equals("Save")) { JButton jbut = (JButton) comp; ImageIcon icon = (ImageIcon) jbut.getIcon(); request.buttons.save.setX(comp.getX()); request.buttons.save.setY(comp.getY()); request.buttons.save.setValue("Save"); if (icon != null) { request.buttons.save.setIcon(icon.getDescription()); } } else if (comp.getName().equals("Search")) { } else if (comp.getName().equals("saveAndSend")) { request.patient.nationalNumber.setValue(((JTextField) comp).getText()); request.patient.nationalNumber.setX(comp.getX()); request.patient.nationalNumber.setY(comp.getY()); request.patient.nationalNumber.setWidth(comp.getWidth()); } else if (comp.getName().equals("print")) { request.patient.nationalNumber.setValue(((JTextField) comp).getText()); request.patient.nationalNumber.setX(comp.getX()); request.patient.nationalNumber.setY(comp.getY()); request.patient.nationalNumber.setWidth(comp.getWidth()); } else { Class<? extends Component> c = comp.getClass(); if (c.getSimpleName().equals("JLabel")) { JLabel lbl = (JLabel) comp; LabrXMLLabel l = new LabrXMLLabel(); l.setColor(String.valueOf(lbl.getForeground().getRGB())); l.setSize(lbl.getFont().getSize()); l.setId(lbl.getName()); l.setValue(lbl.getText()); l.setX(lbl.getX()); l.setY(lbl.getY()); request.labels.getLabel().add(l); } ; if (c.getSimpleName().equals("JCheckBox")) { JCheckBox chbx = (JCheckBox) comp; LabrXMLRequest req = new LabrXMLRequest(); req.setX(chbx.getX()); req.setY(chbx.getY()); req.setLoinc(chbx.getName()); req.setValue(chbx.getText()); req.setSelected(chbx.isSelected()); request.requests.getRequest().add(req); } ; if (c.getSimpleName().equals("JTextBox")) { } ; } } } m.marshal(request, new File(PublicVars.getUserData()[9] + "\\" + profile + ".xml")); } } catch (JAXBException e) { e.printStackTrace(); } }
From source file:labr_client.xml.ObjToXML.java
public static LabrRequest saveLabrRequest(Component[] comps) { try {/*from w w w.j a v a 2 s . co m*/ if (comps != null) { JAXBContext context = JAXBContext.newInstance(LabrRequest.class); Marshaller m = context.createMarshaller(); //for pretty-print XML in JAXB m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); LabrRequest request = new LabrRequest(); for (Component comp : comps) { if (comp.getName() != null) { if (comp.getName().equals("name")) { request.patient.name.setValue(((JTextField) comp).getText()); request.patient.name.setX(comp.getX()); request.patient.name.setY(comp.getY()); request.patient.name.setWidth(comp.getWidth()); } else if (comp.getName().equals("firstName")) { request.patient.firstName.setValue(((JTextField) comp).getText()); request.patient.firstName.setX(comp.getX()); request.patient.firstName.setY(comp.getY()); request.patient.firstName.setWidth(comp.getWidth()); } else if (comp.getName().equals("birthDate")) { request.patient.birthDate.setValue(((JFormattedTextField) comp).getText()); request.patient.birthDate.setX(comp.getX()); request.patient.birthDate.setY(comp.getY()); request.patient.birthDate.setWidth(comp.getWidth()); } else if (comp.getName().equals("gender")) { request.patient.gender.setValue((String) (((JComboBox) comp).getSelectedItem())); request.patient.gender.setX(comp.getX()); request.patient.gender.setY(comp.getY()); } else if (comp.getName().equals("straatAndNumber")) { request.patient.straatAndNumber.setValue(((JTextField) comp).getText()); request.patient.straatAndNumber.setX(comp.getX()); request.patient.straatAndNumber.setY(comp.getY()); request.patient.straatAndNumber.setWidth(comp.getWidth()); } else if (comp.getName().equals("zip")) { request.patient.zip.setValue(((JTextField) comp).getText()); request.patient.zip.setX(comp.getX()); request.patient.zip.setY(comp.getY()); request.patient.zip.setWidth(comp.getWidth()); } else if (comp.getName().equals("city")) { request.patient.city.setValue(((JTextField) comp).getText()); request.patient.city.setX(comp.getX()); request.patient.city.setY(comp.getY()); request.patient.city.setWidth(comp.getWidth()); } else if (comp.getName().equals("country")) { request.patient.country.setValue((String) (((JComboBox) comp).getSelectedItem())); request.patient.country.setX(comp.getX()); request.patient.country.setY(comp.getY()); } else if (comp.getName().equals("nationalNumber")) { request.patient.nationalNumber.setValue(((JTextField) comp).getText()); request.patient.nationalNumber.setX(comp.getX()); request.patient.nationalNumber.setY(comp.getY()); request.patient.nationalNumber.setWidth(comp.getWidth()); } else if (comp.getName().equals("Save")) { JButton jbut = (JButton) comp; ImageIcon icon = (ImageIcon) jbut.getIcon(); request.buttons.save.setX(comp.getX()); request.buttons.save.setY(comp.getY()); request.buttons.save.setValue("Save"); if (icon != null) { request.buttons.save.setIcon(icon.getDescription()); } } else if (comp.getName().equals("Search")) { } else if (comp.getName().equals("saveAndSend")) { request.patient.nationalNumber.setValue(((JTextField) comp).getText()); request.patient.nationalNumber.setX(comp.getX()); request.patient.nationalNumber.setY(comp.getY()); request.patient.nationalNumber.setWidth(comp.getWidth()); } else if (comp.getName().equals("print")) { request.patient.nationalNumber.setValue(((JTextField) comp).getText()); request.patient.nationalNumber.setX(comp.getX()); request.patient.nationalNumber.setY(comp.getY()); request.patient.nationalNumber.setWidth(comp.getWidth()); } else { Class<? extends Component> c = comp.getClass(); if (c.getSimpleName().equals("JLabel")) { JLabel lbl = (JLabel) comp; LabrXMLLabel l = new LabrXMLLabel(); l.setColor(String.valueOf(lbl.getForeground().getRGB())); l.setSize(lbl.getFont().getSize()); l.setId(lbl.getName()); l.setValue(lbl.getText()); l.setX(lbl.getX()); l.setY(lbl.getY()); request.labels.getLabel().add(l); } ; if (c.getSimpleName().equals("JCheckBox")) { JCheckBox chbx = (JCheckBox) comp; LabrXMLRequest req = new LabrXMLRequest(); req.setX(chbx.getX()); req.setY(chbx.getY()); req.setLoinc(chbx.getName()); req.setValue(chbx.getText()); req.setSelected(chbx.isSelected()); request.requests.getRequest().add(req); } ; if (c.getSimpleName().equals("JTextBox")) { } ; } } } SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmm"); String date = dateFormat.format(Calendar.getInstance().getTime()); request.attributes.setTitle("LABR-" + PublicVars.getUserData()[5] + "-" + date); return request; } return null; } catch (JAXBException e) { e.printStackTrace(); return null; } }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
void setSelectedDependenciesString(String deps) { HashSet<String> hs = new HashSet<>(Arrays.asList(deps.split(","))); for (List<JCheckBox> chList : chkBoxesMap.values()) { for (JCheckBox cb : chList) { cb.setSelected(hs.contains(cb.getName())); }//from w w w .j a v a 2s . c o m } }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
void setSelectedDependencies(List<String> deps) { HashSet<String> hs = new HashSet<>(deps); for (List<JCheckBox> chList : chkBoxesMap.values()) { for (JCheckBox cb : chList) { cb.setSelected(hs.contains(cb.getName())); }//from www. java 2s . com } }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
public List<String> getSelectedDependencies() { List<String> ret = new ArrayList<>(); for (List<JCheckBox> chList : chkBoxesMap.values()) { for (JCheckBox cb : chList) { if (cb.isEnabled() && cb.isSelected()) { ret.add(cb.getName()); }/*from ww w. j a v a2 s .co m*/ } } return ret; }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.BootDependenciesPanel.java
public String getSelectedDependenciesString() { StringBuilder sb = new StringBuilder(); for (List<JCheckBox> chList : chkBoxesMap.values()) { for (JCheckBox cb : chList) { if (cb.isEnabled() && cb.isSelected()) { sb.append(cb.getName()).append(','); }/*from www . ja v a2s .c o m*/ } } // remove last comma (if present) if (sb.length() > 0) { sb.setLength(sb.length() - 1); } return sb.toString(); }
From source file:configuration.Util.java
private static void uspBoxSpin(workflow_properties properties, HashMap<JCheckBox, JSpinner> BoxSpin) { for (JCheckBox cb : BoxSpin.keySet()) { String s = cb.getName(); if (properties.isSet(s)) { cb.setEnabled(true);/*w ww . ja va 2 s .c o m*/ cb.setSelected(true); if (BoxSpin.get(cb) != null) { BoxSpin.get(cb).setEnabled(true); } } } }
From source file:configuration.Util.java
private static void uspBoxText(workflow_properties properties, HashMap<JCheckBox, JTextField> BoxText) { for (JCheckBox cb : BoxText.keySet()) { String s = cb.getName(); if (properties.isSet(s)) { cb.setEnabled(true);//from w w w .j a v a 2 s.c o m cb.setSelected(true); if (BoxText.get(cb) != null) { BoxText.get(cb).setEnabled(true); } } } }
From source file:configuration.Util.java
private static void uspBoxCombo(workflow_properties properties, HashMap<JCheckBox, JComboBox> BoxCombo) { for (JCheckBox cb : BoxCombo.keySet()) { String s = cb.getName(); if (properties.isSet(s)) { cb.setEnabled(true);/* w w w . j a v a2 s.c om*/ cb.setSelected(true); if (BoxCombo.get(cb) != null) { BoxCombo.get(cb).setEnabled(true); } } } }
From source file:configuration.Util.java
private static void uspBoxTextVal(workflow_properties properties, HashMap<JCheckBox, JTextField> BoxText) { for (JCheckBox cb : BoxText.keySet()) { boolean b = false; String k_s = cb.getName(); if (properties.isSet(k_s)) { b = true;/* ww w . j a va 2 s . co m*/ } if (BoxText.get(cb) != null) { String v_s = BoxText.get(cb).getName(); if (properties.isSet(v_s)) { String s_bk = properties.get(v_s); BoxText.get(cb).setText(s_bk); BoxText.get(cb).setEnabled(false); if (b) { properties.put(cb.getName(), s_bk); } } } } }