List of usage examples for com.jgoodies.binding PresentationModel getModel
public AbstractValueModel getModel(String propertyName)
From source file:ambit2.ui.table.FindNavigator.java
License:Open Source License
public JComponent buildPanel(final IFindNavigator pageable) { FormLayout layout = new FormLayout("pref, 1dlu, fill:50dlu:grow,1dlu,pref, 1dlu,pref", "pref"); PresentationModel<IFindNavigator> presentationModel = new PresentationModel<IFindNavigator>(pageable); label = new JLabel("Find"); findValue = BasicComponentFactory//from w ww . j a va 2 s . c o m .createTextField(presentationModel.getModel(IFindNavigator.PROPERTY_VALUE)); findValue.setToolTipText("Enter value to search"); prevPage = new JButton(new AbstractAmbitAction("<", "images/control_rewind.png", "Find previous") { public void actionPerformed(ActionEvent e) { pageable.findPrevious(); } }); nextPage = new JButton(new AbstractAmbitAction(">", "images/control_fastforward.png", "Find next") { public void actionPerformed(ActionEvent e) { pageable.findNext(); } }); PanelBuilder panel = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); //"pref, 1dlu,pref,1dlu,fill:25dlu:grow,1dlu,pref, 1dlu,fill:25dlu:grow, 1dlu,pref, 1dlu,fill:25dlu:grow", panel.add(label, cc.xy(1, 1)); panel.add(findValue, cc.xy(3, 1)); panel.add(prevPage, cc.xy(5, 1)); panel.add(nextPage, cc.xy(7, 1)); return panel.getPanel(); }
From source file:ambit2.ui.table.PageNavigator.java
License:Open Source License
public JComponent buildPanel(final IPageNavigator pageable) { FormLayout layout = new FormLayout( "pref, 1dlu,pref,1dlu, fill:25dlu:grow,1dlu,pref, 1dlu,fill:25dlu:grow,1dlu,pref, 1dlu,pref, 1dlu,fill:25dlu:grow", "pref"); PresentationModel<IPageNavigator> presentationModel = new PresentationModel<IPageNavigator>(pageable); label = new JLabel("Page"); currentPage = BasicComponentFactory/* w ww .ja v a2s .c o m*/ .createIntegerField(presentationModel.getModel(IPageNavigator.PROPERTY_PAGE)); currentPage.setToolTipText("Current page"); allPages = BasicComponentFactory .createIntegerField(presentationModel.getModel(IPageNavigator.PROPERTY_MAXPAGES)); allPages.setToolTipText("All pages"); allPages.setEditable(false); pageSize = BasicComponentFactory .createIntegerField(presentationModel.getModel(IPageNavigator.PROPERTY_PAGESIZE)); pageSize.setToolTipText("Records per page"); prevPage = new JButton(new AbstractAmbitAction("<", "images/resultset_previous.png", "Previous page") { public void actionPerformed(ActionEvent e) { pageable.previousPage(); } }); nextPage = new JButton(new AbstractAmbitAction("<", "images/resultset_next.png", "Next page") { public void actionPerformed(ActionEvent e) { pageable.nextPage(); } }); PanelBuilder panel = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); //"pref, 1dlu,pref,1dlu,fill:25dlu:grow,1dlu,pref, 1dlu,fill:25dlu:grow, 1dlu,pref, 1dlu,fill:25dlu:grow", panel.add(label, cc.xy(1, 1)); panel.add(prevPage, cc.xy(3, 1)); panel.add(currentPage, cc.xy(5, 1)); panel.add(new JLabel("/"), cc.xy(7, 1)); panel.add(allPages, cc.xy(9, 1)); panel.add(nextPage, cc.xy(11, 1)); panel.add(pageSize, cc.xy(13, 1)); return panel.getPanel(); }
From source file:ambit2.ui.table.RecordNavigator.java
License:Open Source License
public JComponent buildPanel(final IRecordNavigator navigator) { FormLayout layout = new FormLayout( "pref, 1dlu,pref,1dlu,fill:25dlu:grow,1dlu,pref,1dlu,fill:25dlu:grow,1dlu,pref", "pref"); PresentationModel<IRecordNavigator> presentationModel = new PresentationModel<IRecordNavigator>(navigator); label = new JLabel("Record"); currentPage = BasicComponentFactory/*from w w w .j ava 2 s.c o m*/ .createIntegerField(presentationModel.getModel(IRecordNavigator.PROPERTY_RECORD)); currentPage.setToolTipText("Current record"); allPages = BasicComponentFactory .createIntegerField(presentationModel.getModel(IRecordNavigator.PROPERTY_MAXRECORDS)); allPages.setToolTipText("All pages"); allPages.setEditable(false); prevPage = new JButton(new AbstractAmbitAction("<", "images/resultset_previous.png", "Previous record") { public void actionPerformed(ActionEvent e) { navigator.prev(); } }); nextPage = new JButton(new AbstractAmbitAction(">", "images/resultset_next.png", "Next record") { public void actionPerformed(ActionEvent e) { navigator.next(); } }); PanelBuilder panel = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); panel.add(label, cc.xy(1, 1)); panel.add(prevPage, cc.xy(3, 1)); panel.add(currentPage, cc.xy(5, 1)); panel.add(new JLabel("/"), cc.xy(7, 1)); panel.add(allPages, cc.xy(9, 1)); panel.add(nextPage, cc.xy(11, 1)); return panel.getPanel(); }
From source file:eu.europa.ec.markt.dss.applet.view.validation.ValidationView.java
License:Open Source License
/** * The default constructor for ValidationView. * * @param core/*from www . j a v a 2s. c o m*/ * @param controller * @param model */ public ValidationView(final AppletCore core, final ValidationWizardController controller, final ValidationModel model) { super(core, controller, model); selectFileA = ComponentFactory.createFileChooser(I18N_BROWSE_SIGNED, true, new SelectFileAEventListener()); selectFileA.setName("fileA"); selectFileB = ComponentFactory.createFileChooser(I18N_BROWSE_ORIGINAL, true, new SelectFileBEventListener()); selectFileB.setName("fileB"); clear = ComponentFactory.createClearButton(true, new ClearEventListener()); clear.setName("clear"); fileA = ComponentFactory.createLabel(I18N_NO_FILE_SELECTED); fileB = ComponentFactory.createLabel(I18N_NO_FILE_SELECTED); PresentationModel<ValidationModel> presentationModel = new PresentationModel<ValidationModel>(getModel()); AbstractValueModel validationLegacyChosen = presentationModel .getModel(getModel().CHANGE_PROPERTY_VALIDATION_LEGACY_CHOSEN); validationLegacy = ComponentFactory.createRadioButton(I18_VALIDATION_LEGACY, validationLegacyChosen, Boolean.TRUE); validationLegacy.setName("validationLegacy"); validation102853 = ComponentFactory.createRadioButton(I18_VALIDATION_102853, validationLegacyChosen, Boolean.FALSE); validation102853.setName("validation"); AbstractValueModel validationDefaultChosen = presentationModel .getModel(getModel().CHANGE_PROPERTY_DEFAULT_POLICY); defaultValidation = ComponentFactory.createRadioButton(I18N_DEFAULT_VALIDATION_102853, validationDefaultChosen, Boolean.TRUE); defaultValidation.setName("defaultValidation"); customValidation = ComponentFactory.createRadioButton(I18N_CUSTOM_VALIDATION_102853, validationDefaultChosen, Boolean.FALSE); customValidation.setName("customValidation"); filePolicyLabel = ComponentFactory.createLabel(I18N_NO_FILE_SELECTED); selectFilePolicy = ComponentFactory.createFileChooser(I18N_BROWSE_VALIDATION_POLICY, true, new SelectPolicyFileEventListener()); selectFilePolicy.setName("selectFilePolicy"); activeOrDisableCustomFile(); }
From source file:fi.smaa.jsmaa.gui.components.BetaMeasurementPanel.java
License:Open Source License
public BetaMeasurementPanel(JComponent parent, PresentationModel<BetaMeasurement> model) { ValueModel alphaModel = new NonNegativeValueModel(parent, model.getModel(BetaMeasurement.PROPERTY_ALPHA), "alpha"); ValueModel betaModel = new NonNegativeValueModel(parent, model.getModel(BetaMeasurement.PROPERTY_BETA), "beta"); ValueModel minModel = new BetaMinMaxValueModel(parent, model.getBean(), model.getModel(BetaMeasurement.PROPERTY_MIN), true); ValueModel maxModel = new BetaMinMaxValueModel(parent, model.getBean(), model.getModel(BetaMeasurement.PROPERTY_MAX), false); setLayout(new FlowLayout(FlowLayout.LEADING, 0, 5)); alphaField = BasicComponentFactory.createFormattedTextField(alphaModel, new DefaultFormatter()); betaField = BasicComponentFactory.createFormattedTextField(betaModel, new DefaultFormatter()); alphaField.setHorizontalAlignment(JTextField.CENTER); betaField.setHorizontalAlignment(JTextField.CENTER); alphaField.setColumns(5);//from w ww . j ava2s. c o m betaField.setColumns(5); minField = BasicComponentFactory.createFormattedTextField(minModel, new DefaultFormatter()); maxField = BasicComponentFactory.createFormattedTextField(maxModel, new DefaultFormatter()); minField.setHorizontalAlignment(JTextField.CENTER); maxField.setHorizontalAlignment(JTextField.CENTER); minField.setColumns(5); maxField.setColumns(5); add(new JLabel("\u03B1")); add(alphaField); add(new JLabel("\u03B2")); add(betaField); add(new JLabel("min")); add(minField); add(new JLabel("max")); add(maxField); addFocusListener(new FocusTransferrer(alphaField)); setFocusTraversalPolicyProvider(true); }
From source file:fi.smaa.jsmaa.gui.components.GaussianMeasurementPanel.java
License:Open Source License
public GaussianMeasurementPanel(JComponent parent, PresentationModel<GaussianMeasurement> m) { setLayout(new FlowLayout()); meanField = BasicComponentFactory.createFormattedTextField(m.getModel(GaussianMeasurement.PROPERTY_MEAN), new DefaultFormatter()); stDevField = BasicComponentFactory.createFormattedTextField(new NonNegativeValueModel(parent, m.getModel(GaussianMeasurement.PROPERTY_STDEV), "Standard deviation"), new DefaultFormatter()); meanField.setHorizontalAlignment(JTextField.CENTER); stDevField.setHorizontalAlignment(JTextField.CENTER); meanField.setColumns(5);/* w ww. j av a 2 s. c o m*/ stDevField.setColumns(5); add(meanField); add(new JLabel("\u00B1")); add(stDevField); addFocusListener(new FocusTransferrer(meanField)); setFocusTraversalPolicyProvider(true); setFocusTraversalPolicy(new TwoComponentFocusTraversalPolicy(meanField, stDevField)); }
From source file:fi.smaa.jsmaa.gui.components.IntervalPanel.java
License:Open Source License
public IntervalPanel(JComponent parent, PresentationModel<Interval> model) { ValueModel startModel = new IntervalValueModel(parent, model.getBean(), model.getModel(Interval.PROPERTY_START), true); ValueModel endModel = new IntervalValueModel(parent, model.getBean(), model.getModel(Interval.PROPERTY_END), false);/* w w w . j a v a2 s . c o m*/ init(startModel, endModel); addFocusListener(new FocusTransferrer(endField)); setFocusTraversalPolicyProvider(true); setFocusTraversalPolicy(new TwoComponentFocusTraversalPolicy(endField, startField)); }
From source file:fi.smaa.jsmaa.gui.views.CriteriaListView.java
License:Open Source License
public JComponent buildPanel() { FormLayout layout = new FormLayout("pref, 3dlu, left:pref", "p"); if (hasCardinalCriteria(model)) { layout.appendColumn(ColumnSpec.decode("3dlu")); layout.appendColumn(ColumnSpec.decode("center:pref")); }/*from w w w. ja v a2 s .c o m*/ if (hasScaleCriteria(model)) { layout.appendColumn(ColumnSpec.decode("3dlu")); layout.appendColumn(ColumnSpec.decode("center:pref")); } PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(BorderFactory.createEmptyBorder()); CellConstraints cc = new CellConstraints(); builder.addLabel("Name", cc.xy(1, 1)); builder.addLabel("Type", cc.xy(3, 1)); if (hasCardinalCriteria(model)) { builder.addLabel("Ascending", cc.xy(5, 1)); } if (hasScaleCriteria(model)) { builder.addLabel("Scale", cc.xy(7, 1)); } int row = 3; for (Criterion c : model.getCriteria()) { LayoutUtil.addRow(layout); PresentationModel<Criterion> pm = new PresentationModel<Criterion>(c); builder.add(BasicComponentFactory.createLabel(pm.getModel(Criterion.PROPERTY_NAME)), cc.xy(1, row)); builder.add(BasicComponentFactory.createLabel(pm.getModel(Criterion.PROPERTY_TYPELABEL)), cc.xy(3, row)); if (c instanceof CardinalCriterion) { CardinalCriterion cardCrit = (CardinalCriterion) c; PresentationModel<CardinalCriterion> cpm = new PresentationModel<CardinalCriterion>(cardCrit); builder.add( BasicComponentFactory.createCheckBox(cpm.getModel(ScaleCriterion.PROPERTY_ASCENDING), null), cc.xy(5, row)); } if (c instanceof ScaleCriterion) { ScaleCriterion cardCrit = (ScaleCriterion) c; PresentationModel<ScaleCriterion> cpm = new PresentationModel<ScaleCriterion>(cardCrit); builder.add(BasicComponentFactory.createLabel(cpm.getModel(ScaleCriterion.PROPERTY_SCALE), new IntervalFormat()), cc.xy(7, row)); } row += 2; } return builder.getPanel(); }
From source file:fi.smaa.jsmaa.gui.views.CriterionView.java
License:Open Source License
private JComponent buildOverviewPart() { FormLayout layout = new FormLayout("right:pref, 3dlu, left:pref", "p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); PresentationModel<Criterion> pm = new PresentationModel<Criterion>(criterion); builder.addLabel("Name:", cc.xy(1, 1)); builder.add(BasicComponentFactory.createLabel(pm.getModel(Criterion.PROPERTY_NAME)), cc.xy(3, 1)); builder.addLabel("Type:", cc.xy(1, 3)); builder.add(BasicComponentFactory.createLabel(pm.getModel(Criterion.PROPERTY_TYPELABEL)), cc.xy(3, 3)); int row = 5;// www. j a v a 2s . com if (criterion instanceof ScaleCriterion) { LayoutUtil.addRow(layout); ScaleCriterion cardCrit = (ScaleCriterion) criterion; PresentationModel<ScaleCriterion> pmc = new PresentationModel<ScaleCriterion>(cardCrit); builder.addLabel("Scale:", cc.xy(1, row)); builder.add(BasicComponentFactory.createLabel(pmc.getModel(ScaleCriterion.PROPERTY_SCALE), new IntervalFormat()), cc.xy(3, row)); row += 2; } if (criterion instanceof CardinalCriterion) { CardinalCriterion cardCrit = (CardinalCriterion) criterion; PresentationModel<CardinalCriterion> pmc = new PresentationModel<CardinalCriterion>(cardCrit); LayoutUtil.addRow(layout); builder.addLabel("Ascending:", cc.xy(1, row)); builder.add(BasicComponentFactory.createCheckBox(pmc.getModel(ScaleCriterion.PROPERTY_ASCENDING), null), cc.xy(3, row)); } return builder.getPanel(); }
From source file:fi.smaa.jsmaa.gui.views.DefaultScaleRenderer.java
License:Open Source License
public JComponent getScaleComponent(Criterion c) { if (c instanceof ScaleCriterion) { PresentationModel<ScaleCriterion> cpm = new PresentationModel<ScaleCriterion>((ScaleCriterion) c); return BasicComponentFactory.createLabel(cpm.getModel(ScaleCriterion.PROPERTY_SCALE), new IntervalFormat()); }//from w ww. ja v a 2 s. c o m return new JLabel("NA"); }