List of usage examples for com.jgoodies.binding.adapter BasicComponentFactory createLabel
public static JLabel createLabel(ValueModel valueModel, Format format)
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()); }/* w w w .j a va 2s.c o m*/ return new JLabel("NA"); }
From source file:org.drugis.addis.gui.AuxComponentFactory.java
License:Open Source License
public static JComponent createCharacteristicView(StudyCharacteristicHolder model) { JComponent component = null;//from w ww .ja v a 2s.c o m Class<?> valueType = model.getCharacteristic().getValueType(); if (model.getValue() == null) { return new JLabel("UNKNOWN"); } if (valueType.equals(String.class)) { component = createTextArea(model, false); } else if (valueType.equals(Date.class)) { component = BasicComponentFactory.createLabel(model, new DayDateFormat()); } else if (valueType.equals(PubMedIdList.class)) { component = new JPanel(); component.setLayout(new BoxLayout(component, BoxLayout.Y_AXIS)); for (PubMedId pmid : (PubMedIdList) model.getValue()) { component.add(new LinkLabel(pmid.getId(), "http://www.ncbi.nlm.nih.gov/pubmed/" + pmid.getId())); } } else if (valueType.equals(Set.class)) { component = new ListPanel(model, "value", Entity.class); } else { component = BasicComponentFactory.createLabel(model, new OneWayObjectFormat()); } return component; }
From source file:org.drugis.addis.gui.builder.ClinicalScaleRenderer.java
License:Open Source License
public JComponent getScaleComponent(Criterion c) { if (c instanceof ScaleCriterion) { ScaleCriterion criterion = (ScaleCriterion) c; OutcomeMeasure outcome = d_smaapm.getOutcomeMeasureForCriterion(criterion); if (outcome.getVariableType() instanceof RateVariableType) { RiskScalePresentation cpm = new RiskScalePresentation(criterion); return buildRiskClinicalView(cpm); } else {/* w w w. j ava2 s.c om*/ PresentationModel<ScaleCriterion> cpm = new PresentationModel<ScaleCriterion>((ScaleCriterion) c); JLabel orLabel = new JLabel("RMD: "); JLabel scaleLabel = BasicComponentFactory.createLabel(cpm.getModel(ScaleCriterion.PROPERTY_SCALE), new fi.smaa.jsmaa.gui.IntervalFormat()); JPanel panel = new JPanel(new FlowLayout()); panel.add(orLabel); panel.add(scaleLabel); return panel; } } return new JLabel("NA"); }
From source file:org.drugis.addis.gui.builder.ClinicalScaleRenderer.java
License:Open Source License
private void addPropertyToPanel(PresentationModel<?> cpm, JPanel panel, String text, String property) { JLabel label = new JLabel(text); JLabel valueLabel = BasicComponentFactory.createLabel(cpm.getModel(property), new NumberAndIntervalFormat()); panel.add(label);/*from w ww.j a v a2s.c om*/ panel.add(valueLabel); }
From source file:org.drugis.addis.gui.builder.StudyArmsView.java
License:Open Source License
private int buildArm(FormLayout layout, PanelBuilder builder, CellConstraints cc, int row, Arm a) { BasicArmPresentation armModel = (BasicArmPresentation) d_pmf.getModel(a); row = LayoutUtil.addRow(layout, row); // non-treatment arm components JLabel sizeLabel = BasicComponentFactory.createLabel(armModel.getModel(Arm.PROPERTY_SIZE), NumberFormat.getInstance()); final JLabel armLabel = BasicComponentFactory.createLabel(d_pmf.getLabeledModel(a).getLabelModel()); JButton noteButton = new NoteViewButton(d_parent, "Arm: " + a.toString(), a.getNotes()); builder.add(noteButton, cc.xy(1, row)); builder.add(armLabel, cc.xy(3, row)); builder.add(sizeLabel, cc.xy(9, row)); Activity activity = d_model.getBean().getActivity(a); if (activity != null) { if (activity instanceof DrugTreatment) { DrugTreatment ta = (DrugTreatment) activity; DrugTreatmentPresentation activityModel = (DrugTreatmentPresentation) d_pmf.getModel(ta); addTreatmentActivity(activityModel, builder, cc, row); } else if (activity instanceof TreatmentActivity) { TreatmentActivity ct = (TreatmentActivity) activity; for (int i = 0; i < ct.getTreatments().getSize(); ++i) { if (i > 0) { row = LayoutUtil.addRow(layout, row); }/*from w w w. ja v a 2 s . c o m*/ DrugTreatment ta = ct.getTreatments().get(i); DrugTreatmentPresentation activityModel = (DrugTreatmentPresentation) d_pmf.getModel(ta); addTreatmentActivity(activityModel, builder, cc, row); } } } return row; }
From source file:org.drugis.addis.gui.builder.StudyArmsView.java
License:Open Source License
private void addTreatmentActivity(DrugTreatmentPresentation activityModel, PanelBuilder builder, CellConstraints cc, int row) { builder.add(BasicComponentFactory.createLabel(activityModel.getModel(DrugTreatment.PROPERTY_DRUG), new OneWayObjectFormat()), cc.xy(5, row)); builder.add(BasicComponentFactory.createLabel(activityModel.getModel(DrugTreatment.PROPERTY_DOSE), new OneWayObjectFormat()), cc.xy(7, row)); }
From source file:org.drugis.addis.gui.ConvergenceSummaryDialog.java
License:Open Source License
private int buildSettingsRow(final FormLayout layout, int rows, final PanelBuilder builder, CellConstraints cc, String label, ValueModel model) { rows = LayoutUtil.addRow(layout, rows); builder.add(new JLabel(label), cc.xy(1, rows)); builder.add(new JLabel(":"), cc.xy(2, rows)); builder.add(BasicComponentFactory.createLabel(model, new DecimalFormat()), cc.xy(3, rows)); return rows;//from www .ja va2 s . c o m }
From source file:org.drugis.addis.gui.StatusBar.java
License:Open Source License
private JPanel createCounter(String pre, String post, ValueModel threads) { JPanel panel = new JPanel(); panel.setOpaque(false);//from w w w .ja va2 s. c o m panel.add(new JLabel(pre)); panel.add(BasicComponentFactory.createLabel(threads, new OneWayObjectFormat())); panel.add(new JLabel(post)); return panel; }
From source file:org.drugis.addis.gui.wizard.DoseRangeCutOffDialog.java
License:Open Source License
protected JPanel buildPanel() { Bindings.bind(d_okButton, "enabled", d_validator); final FormLayout layout = new FormLayout("pref, 3dlu, pref, 3dlu, fill:pref:grow", "p"); final PanelBuilder builder = new PanelBuilder(layout); builder.setDefaultDialogBorder();/* w w w. ja v a 2 s. c om*/ final CellConstraints cc = new CellConstraints(); final int colSpan = builder.getColumnCount(); int row = 1; final String variableName = GUIHelper.humanize(d_choice.getPropertyName()); builder.addSeparator("Original range: " + RangeEdge.format(variableName, d_rangeToSplit), cc.xyw(1, row, colSpan)); row = LayoutUtil.addRow(layout, row); builder.addLabel("Split range at:", cc.xy(1, row)); final JFormattedTextField cutOffField = BasicComponentFactory.createFormattedTextField(d_cutOff, new DefaultFormatter()); cutOffField.setColumns(5); cutOffField.addCaretListener(new CaretListener() { @Override public void caretUpdate(final CaretEvent e) { try { cutOffField.commitEdit(); pack(); } catch (final ParseException exp) { return; // we don't care } } }); builder.add(cutOffField, cc.xy(3, row)); final String unitText = d_pm.getDoseUnitPresentation().getBean().toString(); builder.addLabel(unitText, cc.xy(5, row)); row = LayoutUtil.addRow(layout, row); builder.addLabel("Bound is inclusive/exclusive for lower range:", cc.xyw(1, row, colSpan)); row = LayoutUtil.addRow(layout, row); builder.add(BasicComponentFactory.createRadioButton(d_lowerOpen, false, ""), cc.xy(1, row)); builder.add(BasicComponentFactory.createLabel(d_cutOff, new FormatRange(variableName, false)), cc.xy(3, row)); row = LayoutUtil.addRow(layout, row); builder.add(BasicComponentFactory.createRadioButton(d_lowerOpen, true, ""), cc.xy(1, row)); builder.add(BasicComponentFactory.createLabel(d_cutOff, new FormatRange(variableName, true)), cc.xy(3, row)); return builder.getPanel(); }