/** * {@inheritDoc} */ @Override public JReferenceFieldConnector clone(String newConnectorId) { JReferenceFieldConnector clonedConnector = (JReferenceFieldConnector) super .clone(newConnectorId); if (renderingConnector != null) { clonedConnector.renderingConnector = renderingConnector.clone(); } return clonedConnector; }
/** * Performs the action field action if the action field is not synchronized. */ public void performActionIfNeeded() { if (!getConnectedJComponent().isSynchronized()) { if (StringUtils.isEmpty(getConnectedJComponent().getActionText())) { setConnectorValue(null); } else { getConnectedJComponent().performAction(); } } }
/** * {@inheritDoc} */ @Override protected void protectedWritabilityChange() { super.protectedWritabilityChange(); getConnectedJComponent().setEnabled(isWritable()); } }
/** * {@inheritDoc} */ @Override protected void protectedSetConnecteeValue(Object aValue) { value = aValue; getConnectedJComponent().setValue(getActionText()); }
/** * Constructs a new <code>JActionFieldConnector</code> instance. * * @param id * the id of the connector. * @param actionField * the connected JActionField. */ public JActionFieldConnector(String id, JActionField actionField) { super(id, actionField); if (!getConnectedJComponent().isShowingTextField()) { addConnectorValueChangeListener(new IConnectorValueChangeListener() { public void connectorValueChange(ConnectorValueChangeEvent evt) { if (evt.getNewValue() instanceof byte[]) { getConnectedJComponent().setDecorated( ((byte[]) evt.getNewValue()).length > 0); } else { getConnectedJComponent().setDecorated(evt.getNewValue() != null); } } }); } }
/** * {@inheritDoc} */ @Override protected IView<JComponent> createBinaryPropertyView(IPropertyViewDescriptor propertyViewDescriptor, IActionHandler actionHandler, Locale locale) { IBinaryPropertyDescriptor propertyDescriptor = (IBinaryPropertyDescriptor) propertyViewDescriptor .getModelDescriptor(); JActionField viewComponent = createJActionField(propertyViewDescriptor, false); JActionFieldConnector connector = new JActionFieldConnector(propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); IView<JComponent> propertyView = constructView(viewComponent, propertyViewDescriptor, connector); viewComponent.setActions(createBinaryActions(propertyView, actionHandler, locale)); adjustSizes(propertyViewDescriptor, viewComponent, null, null); return propertyView; }
/** * {@inheritDoc} */ @Override protected void protectedSetConnecteeValue(Object aValue) { getConnectedJComponent().setValue(aValue); }
/** * {@inheritDoc} */ @Override public void focusLost(FocusEvent e) { if (!e.isTemporary()) { performActionIfNeeded(); } } });
/** * Constructs a new {@code JActionFieldConnector} instance. * * @param id * the id of the connector. * @param actionField * the connected JActionField. */ public JActionFieldConnector(String id, JActionField actionField) { super(id, actionField); if (!getConnectedJComponent().isShowingTextField()) { addValueChangeListener(new IValueChangeListener() { @Override public void valueChange(ValueChangeEvent evt) { if (evt.getNewValue() instanceof byte[]) { getConnectedJComponent().setDecorated( ((byte[]) evt.getNewValue()).length > 0); } else { getConnectedJComponent().setDecorated(evt.getNewValue() != null); } } }); } }
/** * {@inheritDoc} */ @Override protected String getActionText() { if (renderingConnector != null) { if (renderingConnector.getConnectorValue() == null) { return ""; } return renderingConnector.getConnectorValue().toString(); } return super.getActionText(); }
private IView<JComponent> createBinaryPropertyView( IBinaryPropertyDescriptor propertyDescriptor, IActionHandler actionHandler, Locale locale) { JActionField viewComponent = createJActionField(false); JActionFieldConnector connector = new JActionFieldConnector( propertyDescriptor.getName(), viewComponent); connector.setExceptionHandler(actionHandler); Action openAction = actionFactory.createAction( openFileAsBinaryPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action saveAction = actionFactory.createAction( saveBinaryPropertyAsFileAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action resetAction = actionFactory.createAction(resetPropertyAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); Action infoAction = actionFactory.createAction(binaryPropertyInfoAction, actionHandler, viewComponent, propertyDescriptor, connector, locale); viewComponent.setActions(Arrays.asList(new Action[] {openAction, saveAction, resetAction, infoAction})); adjustSizes(viewComponent, null, null); return constructView(viewComponent, null, connector); }
/** * {@inheritDoc} */ @Override protected Object getConnecteeValue() { return getConnectedJComponent().getValue(); }
/** * {@inheritDoc} */ @Override public void focusLost(FocusEvent e) { if (!e.isTemporary()) { performActionIfNeeded(); } } });
/** * Performs the action field action if the action field is not synchronized. */ public void performActionIfNeeded() { if (!getConnectedJComponent().isSynchronized()) { if (StringUtils.isEmpty(getConnectedJComponent().getActionText())) { setConnectorValue(null); } else { getConnectedJComponent().performAction(); } } }
/** * {@inheritDoc} */ @Override protected void protectedUpdateState() { super.protectedUpdateState(); getConnectedJComponent().setEditable(isWritable()); } }
/** * {@inheritDoc} */ @Override protected void bindJComponent() { getConnectedJComponent().addTextFieldFocusListener(new FocusAdapter() { /** * {@inheritDoc} */ @Override public void focusLost(FocusEvent e) { if (!e.isTemporary()) { performActionIfNeeded(); } } }); }
@Override public boolean stopCellEditing() { if (((JActionField) getEditorView().getPeer()).isSynchronized()) { fireEditingStopped(); return true; } ((JActionFieldConnector) getEditorView().getConnector()).performActionIfNeeded(); return false; } };
/** * {@inheritDoc} */ @Override public JReferenceFieldConnector clone(String newConnectorId) { JReferenceFieldConnector clonedConnector = (JReferenceFieldConnector) super .clone(newConnectorId); if (toStringPropertyConnector != null) { clonedConnector.toStringPropertyConnector = toStringPropertyConnector .clone(); } return clonedConnector; }
/** * {@inheritDoc} */ @Override protected void bindJComponent() { getConnectedJComponent().addTextFieldFocusListener(new FocusAdapter() { /** * {@inheritDoc} */ @Override public void focusLost(FocusEvent e) { if (!e.isTemporary()) { performActionIfNeeded(); } } }); }
@Override public boolean stopCellEditing() { if (((JActionField) getEditorView().getPeer()).isSynchronized()) { fireEditingStopped(); return true; } ((JActionFieldConnector) getEditorView().getConnector()) .performActionIfNeeded(); return false; } };