List of usage examples for com.jgoodies.binding PresentationModel PresentationModel
public PresentationModel(ValueModel beanChannel)
From source file:eu.europa.esig.dss.applet.view.signature.PersonalDataView.java
License:Open Source License
/** * The default constructor for PersonalDataView. * * @param core/*from w ww . j av a 2 s . c o m*/ * @param controller * @param model */ public PersonalDataView(final AppletCore core, final SignatureWizardController controller, final SignatureModel model) { super(core, controller, model); this.presentationModel = new PresentationModel<SignatureModel>(getModel()); // Initialize value models final ValueModel claimedCheck = presentationModel.getModel(SignatureModel.PROPERTY_CLAIMED_CHECK); final ValueModel claimedRole = presentationModel.getModel(SignatureModel.PROPERTY_CLAIMED_ROLE); final ValueModel policyCheck = presentationModel.getModel(SignatureModel.PROPERTY_SIGNATURE_POLICY_CHECK); final ValueModel policyID = presentationModel.getModel(SignatureModel.PROPERTY_POLICY_ID); final ValueModel policyAlgo = presentationModel.getModel(SignatureModel.PROPERTY_POLICY_ALGO); final ValueModel policyHashValue = presentationModel.getModel(SignatureModel.PROPERTY_POLICY_VALUE); // Initialize components claimedCheckBox = ComponentFactory.createCheckBox(claimedCheck, I18N_CLAIMED_ROLE); policyCheckBox = ComponentFactory.createCheckBox(policyCheck, I18N_SIGNATURE_POLICY); explicitPanel = ComponentFactory.createPanel(); policyIDInput = ComponentFactory.createTextField(policyID, false); policyAlgoInput = ComponentFactory.createTextField(policyAlgo, false); policyHashValueInput = ComponentFactory.createTextField(policyHashValue, false); claimedRoleInput = ComponentFactory.createTextField(claimedRole, false); }
From source file:fi.smaa.jsmaa.gui.components.MeasurementPanel.java
License:Open Source License
private JComponent buildValuePanel() { CardinalMeasurement m = (CardinalMeasurement) holder.getValue(); JComponent measComp = null;/*from www .ja v a2 s . c o m*/ if (m instanceof ExactMeasurement) { ExactMeasurement em = (ExactMeasurement) m; JFormattedTextField tf = BasicComponentFactory.createFormattedTextField( new PresentationModel<ExactMeasurement>(em).getModel(ExactMeasurement.PROPERTY_VALUE), new DefaultFormatter()); tf.setHorizontalAlignment(JTextField.CENTER); tf.setColumns(10); measComp = tf; } else if (m instanceof Interval) { Interval ival = (Interval) m; measComp = new IntervalPanel(this, new PresentationModel<Interval>(ival)); } else if (m instanceof GaussianMeasurement) { GaussianMeasurement gm = (GaussianMeasurement) m; measComp = new GaussianMeasurementPanel(this, new PresentationModel<GaussianMeasurement>(gm)); } else if (m instanceof BetaMeasurement) { BetaMeasurement gm = (BetaMeasurement) m; measComp = new BetaMeasurementPanel(this, new PresentationModel<BetaMeasurement>(gm)); } else if (m instanceof RelativeGaussianMeasurementBase) { RelativeGaussianMeasurementBase gm = (RelativeGaussianMeasurementBase) m; measComp = new RelativMeasurementPanel(this, gm); } else if (m instanceof DiscreteMeasurement) { DiscreteMeasurement dm = (DiscreteMeasurement) m; measComp = new DiscreteMeasurementPanel(this, new PresentationModel<DiscreteMeasurement>(dm)); } else { throw new RuntimeException("unknown measurement type"); } return measComp; }
From source file:fi.smaa.jsmaa.gui.components.RelativMeasurementPanel.java
License:Open Source License
public RelativMeasurementPanel(JComponent parent, RelativeGaussianMeasurementBase meas) { PresentationModel<GaussianMeasurement> baselineModel = new PresentationModel<GaussianMeasurement>( meas.getBaseline());/*from w w w.j a v a 2 s . c om*/ PresentationModel<GaussianMeasurement> relativeModel = new PresentationModel<GaussianMeasurement>( meas.getRelative()); setLayout(new FlowLayout()); JComponent baselineComp = new GaussianMeasurementPanel(this, baselineModel); JComponent relativeComp = new GaussianMeasurementPanel(this, relativeModel); add(baselineComp); add(new JLabel(" + ")); add(relativeComp); }
From source file:fi.smaa.jsmaa.gui.presentation.OrdinalCriterionMeasurementsPM.java
License:Open Source License
public List<ValueModel> getNameModels() { List<ValueModel> l = new ArrayList<ValueModel>(); for (Alternative a : matrix.getAlternatives()) { l.add(new PresentationModel<Alternative>(a).getModel(Alternative.PROPERTY_NAME)); }//from ww w .jav a 2 s .c o m return l; }
From source file:fi.smaa.jsmaa.gui.views.AbstractPreferencesView.java
License:Open Source License
public JComponent buildPanel() { FormLayout layout = new FormLayout("right:pref, 7dlu, center:pref, 3dlu, center:pref", "p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder();//from w w w . j av a 2 s . c o m CellConstraints cc = new CellConstraints(); builder.addLabel("Criterion", cc.xy(1, 1)); builder.addLabel("Scale", cc.xy(3, 1)); builder.addLabel(getTypeName(), cc.xy(5, 1)); int row = 3; int i = 0; JComponent firstComp = null; for (Criterion c : prefs.getCriteria()) { row += 2; LayoutUtil.addRow(layout); JLabel label = new JLabel(); Bindings.bind(label, "text", new PresentationModel<Criterion>(c).getModel(Criterion.PROPERTY_NAME)); builder.add(label, cc.xy(1, row)); builder.add(scaleRenderer.getScaleComponent(c), cc.xy(3, row)); JComponent measurementComp = getPreferenceComponent(c, i); builder.add(measurementComp, cc.xy(5, row)); if (firstComp == null) { firstComp = measurementComp; } i++; } JPanel panel = builder.getPanel(); if (firstComp != null) { panel.addFocusListener(new FocusTransferrer(firstComp)); } return panel; }
From source file:fi.smaa.jsmaa.gui.views.AlternativeInfoView.java
License:Open Source License
public JComponent buildPanel() { FormLayout layout = new FormLayout("fill:pref:grow", "p"); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(BorderFactory.createEmptyBorder()); CellConstraints cc = new CellConstraints(); int row = 1;//w ww .j a v a 2 s. c o m for (Alternative a : alts) { if (row > 1) { LayoutUtil.addRow(layout); } builder.add( BasicComponentFactory .createLabel(new PresentationModel<Alternative>(a).getModel(Alternative.PROPERTY_NAME)), cc.xy(1, row)); row += 2; } return builder.getPanel(); }
From source file:fi.smaa.jsmaa.gui.views.AlternativeView.java
License:Open Source License
public JComponent buildPanel() { FormLayout layout = new FormLayout("pref, 3dlu, left:pref:grow", "p, 3dlu, p, 3dlu, p"); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(BorderFactory.createEmptyBorder()); CellConstraints cc = new CellConstraints(); int fullwidth = 3; builder.addLabel("Name:", cc.xy(1, 1)); builder.add(BasicComponentFactory.createLabel( new PresentationModel<Alternative>(alt).getModel(Alternative.PROPERTY_NAME)), cc.xy(3, 1)); builder.addSeparator("Measurements", cc.xyw(1, 3, fullwidth)); if (impactMatrix instanceof IndependentMeasurements) { builder.add(buildMeasurementsPart(), cc.xyw(1, 5, fullwidth)); } else {/* ww w . j a v a 2 s. c o m*/ builder.add(new JLabel("Measurements are not independent.")); } return builder.getPanel(); }
From source file:fi.smaa.jsmaa.gui.views.AlternativeView.java
License:Open Source License
private JComponent buildMeasurementsPart() { FormLayout layout = new FormLayout("pref, 3dlu, left:pref:grow", "p"); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(BorderFactory.createEmptyBorder()); CellConstraints cc = new CellConstraints(); builder.addLabel("Criterion", cc.xy(1, 1)); builder.addLabel("Measurement", cc.xy(3, 1)); IndependentMeasurements measurements = (IndependentMeasurements) impactMatrix; ImpactMatrixPresentationModel model = new ImpactMatrixPresentationModel(measurements); for (int i = 0; i < measurements.getCriteria().size(); i++) { LayoutUtil.addRow(layout);//from w ww .j av a 2 s .c om int row = 1 + (i + 1) * 2; Criterion c = measurements.getCriteria().get(i); builder.add(BasicComponentFactory.createLabel( new PresentationModel<Criterion>(c).getModel(Criterion.PROPERTY_NAME)), cc.xy(1, row)); if (c instanceof OrdinalCriterion) { builder.addLabel("Ordinal criterion, set measurements in the criterion view", cc.xy(3, row)); } else { builder.add(new MeasurementPanel(model.getMeasurementHolder(alt, c)), cc.xy(3, row)); } } return builder.getPanel(); }
From source file:fi.smaa.jsmaa.gui.views.CardinalCriterionMeasurementsView.java
License:Open Source License
public JComponent buildPanel() { FormLayout layout = new FormLayout("right:pref, 3dlu, left:pref", "p"); PanelBuilder builder = new PanelBuilder(layout); builder.setBorder(BorderFactory.createEmptyBorder()); CellConstraints cc = new CellConstraints(); for (int i = 0; i < model.getAlternatives().size(); i++) { Alternative a = model.getAlternatives().get(i); int row = 1 + (i * 2); if (i != 0) { LayoutUtil.addRow(layout);//from ww w .jav a 2 s. c om } builder.add( BasicComponentFactory .createLabel(new PresentationModel<Alternative>(a).getModel(Alternative.PROPERTY_NAME)), cc.xy(1, row)); JComponent comp = null; if (criterion instanceof CardinalCriterion) { comp = new MeasurementPanel(model.getMeasurementHolder(a, criterion)); } else if (criterion instanceof OrdinalCriterion) { } builder.add(comp, cc.xy(3, row)); } return builder.getPanel(); }
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 . j a va 2 s . c om*/ 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(); }