List of usage examples for com.jgoodies.binding PresentationModel PresentationModel
public PresentationModel(ValueModel beanChannel)
From source file:org.drugis.addis.gui.ConvergenceSummaryDialog.java
License:Open Source License
private JPanel buildMCMCSettingsPanel() { final FormLayout layout = new FormLayout("pref, 7dlu, fill:0:grow", "pref"); int rows = 1; final PanelBuilder builder = new PanelBuilder(layout, new JPanel()); builder.setDefaultDialogBorder();/*from ww w.jav a2s .co m*/ CellConstraints cc = new CellConstraints(); PresentationModel<MCMCSettings> pm = new PresentationModel<MCMCSettings>(d_settings); rows = buildSettingsRow(layout, rows, builder, cc, "Number of chains", pm.getModel(MCMCSettings.PROPERTY_NUMBER_OF_CHAINS)); rows = buildSettingsRow(layout, rows, builder, cc, "Tuning iterations", pm.getModel(MCMCSettings.PROPERTY_TUNING_ITERATIONS)); rows = buildSettingsRow(layout, rows, builder, cc, "Simulation iterations", pm.getModel(MCMCSettings.PROPERTY_SIMULATION_ITERATIONS)); rows = buildSettingsRow(layout, rows, builder, cc, "Thinning interval", pm.getModel(MCMCSettings.PROPERTY_THINNING_INTERVAL)); rows = buildSettingsRow(layout, rows, builder, cc, "Inference samples", pm.getModel(MCMCSettings.PROPERTY_INFERENCE_SAMPLES)); rows = buildSettingsRow(layout, rows, builder, cc, "Variance scaling factor", pm.getModel(MCMCSettings.PROPERTY_VARIANCE_SCALING_FACTOR)); return builder.getPanel(); }
From source file:org.drugis.addis.gui.MeasurementInputHelper.java
License:Open Source License
public static JTextField[] getComponents(MissingMeasurementPresentation mmp) { DoubleFormatter doubleFormatter = new DoubleFormatter(); IntegerFormatter intFormatter = new IntegerFormatter(); BasicMeasurement m = mmp.getMeasurement(); if (m instanceof BasicContinuousMeasurement) { PresentationModel<BasicContinuousMeasurement> model = new PresentationModel<BasicContinuousMeasurement>( (BasicContinuousMeasurement) m); return new JTextField[] { MeasurementInputHelper.buildFormatted(model.getModel(BasicContinuousMeasurement.PROPERTY_MEAN), mmp.getMissingModel(), doubleFormatter), MeasurementInputHelper.buildFormatted( model.getModel(BasicContinuousMeasurement.PROPERTY_STDDEV), mmp.getMissingModel(), doubleFormatter), MeasurementInputHelper.buildFormatted( model.getModel(BasicContinuousMeasurement.PROPERTY_SAMPLESIZE), mmp.getMissingModel(), intFormatter) }; } else if (m instanceof BasicRateMeasurement) { PresentationModel<BasicRateMeasurement> model = new PresentationModel<BasicRateMeasurement>( (BasicRateMeasurement) m); return new JTextField[] { MeasurementInputHelper.buildFormatted(model.getModel(BasicRateMeasurement.PROPERTY_RATE), mmp.getMissingModel(), intFormatter), MeasurementInputHelper.buildFormatted(model.getModel(BasicRateMeasurement.PROPERTY_SAMPLESIZE), mmp.getMissingModel(), intFormatter) }; } else if (m instanceof FrequencyMeasurement) { List<JTextField> comps = new ArrayList<JTextField>(); FrequencyMeasurement fm = (FrequencyMeasurement) m; FrequencyMeasurementPresentation model = new FrequencyMeasurementPresentation(fm); for (String cat : fm.getCategories()) { comps.add(MeasurementInputHelper.buildFormatted(model.getFrequencyModel(cat), mmp.getMissingModel(), intFormatter));/*from w w w . j a va2 s.c o m*/ } return comps.toArray(new JTextField[] {}); } throw new IllegalStateException("Unhandled Measurement sub-type"); }
From source file:org.drugis.addis.gui.wizard.AddListItemsWizardStep.java
License:Open Source License
private ValueModel getNameModel(final int idx) { return new PresentationModel<TypeWithName>(d_pm.getList().get(idx)).getModel(TypeWithName.PROPERTY_NAME); }
From source file:org.drugis.addis.presentation.AbstractBenefitRiskPresentation.java
License:Open Source License
public static List<DecisionContextField> createDecisionContextFields(DecisionContext decisionContext) { PresentationModel<DecisionContext> dcModel = new PresentationModel<DecisionContext>(decisionContext); List<DecisionContextField> asList = Arrays.asList( new AbstractBenefitRiskPresentation.DecisionContextField(DC_THERAPEUTIC_CONTEXT_NAME, DC_THERAPEUTIC_CONTEXT_HELP, dcModel.getModel(DecisionContext.PROPERTY_THERAPEUTIC_CONTEXT)), new AbstractBenefitRiskPresentation.DecisionContextField(DC_COMPARATOR_NAME, DC_COMPARATOR_HELP, dcModel.getModel(DecisionContext.PROPERTY_COMPARATOR)), new AbstractBenefitRiskPresentation.DecisionContextField(DC_TIME_HORIZON_NAME, DC_TIME_HORIZON_HELP, dcModel.getModel(DecisionContext.PROPERTY_TIME_HORIZON)), new AbstractBenefitRiskPresentation.DecisionContextField(DC_STAKEHOLDER_PERSPECTIVE_NAME, DC_STAKEHOLDER_PERSPECTIVE_HELP, dcModel.getModel(DecisionContext.PROPERTY_STAKEHOLDER_PERSPECTIVE))); return asList; }
From source file:org.drugis.addis.presentation.PresentationModelFactory.java
License:Open Source License
@SuppressWarnings({ "unchecked", "rawtypes" }) private PresentationModel createModel(final Object obj) { if (obj instanceof Variable) { return new VariablePresentation((Variable) obj, d_domain.getStudies((Variable) obj), this); }/*w ww. ja v a 2s . c o m*/ if (obj instanceof Unit) { return new UnitPresentation((Unit) obj); } if (obj instanceof Study) { return new StudyPresentation((Study) obj, this); } if (obj instanceof Indication) { return new IndicationPresentation((Indication) obj, d_domain.getStudies()); } if (obj instanceof RelativeEffect) { return new RelativeEffectPresentation((RelativeEffect) obj); } if (obj instanceof RateMeasurement) { return new RateMeasurementPresentation((RateMeasurement) obj); } if (obj instanceof ContinuousMeasurement) { return new ContinuousMeasurementPresentation((ContinuousMeasurement) obj); } if (obj instanceof FrequencyMeasurement) { return new FrequencyMeasurementPresentation((FrequencyMeasurement) obj); } if (obj instanceof Arm) { return new BasicArmPresentation((Arm) obj, this); } if (obj instanceof DrugTreatment) { return new DrugTreatmentPresentation((DrugTreatment) obj); } if (obj instanceof TreatmentCategorization) { return new TreatmentCategorizationPresentation((TreatmentCategorization) obj, d_domain); } if (obj instanceof Drug) { return new DrugPresentation((Drug) obj, d_domain); } if (obj instanceof TreatmentDefinition) { return new TreatmentDefinitionPresentation((TreatmentDefinition) obj, d_domain); } if (obj instanceof RandomEffectsMetaAnalysis) { return new PairWiseMetaAnalysisPresentation((RandomEffectsMetaAnalysis) obj, this); } if (obj instanceof NetworkMetaAnalysis) { return new NetworkMetaAnalysisPresentation((NetworkMetaAnalysis) obj, this); } if (obj instanceof MetaBenefitRiskAnalysis) { return new MetaBenefitRiskPresentation((MetaBenefitRiskAnalysis) obj, this); } if (obj instanceof StudyBenefitRiskAnalysis) { return new StudyBenefitRiskPresentation((StudyBenefitRiskAnalysis) obj, this); } if (obj instanceof Distribution) { return new DistributionPresentation((Distribution) obj); } return new PresentationModel(obj); }
From source file:org.drugis.addis.presentation.PropertyListHolder.java
License:Open Source License
@SuppressWarnings({ "unchecked", "rawtypes" }) public PropertyListHolder(Object bean, String propertyName, Class<E> objType) { PresentationModel pm = new PresentationModel(bean); d_vm = pm.getModel(propertyName);//w w w. j a v a2 s . co m if (d_vm.getValue() instanceof ObservableList<?>) { ((ObservableList<?>) d_vm.getValue()).addListDataListener(new ListDataListener() { @Override public void intervalRemoved(ListDataEvent e) { fireValueChange(null, getValue()); } @Override public void intervalAdded(ListDataEvent e) { fireValueChange(null, getValue()); } @Override public void contentsChanged(ListDataEvent e) { fireValueChange(null, getValue()); } }); } else { d_vm.addValueChangeListener(this); } }
From source file:org.drugis.addis.presentation.VariablePresentation.java
License:Open Source License
public PresentationModel<ContinuousVariableType> getContinuousModel() { return new PresentationModel<ContinuousVariableType>(d_continuousVariableType); }
From source file:org.drugis.addis.presentation.VariablePresentation.java
License:Open Source License
public PresentationModel<CategoricalVariableType> getCategoricalModel() { return new PresentationModel<CategoricalVariableType>(d_categoricalVariableType); }
From source file:org.drugis.addis.presentation.VariablePresentation.java
License:Open Source License
public PresentationModel<RateVariableType> getRateModel() { return new PresentationModel<RateVariableType>(d_rateVariableType); }
From source file:org.gitools.ui.app.actions.help.GitoolsCommunicationSection.java
License:Open Source License
public GitoolsCommunicationSection(Settings settings) { PresentationModel<Settings> model = new PresentationModel<>(settings); bind(proxyEnabled, model.getModel(Settings.PROPERTY_PROXY_ENABLED)); bind(proxyPort, createStringConverter(model.getModel(Settings.PROPERTY_PROXY_PORT), IntegerFormat.get())); bind(proxyHost, model.getModel(Settings.PROPERTY_PROXY_HOST)); bind(portBox, model.getModel(Settings.PROPERTY_PORT_ENABLED)); bind(port, createStringConverter(model.getModel(Settings.PROPERTY_PORT), IntegerFormat.get())); bind(IGVBox, model.getModel(Settings.PROPERTY_IGV_ENABLED)); bind(IGVUrl, model.getModel(Settings.PROPERTY_IGV_URL)); }