/** * {@inheritDoc} */ @Override public IFormattedValueConnector createFormattedValueConnector(String id, IFormatter<?, ?> formatter) { return new BasicFormattedValueConnector(id, formatter); }
/** * Gets the connector value as a string representation. * * @return the connector value as a string representation. */ @Override public Object getFormattedValue() { Object formattedValue = getFormatter().format(getConnectorValue()); return formattedValue; }
/** * Sets the connector value using the formatted value representation. * * @param formattedValue * the formatted value, generally the string representation string * representation. */ @Override public void setFormattedValue(Object formattedValue) { try { Object parsedValue = getFormatter().parse(formattedValue); setConnectorValue(parsedValue); } catch (ParseException ex) { // To force resetting the view fireValueChange(new ValueChangeEvent(this, IPropertyChangeCapable.UNKNOWN, getConnecteeValue())); Object[] i18nParams = { formattedValue }; handleException(new ParsingException(formattedValue + " cannot be parsed.", "error.parsing", i18nParams)); } }
/** * {@inheritDoc} */ @Override public RemoteFormattedValueConnector clone(String newConnectorId) { RemoteFormattedValueConnector clonedConnector = (RemoteFormattedValueConnector) super .clone(newConnectorId); clonedConnector.guid = connectorFactory.generateGUID(); clonedConnector.state = null; connectorFactory.attachListeners(clonedConnector); connectorFactory.register(clonedConnector); return clonedConnector; }
/** * {@inheritDoc} */ @Override public boolean isWritable() { return (getModelConnector() != null) && super.isWritable(); }