/* * Copyright (c) 2006,2009 Declarative Engineering LLC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Declarative Engineering LLC * verson 1 which accompanies this distribution, and is available at * http://declarativeengineering.com/legal/DE_Developer_License_v1.txt */ package com.foundation.view; /** * Encapsulates a link between one component's functionality and another component's target. */ public class LinkData { private Object component = null; private int target = -1; private Object data = null; private boolean isBoolean = false; private boolean invertLogic = false; private boolean nullValue = false; /** * LinkData constructor. * @param component The targeted component. * @param target The target component's target identifier for the linked link-target. * @param data The optional data passed when the link is invoked. * @param invertLogic Whether binary logic should be inverted when invoking the link. */ public LinkData(Object component, int target, Object data) { super(); this.component = component; this.target = target; this.data = data; this.isBoolean = false; }//LinkData()// /** * LinkData constructor. * @param component The targeted component. * @param target The target component's target identifier for the linked link-target. * @param data The optional data passed when the link is invoked. * @param invertLogic Whether binary logic should be inverted when invoking the link. */ public LinkData(Object component, int target, Object data, boolean invertLogic) { this(component, target, data, invertLogic, false); }//LinkData()// /** * LinkData constructor. * @param component The targeted component. * @param target The target component's target identifier for the linked link-target. * @param data The optional data passed when the link is invoked. * @param invertLogic Whether binary logic should be inverted when invoking the link. * @param nullValue The value to use when the input is null. The inverse will be used when the value is non-null and non-boolean. */ public LinkData(Object component, int target, Object data, boolean invertLogic, boolean nullValue) { super(); this.component = component; this.target = target; this.data = data; this.invertLogic = invertLogic; this.nullValue = nullValue; this.isBoolean = true; }//LinkData()// /** * LinkData constructor. * @param component The targeted component. * @param target The target component's target identifier for the linked link-target. * @param data The optional data passed when the link is invoked. * @param isBoolean Whether the invertLogic and nullValue parameters are used. * @param invertLogic Whether binary logic should be inverted when invoking the link. * @param nullValue The value to use when the input is null. The inverse will be used when the value is non-null and non-boolean. */ public LinkData(Object component, int target, Object data, boolean isBoolean, boolean invertLogic, boolean nullValue) { super(); this.component = component; this.target = target; this.data = data; this.invertLogic = invertLogic; this.nullValue = nullValue; this.isBoolean = isBoolean; }//LinkData()// /** * Gets the reference to the targeted component. * @return The targeted component. */ public Object getComponent() { return component; }//getComponent()// /** * Gets the target identifier as defined by the target component. * @return The target component's target identifier for the linked link-target. */ public int getTarget() { return target; }//getTarget()// /** * Gets the optional static data passed when invoking the link. * This will only be non-null if the link target requires data, the required data type is serializable and immutable, and the linking component does not provide any data. * @return The optional data passed when the link is invoked. */ public Object getData() { return data; }//getData()// /** * Gets whether the link is passing boolean data. * @return Whether the link is transfering a boolean value, in which case the nullValue and invertLogic flags should not be ignored. */ public boolean isBoolean() { return isBoolean; }//isBoolean()// /** * Determines whether binary logic should be inverted when invoking the link. * @return Whether inversion of binary logic should occur. */ public boolean invertLogic() { return invertLogic; }//invertLogic()// /** * Gets the value used when the input is null. The inverse will be used when the value is non-null and non-boolean. * @return The value used for a null input. */ public boolean nullValue() { return nullValue; }//nullValue()// }//LinkData//