/** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent e) { fireConnectorValueChange(); } });
/** * {@inheritDoc} */ @Override protected JPasswordField getConnectedJComponent() { return (JPasswordField) super.getConnectedJComponent(); }
private IView<JComponent> createStringPropertyView( IStringPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { if (propertyDescriptor instanceof IPasswordPropertyDescriptor) { return createPasswordPropertyView( (IPasswordPropertyDescriptor) propertyDescriptor, actionHandler, locale); } else if (propertyDescriptor instanceof ISourceCodePropertyDescriptor) { return createSourceCodePropertyView( (ISourceCodePropertyDescriptor) propertyDescriptor, actionHandler, locale); } else if (propertyDescriptor instanceof ITextPropertyDescriptor) { return createTextPropertyView( (ITextPropertyDescriptor) propertyDescriptor, actionHandler, locale); } JTextField viewComponent = createJTextField(); JTextFieldConnector connector = new JTextFieldConnector(propertyDescriptor .getName(), viewComponent); connector.setExceptionHandler(actionHandler); adjustSizes(viewComponent, null, getStringTemplateValue(propertyDescriptor)); return constructView(viewComponent, null, connector); }
/** * Sets the value to the connector text after formatting the string * representation. * <p> * {@inheritDoc} */ @Override protected void protectedSetConnecteeValue(Object aValue) { if (aValue == null || formatter == null) { super.protectedSetConnecteeValue(aValue); } else { getConnectedJComponent().setText(formatter.format(aValue)); } } }
/** * Gets the value out of the connector text after parsing the string * representation. * <p> * {@inheritDoc} */ @Override protected Object getConnecteeValue() { if (StringUtils.isEmpty(getConnectedJComponent().getText())) { return null; } if (formatter != null) { try { Object value = formatter .parse(getTextForParser(getConnectedJComponent().getText())); getConnectedJComponent().setText(formatter.format(value)); return value; } catch (ParseException ex) { setConnecteeValue(null); return null; } } return super.getConnecteeValue(); }
} else { viewComponent = createJTextField(propertyViewDescriptor); connector = new JTextFieldConnector(propertyDescriptor.getName(), (JTextField) viewComponent);
/** * Sets the value to the connector text after formatting the string * representation. * <p> * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected void protectedSetConnecteeValue(Object aValue) { if (aValue == null || formatter == null) { super.protectedSetConnecteeValue(aValue); } else { getConnectedJComponent().setText( ((IFormatter<Object, String>) formatter).format(aValue)); } } }
/** * Gets the value out of the connector text after parsing the string * representation. * <p> * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected Object protectedGetConnecteeValue() { if (StringUtils.isEmpty(getConnectedJComponent().getText())) { return null; } if (formatter != null) { try { Object value = formatter .parse(getTextForParser(getConnectedJComponent().getText())); getConnectedJComponent().setText( ((IFormatter<Object, String>) formatter).format(value)); return value; } catch (ParseException ex) { setConnecteeValue(null); return null; } } return super.getConnecteeValue(); }
/** * {@inheritDoc} */ @Override protected JPasswordField getConnectedJComponent() { return (JPasswordField) super.getConnectedJComponent(); }
/** * {@inheritDoc} */ public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { fireConnectorValueChange(); } });
/** * {@inheritDoc} */ @Override protected void bindJComponent() { super.bindJComponent(); getConnectedJComponent().addActionListener(new ActionListener() { /** * {@inheritDoc} */ @Override public void actionPerformed(ActionEvent e) { fireConnectorValueChange(); } }); } }
/** * {@inheritDoc} */ @Override protected void bindJComponent() { super.bindJComponent(); getConnectedJComponent().addActionListener(new ActionListener() { /** * {@inheritDoc} */ public void actionPerformed(@SuppressWarnings("unused") ActionEvent e) { fireConnectorValueChange(); } }); } }