protected void initDataBindings() { BeanProperty<Settings, List<String>> settingsBeanProperty_4 = BeanProperty.create("tvShowSettings.tvShowDataSource"); JTableBinding<String, Settings, JTable> jTableBinding = SwingBindings.createJTableBinding( UpdateStrategy.READ, settings, settingsBeanProperty_4, tableTvShowSources); // ObjectProperty<String> stringObjectProperty = ObjectProperty.create(); jTableBinding.addColumnBinding(stringObjectProperty); // jTableBinding.bind(); // BeanProperty<Settings, Boolean> settingsBeanProperty = BeanProperty.create("tvShowSettings.syncTrakt"); BeanProperty<JCheckBox, Boolean> jCheckBoxBeanProperty = BeanProperty.create("selected"); AutoBinding<Settings, Boolean, JCheckBox, Boolean> autoBinding = Bindings.createAutoBinding( UpdateStrategy.READ_WRITE, settings, settingsBeanProperty, chckbxTraktTv, jCheckBoxBeanProperty); autoBinding.bind(); // BeanProperty<Settings, Boolean> settingsBeanProperty_1 = BeanProperty.create("tvShowSettings.dvdOrder"); AutoBinding<Settings, Boolean, JCheckBox, Boolean> autoBinding_1 = Bindings.createAutoBinding( UpdateStrategy.READ_WRITE, settings, settingsBeanProperty_1, cbDvdOrder, jCheckBoxBeanProperty); autoBinding_1.bind(); }
protected void initDataBindings() { BeanProperty<YachtClass, String> yachtClassBeanProperty = BeanProperty.create("name"); BeanProperty<JTextField, String> jTextFieldBeanProperty = BeanProperty.create("text"); AutoBinding<YachtClass, String, JTextField, String> autoBinding = Bindings.createAutoBinding( UpdateStrategy.READ_WRITE, m_yachtClass, yachtClassBeanProperty, textField, jTextFieldBeanProperty); autoBinding.bind(); // BeanProperty<YachtClass, Float> yachtClassBeanProperty_1 = BeanProperty.create("coefficient"); BeanProperty<JTextField, String> jTextFieldBeanProperty_1 = BeanProperty.create("text"); AutoBinding<YachtClass, Float, JTextField, String> autoBinding_1 = Bindings.createAutoBinding( UpdateStrategy.READ_WRITE, m_yachtClass, yachtClassBeanProperty_1, textField_1, jTextFieldBeanProperty_1); autoBinding_1.bind(); // BeanProperty<YachtClass, Integer> yachtClassBeanProperty_2 = BeanProperty.create("displacement"); BeanProperty<JTextField, String> jTextFieldBeanProperty_2 = BeanProperty.create("text"); AutoBinding<YachtClass, Integer, JTextField, String> autoBinding_2 = Bindings.createAutoBinding( UpdateStrategy.READ_WRITE, m_yachtClass, yachtClassBeanProperty_2, textField_2, jTextFieldBeanProperty_2); autoBinding_2.bind(); }
private void bind() { { Object sourceObject = myThis; Property sourceProperty = BeanProperty.create("sourcesPath"); Object targetObject = this.myPath0; Property targetProperty = BeanProperty.create("path"); AutoBinding binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ_WRITE, sourceObject, sourceProperty, targetObject, targetProperty); binding.bind(); ListSequence.fromList(this.myBindings).addElement(binding); } }
public RTextField createRGGElement(Element element, RGG rggInstance) { if (element.getNodeType() != Element.ELEMENT_NODE) { throw new IllegalArgumentException("elements node type must be ELEMENT_NODE"); } RTextField rtextfield = new RTextField(); VTextField vtextfield = new VTextField(); /** * **************** initialize and set attributes values ************************************* */ String var = element.getAttribute(RGG.getConfiguration().getString("VAR")); String label = element.getAttribute(RGG.getConfiguration().getString("LABEL")); String colspan = element.getAttribute(RGG.getConfiguration().getString("COLUMN-SPAN")); String defaultvalue = element.getAttribute(RGG.getConfiguration().getString("DEFAULT-VALUE")); String datatype = element.getAttribute(RGG.getConfiguration().getString("DATA-TYPE")); String size = element.getAttribute(RGG.getConfiguration().getString("SIZE")); String enabled = element.getAttribute(RGG.getConfiguration().getString("ENABLED")); /** * ******************************************************************************************** */ if (StringUtils.isNotBlank(var)) { rtextfield.setVar(var); } if (StringUtils.isNotBlank(label)) { rtextfield.setLabel(label); } vtextfield.setLabelText(rtextfield.getLabel()); if (StringUtils.isNotBlank(colspan)) { if (StringUtils.isNumeric(colspan)) { vtextfield.setColumnSpan(Integer.parseInt(colspan)); } else if (StringUtils.equals(colspan, RGG.getConfiguration().getString("FULL-SPAN"))) { vtextfield.setColumnSpan(LayoutInfo.FULL_SPAN); } else { throw new NumberFormatException( RGG.getConfiguration().getString("COLUMN-SPAN") + " seems not to be a number: " + colspan + "nor a known keyword!"); } } if (StringUtils.isNotBlank(defaultvalue)) { vtextfield.setDefaultvalue(defaultvalue); } if (StringUtils.isNotBlank(datatype)) { if (StringUtils.equalsIgnoreCase(RGG.getConfiguration().getString("NUMERIC"), datatype)) { vtextfield.setNumeric(true); } } if (StringUtils.isNotBlank(size) && StringUtils.isNumeric(size)) { vtextfield.setColumns(Integer.parseInt(size)); } if (StringUtils.isNotBlank(enabled)) { if (util.match("/(\\w+)\\./", enabled)) { String id = util.group(1); enabled = util.substitute("s/" + id + "\\.//g", enabled); AutoBinding<Object, Object, Object, Object> binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ, // one-way binding rggInstance.getObject(id), // source of value ELProperty.create(enabled), // the property to get vtextfield, // the "backing bean" BeanProperty.create("enabled") // property to set ); binding.bind(); } } rtextfield.setTextfield(vtextfield); return rtextfield; }
protected void initDataBindings() { BeanProperty<MovieSelectionModel, String> movieSelectionModelBeanProperty = BeanProperty.create("selectedMovie.titleForUi"); BeanProperty<JLabel, String> jLabelBeanProperty = BeanProperty.create("text"); AutoBinding<MovieSelectionModel, String, JLabel, String> autoBinding = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty, lblMovieName, jLabelBeanProperty); autoBinding.bind(); // BeanProperty<MovieSelectionModel, Float> movieSelectionModelBeanProperty_1 = BeanProperty.create("selectedMovie.rating"); AutoBinding<MovieSelectionModel, Float, JLabel, String> autoBinding_1 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_1, lblRating, jLabelBeanProperty); autoBinding_1.bind(); // BeanProperty<StarRater, Float> starRaterBeanProperty = BeanProperty.create("rating"); AutoBinding<MovieSelectionModel, Float, StarRater, Float> autoBinding_3 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_1, panelRatingStars, starRaterBeanProperty); autoBinding_3.bind(); // BeanProperty<MovieSelectionModel, String> movieSelectionModelBeanProperty_14 = BeanProperty.create("selectedMovie.plot"); BeanProperty<JTextPane, String> jTextPaneBeanProperty = BeanProperty.create("text"); AutoBinding<MovieSelectionModel, String, JTextPane, String> autoBinding_15 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_14, tpOverview, jTextPaneBeanProperty); autoBinding_15.bind(); // BeanProperty<MovieSelectionModel, Integer> movieSelectionModelBeanProperty_2 = BeanProperty.create("selectedMovie.votes"); AutoBinding<MovieSelectionModel, Integer, JLabel, String> autoBinding_2 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_2, lblVoteCount, jLabelBeanProperty); autoBinding_2.setConverter(new VoteCountConverter()); autoBinding_2.bind(); // BeanProperty<MovieSelectionModel, Certification> movieSelectionModelBeanProperty_6 = BeanProperty.create("selectedMovie.certification"); BeanProperty<JLabel, Icon> jLabelBeanProperty_2 = BeanProperty.create("icon"); AutoBinding<MovieSelectionModel, Certification, JLabel, Icon> autoBinding_7 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_6, lblCertificationImage, jLabelBeanProperty_2); autoBinding_7.setConverter(new CertificationImageConverter()); autoBinding_7.bind(); // BeanProperty<MovieSelectionModel, String> movieSelectionModelBeanProperty_3 = BeanProperty.create("selectedMovie.tagline"); AutoBinding<MovieSelectionModel, String, JLabel, String> autoBinding_4 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_3, lblTagline, jLabelBeanProperty); autoBinding_4.bind(); // BeanProperty<MovieSelectionModel, Boolean> movieSelectionModelBeanProperty_7 = BeanProperty.create("selectedMovie.watched"); AutoBinding<MovieSelectionModel, Boolean, JLabel, Icon> autoBinding_8 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_7, lblWatchedImage, jLabelBeanProperty_2); autoBinding_8.setConverter(new WatchedIconConverter2()); autoBinding_8.bind(); // BeanProperty<MovieSelectionModel, String> movieSelectionModelBeanProperty_9 = BeanProperty.create("selectedMovie.mediaInfoVideoFormat"); AutoBinding<MovieSelectionModel, String, JLabel, Icon> autoBinding_11 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_9, lblMediaLogoResolution, jLabelBeanProperty_2); autoBinding_11.setConverter(new MediaInfoVideoFormatConverter()); autoBinding_11.bind(); // BeanProperty<MovieSelectionModel, String> movieSelectionModelBeanProperty_10 = BeanProperty.create("selectedMovie.mediaInfoVideoCodec"); AutoBinding<MovieSelectionModel, String, JLabel, Icon> autoBinding_12 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_10, lblMediaLogoVideoCodec, jLabelBeanProperty_2); autoBinding_12.setConverter(new MediaInfoVideoCodecConverter()); autoBinding_12.bind(); // BeanProperty<MovieSelectionModel, String> movieSelectionModelBeanProperty_11 = BeanProperty.create("selectedMovie.mediaInfoAudioCodecAndChannels"); AutoBinding<MovieSelectionModel, String, JLabel, Icon> autoBinding_13 = Bindings.createAutoBinding( UpdateStrategy.READ, movieSelectionModel, movieSelectionModelBeanProperty_11, lblMediaLogoAudio, jLabelBeanProperty_2); autoBinding_13.setConverter(new MediaInfoAudioCodecConverter()); autoBinding_13.bind(); }
public RElement createRGGElement(Element element, RGG rggInstance) { if (element.getNodeType() != Element.ELEMENT_NODE) throw new IllegalArgumentException("elements node type must be ELEMENT_NODE"); /** * **************** initialize and set attributes values ************************************* */ String text = element.getAttribute(RGG.getConfiguration().getString("TEXT")); String colspan = element.getAttribute(RGG.getConfiguration().getString("COLUMN-SPAN")); String alignment = element.getAttribute(RGG.getConfiguration().getString("ALIGNMENT")); String enabled = element.getAttribute(RGG.getConfiguration().getString("ENABLED")); /** * ******************************************************************************************** */ Perl5Util util = new Perl5Util(); VLabel vlabel = new VLabel(text); if (StringUtils.isNotBlank(colspan)) { if (StringUtils.isNumeric(colspan)) { vlabel.setColumnSpan(Integer.parseInt(colspan)); } else if (StringUtils.equals(colspan, RGG.getConfiguration().getString("FULL-SPAN"))) vlabel.setColumnSpan(LayoutInfo.FULL_SPAN); else throw new NumberFormatException( RGG.getConfiguration().getString("COLUMN-SPAN") + " seems not to be a number: " + colspan); } if (StringUtils.isNotBlank(alignment)) { if (StringUtils.equalsIgnoreCase(RGG.getConfiguration().getString("CENTER"), alignment)) { vlabel.setHorizontalAlignment(SwingConstants.CENTER); } else if (StringUtils.equalsIgnoreCase( RGG.getConfiguration().getString("RIGHT"), alignment)) { vlabel.setHorizontalAlignment(SwingConstants.RIGHT); } else if (StringUtils.equalsIgnoreCase( RGG.getConfiguration().getString("LEFT"), alignment)) { vlabel.setHorizontalAlignment(SwingConstants.LEFT); } else if (StringUtils.equalsIgnoreCase(RGG.getConfiguration().getString("TOP"), alignment)) { vlabel.setHorizontalAlignment(SwingConstants.TOP); } else if (StringUtils.equalsIgnoreCase( RGG.getConfiguration().getString("BOTTOM"), alignment)) { vlabel.setHorizontalAlignment(SwingConstants.BOTTOM); } } if (StringUtils.isNotBlank(enabled)) { if (util.match("/(\\w+)\\./", enabled)) { String id = util.group(1); enabled = util.substitute("s/" + id + "\\.//g", enabled); AutoBinding<Object, Object, Object, Object> binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ, // one-way binding rggInstance.getObject(id), // source of value ELProperty.create(enabled), // the property to get vlabel, // the "backing bean" BeanProperty.create("enabled") // property to set ); binding.bind(); } } RLabel rLabel = new RLabel(vlabel); if (element.hasChildNodes()) { // it can only be <iport> setInputPorts(rLabel, element); } return rLabel; }
public RElement createRGGElement(Element element, RGG rggInstance) { if (element.getNodeType() != Element.ELEMENT_NODE) { throw new IllegalArgumentException("elements node type must be ELEMENT_NODE"); } RCheckBox rcheckbox = new RCheckBox(); VCheckBox vcheckbox = new VCheckBox(); /** * **************** initialize and set attributes values ************************************* */ String var = element.getAttribute(RGG.getConfiguration().getString("VAR")); String label = element.getAttribute(RGG.getConfiguration().getString("LABEL")); String colspan = element.getAttribute(RGG.getConfiguration().getString("COLUMN-SPAN")); String selected = element.getAttribute(RGG.getConfiguration().getString("SELECTED")); String returnValueBySelected = element.getAttribute(RGG.getConfiguration().getString("RETURN-VALUE-BY-SELECTED")); String returnValueByNotSelected = element.getAttribute(RGG.getConfiguration().getString("RETURN-VALUE-BY-NOTSELECTED")); String labelPosition = element.getAttribute(RGG.getConfiguration().getString("LABELPOSITION")); String id = element.getAttribute(RGG.getConfiguration().getString("ID")); String enabled = element.getAttribute(RGG.getConfiguration().getString("ENABLED")); /** * ******************************************************************************************** */ if (StringUtils.isNotBlank(var)) { rcheckbox.setVar(var); } if (StringUtils.isNotBlank(label)) { vcheckbox.setLabelText(label); } if (StringUtils.isNotBlank(colspan) && StringUtils.isNumeric(colspan)) { vcheckbox.setColumnSpan(Integer.parseInt(colspan)); } if (StringUtils.isNotBlank(selected)) { if (StringUtils.equalsIgnoreCase("TRUE", selected) || StringUtils.equalsIgnoreCase("T", selected)) { vcheckbox.setSelected(true); } } if (StringUtils.isNotBlank(returnValueBySelected)) { rcheckbox.setReturnValueBySelected(returnValueBySelected); } if (StringUtils.isNotBlank(returnValueByNotSelected)) { rcheckbox.setReturnValueByNotSelected(returnValueByNotSelected); } if (StringUtils.isNotBlank(labelPosition)) { if (StringUtils.equalsIgnoreCase(labelPosition, RGG.getConfiguration().getString("LEFT"))) { vcheckbox.setHorizontalLabelPosition(javax.swing.SwingConstants.LEFT); } else if (StringUtils.equalsIgnoreCase( labelPosition, RGG.getConfiguration().getString("RIGHT"))) { vcheckbox.setHorizontalLabelPosition(javax.swing.SwingConstants.RIGHT); } else { throw new IllegalArgumentException("labelpositon takes only \"left\" or \"right\"!"); } } if (StringUtils.isNotBlank(id)) { rggInstance.addObject(id, vcheckbox); } if (StringUtils.isNotBlank(enabled)) { if (util.match("/(\\w+)\\./", enabled)) { String sourceid = util.group(1); enabled = util.substitute("s/" + sourceid + "\\.//g", enabled); AutoBinding<Object, Object, Object, Object> binding = Bindings.createAutoBinding( AutoBinding.UpdateStrategy.READ, // one-way binding rggInstance.getObject(sourceid), // source of value ELProperty.create(enabled), // the property to get vcheckbox, // the "backing bean" BeanProperty.create("enabled") // property to set ); binding.bind(); } } rcheckbox.setCheckBox(vcheckbox); return rcheckbox; }