/** * Performs the action field action if the action field is not synchronized. */ private void performActionIfNeeded() { if (!getConnectedULCComponent().isSynchronized()) { if (StringUtils.isEmpty(getConnectedULCComponent().getActionText())) { getConnectedULCComponent().setValue(null); } else { getConnectedULCComponent().performAction(0); } } } }
/** * {@inheritDoc} */ public void copyAttributes(ICellComponent source) { sourceActionField = (ULCActionField) source; setActions(sourceActionField.actions); showTextField = sourceActionField.showTextField; }
/** * Decorates the component with a marker. * * @param decorated * if the component should be decorated. */ public void setDecorated(boolean decorated) { if (this.decorated != decorated) { this.decorated = decorated; Anything decoratedAnything = new Anything(); decoratedToAnything(decoratedAnything); sendUI(ActionFieldConstants.SET_DECORATED_REQUEST, decoratedAnything); } }
private void updateValue(Object aValue, boolean notifyClient) { if (!ObjectUtils.equals(this.value, aValue)) { Object oldValue = this.value; this.value = aValue; firePropertyChange("value", oldValue, aValue); } if (sourceActionField != null) { sourceActionField.updateValue(aValue, notifyClient); } updateActionText(valueToString(), notifyClient); }
private void updateValue(String aValue, boolean notifyClient) { if (!ObjectUtils.equals(this.value, aValue)) { Object oldValue = this.value; this.value = aValue; firePropertyChange("value", oldValue, aValue); } if (sourceActionField != null) { sourceActionField.updateValue(aValue, notifyClient); } updateActionText(value, notifyClient); } }
/** * Sets the editable. * * @param editable * the editable to set. */ public void setEditable(boolean editable) { if (this.editable != editable) { this.editable = editable; Anything editableAnything = new Anything(); editableToAnything(editableAnything); sendUI(ActionFieldConstants.SET_EDITABLE_REQUEST, editableAnything); } }
/** * {@inheritDoc} */ @Override public void handleRequest(String request, Anything args) { if (request.equals(ActionFieldConstants.SET_ACTION_TEXT_REQUEST)) { handleSetActionText(args); } else if (request.equals(ActionFieldConstants.TRIGGER_ACTION_REQUEST)) { handleTriggerAction(args); } else if (request.equals(ActionFieldConstants.SET_EDITING_CELL_REQUEST)) { handleSetEditingCell(args); } else if (request.equals(ActionFieldConstants.SYNC_STATE_REQUEST)) { handleSyncState(args); } else { super.handleRequest(request, args); } }
private void updateActionText(String text, boolean notifyClient) { if (!ObjectUtils.equals(this.actionText, text)) { String oldActionText = this.actionText; this.actionText = text; if (notifyClient) { Anything actionTextAnything = new Anything(); actionTextAnything.put(ActionFieldConstants.ACTION_TEXT_KEY, text); sendUI(ActionFieldConstants.SET_ACTION_TEXT_REQUEST, actionTextAnything); } firePropertyChange("actionText", oldActionText, text); } if (sourceActionField != null) { sourceActionField.updateActionText(text, notifyClient); } }
/** * performs the registered action programatically. * * @param index * the index of the action to be triggerred. */ public void performAction(int index) { performAction(index, actionText); }
/** * {@inheritDoc} */ @Override protected void saveState(Anything a) { super.saveState(a); a.put(ActionFieldConstants.SHOW_TEXTFIELD_KEY, showTextField); a.put(ActionFieldConstants.ACTION_TEXT_KEY, actionText); Anything actionIconsAnything = new Anything(); Anything actionsAnything = new Anything(); fillActionData(actionsAnything, actionIconsAnything); a.put(ActionFieldConstants.ICONS_KEY, actionIconsAnything); a.put(ActionFieldConstants.ACTIONS_KEY, actionsAnything); editableToAnything(a); }
/** * Sets the action. * * @param actions * the actions to set. */ public void setActions(List<IAction> actions) { if (!ObjectUtils.equals(this.actions, actions)) { this.actions = actions; Anything actionsAnything = new Anything(); Anything actionIconsAnything = new Anything(); fillActionData(actionsAnything, actionIconsAnything); Anything args = new Anything(); args.put(ActionFieldConstants.ACTIONS_KEY, actionsAnything); args.put(ActionFieldConstants.ICONS_KEY, actionIconsAnything); sendUI(ActionFieldConstants.SET_ACTIONS_REQUEST, args); } }
if (editorView.getPeer() instanceof ULCActionField) { ULCActionField actionField = (ULCActionField) editorView.getPeer(); actionField.setActions(Collections.singletonList(actionField .getActions().get(0)));
private void fillActionData(Anything actionsAnything, Anything iconsAnything) { if (actions != null) { for (IAction action : actions) { actionsAnything.append(actionToAnything(action)); ULCIcon icon = (ULCIcon) action.getValue(IAction.SMALL_ICON); icon.upload(); iconsAnything.append(icon.getRef()); } } }
/** * {@inheritDoc} */ @Override public void handleRequest(String request, Anything args) { if (request.equals(ActionFieldConstants.SET_ACTION_TEXT_REQUEST)) { handleSetActionText(args); } else if (request.equals(ActionFieldConstants.TRIGGER_ACTION_REQUEST)) { handleTriggerAction(args); } else if (request.equals(ActionFieldConstants.SET_EDITING_CELL_REQUEST)) { handleSetEditingCell(args); } else if (request.equals(ActionFieldConstants.SYNC_STATE_REQUEST)) { handleSyncState(args); } else { super.handleRequest(request, args); } }
private void updateActionText(String text, boolean notifyClient) { if (!ObjectUtils.equals(this.actionText, text)) { String oldActionText = this.actionText; this.actionText = text; if (notifyClient) { Anything actionTextAnything = new Anything(); actionTextAnything.put(ActionFieldConstants.ACTION_TEXT_KEY, text); sendUI(ActionFieldConstants.SET_ACTION_TEXT_REQUEST, actionTextAnything); } firePropertyChange("actionText", oldActionText, text); } if (sourceActionField != null) { sourceActionField.updateActionText(text, notifyClient); } }
/** * performs the registered action programatically. * * @param index * the index of the action to be triggerred. */ public void performAction(int index) { performAction(index, actionText); }
/** * Sets the editable. * * @param editable * the editable to set. */ public void setEditable(boolean editable) { if (this.editable != editable) { this.editable = editable; Anything editableAnything = new Anything(); editableToAnything(editableAnything); sendUI(ActionFieldConstants.SET_EDITABLE_REQUEST, editableAnything); } }
/** * {@inheritDoc} */ @Override protected void saveState(Anything a) { super.saveState(a); a.put(ActionFieldConstants.SHOW_TEXTFIELD_KEY, showTextField); a.put(ActionFieldConstants.ACTION_TEXT_KEY, actionText); Anything actionIconsAnything = new Anything(); Anything actionsAnything = new Anything(); fillActionData(actionsAnything, actionIconsAnything); a.put(ActionFieldConstants.ICONS_KEY, actionIconsAnything); a.put(ActionFieldConstants.ACTIONS_KEY, actionsAnything); editableToAnything(a); }
/** * Sets the action. * * @param actions * the actions to set. */ public void setActions(List<IAction> actions) { if (!ObjectUtils.equals(this.actions, actions)) { this.actions = actions; Anything actionsAnything = new Anything(); Anything actionIconsAnything = new Anything(); fillActionData(actionsAnything, actionIconsAnything); Anything args = new Anything(); args.put(ActionFieldConstants.ACTIONS_KEY, actionsAnything); args.put(ActionFieldConstants.ICONS_KEY, actionIconsAnything); sendUI(ActionFieldConstants.SET_ACTIONS_REQUEST, args); } }
private void fillActionData(Anything actionsAnything, Anything iconsAnything) { if (actions != null) { for (IAction action : actions) { actionsAnything.append(actionToAnything(action)); ULCIcon icon = (ULCIcon) action.getValue(IAction.SMALL_ICON); icon.upload(); iconsAnything.append(icon.getRef()); } } }