public void testLabelEditor() { final ParamProperties properties = new ParamProperties(String.class); properties.setLabel(LABEL_NAME); properties.setPhysicalUnit(UNIT_NAME); properties.setDefaultValue("was"); properties.setEditorClass(LabelEditor.class); final Parameter parameter = new Parameter(PARAM_NAME, properties); ParamEditor editor = parameter.getEditor(); assertTrue(editor instanceof LabelEditor); final LabelEditor labelEditor = (LabelEditor) editor; final JComponent editorComponent = labelEditor.getEditorComponent(); assertEquals(JLabel.class.getName(), editorComponent.getClass().getName()); assertEquals("theParamName.Editor", editorComponent.getName()); assertNull(labelEditor.getLabelComponent()); assertNull(labelEditor.getPhysUnitLabelComponent()); }
@Override protected void initUI() { _label = new JLabel(); nameEditorComponent(_label); _label.setText(getParameter().getValueAsText()); if (getParameter().getProperties().getDescription() != null) { _label.setToolTipText(getParameter().getProperties().getDescription()); } }
/** * Gets the UI component used to edit the parameter's value. */ public JComponent getEditorComponent() { return getLabel(); }