public ActionArgumentValue(ActionArgument<S> argument, Object value) throws InvalidValueException { super(argument.getDatatype(), value != null && value.getClass().isEnum() ? value.toString() : value); this.argument = argument; }
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int columns) { ActionArgumentValuesTableModel model = (ActionArgumentValuesTableModel)table.getModel(); ActionArgumentValue argumentValue = model.getValues()[row]; ActionArgument argument = model.getValueAt(row); switch (argument.getDatatype().getBuiltin()) { case BOOLEAN: return new BooleanArgumentValueCellComponent(argumentValue, editable); default: String argumentStringValue = null; if (argumentValue != null && argumentValue.toString().length() == 0) { argumentStringValue = "<<NULL>>"; } else if (argumentValue != null && argumentValue.toString().length() > 0) { argumentStringValue = argumentValue.toString(); } else if (argumentValue == null) { argumentStringValue = "Click to edit..."; } return super.getTableCellRendererComponent( table, argumentStringValue, isSelected, hasFocus, row, columns ); } }
protected ActionArgumentValue[] createDefaultValuesInput(Action action) { ActionArgument[] arguments = action.getInputArguments(); ActionArgumentValue[] defaultValues = new ActionArgumentValue[arguments.length]; for (int i = 0; i < arguments.length; i++) { // Visually, a boolean is shown by the renderer as "off", so even without invoking the editor, we need // to set its value to "off" in the model. if (Datatype.Builtin.BOOLEAN.equals(arguments[i].getDatatype().getBuiltin())) { defaultValues[i] = new ActionArgumentValue(arguments[i], false); } else { defaultValues[i] = new ActionArgumentValue(arguments[i], ""); } } return defaultValues; }
protected TableCellEditor createArgumentValueCellEditor(ActionArgument argument, ActionArgumentValue currentValue) { if (argument.getDatatype().getBuiltin() != null) { switch (argument.getDatatype().getBuiltin()) { case UI1: case UI2:
public ActionArgumentValue(ActionArgument<S> argument, Object value) throws InvalidValueException { super(argument.getDatatype(), value != null && value.getClass().isEnum() ? value.toString() : value); this.argument = argument; }
setIcon(Application.createImageIcon(Workbench.class, "img/24/argument_out.png")); setToolTipText(nodeActionArgument.getRelatedStateVariableName() + ", " + nodeActionArgument.getDatatype().getDisplayString()); setText(nodeActionArgument.getName());
addIfNotNull(actionArgumentNode, "Datatype: ", actionArgument.getDatatype().getDisplayString());
public ActionArgumentValue(ActionArgument<S> argument, Object value) throws InvalidValueException { super(argument.getDatatype(), value != null && value.getClass().isEnum() ? value.toString() : value); this.argument = argument; }
private ActionArgumentValue<RemoteService>[] getArguments(final Action<RemoteService> action) { @SuppressWarnings("unchecked") final ActionArgument<RemoteService>[] actionArguments = action.getArguments(); final Map<String, Object> argumentValues = getArgumentValues(); final List<ActionArgumentValue<RemoteService>> actionArgumentValues = new ArrayList<>(actionArguments.length); for (final ActionArgument<RemoteService> actionArgument : actionArguments) { if (actionArgument.getDirection() == Direction.IN) { final Object value = argumentValues.get(actionArgument.getName()); logger.trace("Action {}: add arg value for {}: {} (expected datatype: {})", action.getName(), actionArgument, value, actionArgument.getDatatype().getDisplayString()); actionArgumentValues.add(new ActionArgumentValue<>(actionArgument, value)); } } @SuppressWarnings("unchecked") final ActionArgumentValue<RemoteService>[] array = actionArgumentValues.toArray(new ActionArgumentValue[0]); return array; } }