home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
VisualProperty.java
< prev
next >
Wrap
Text File
|
1998-10-25
|
13KB
|
372 lines
/*
* Copyright 1998 Symantec Corporation, All Rights Reserved.
*/
package com.symantec.itools.vcafe.openapi;
import com.symantec.itools.vcafe.openapi.dtreflect.DTClass;
/**
* The API used to represent a property of a <code>VisualObject</code>.
*
* A plug-in can obtain a list of these objects from a <code>VisualObject</code>'s <code>getProperties</code>
* method. A plug-in can use the methods in this class to update the property value and other attributes.
*
* The implementation of all of <code>VisualProperty</code>'s abstract methods first calls
* checkValidity(). Any method could therefore throw an <code>InvalidVisualPropertyException</code>.
* This exception extends <code>RuntimeException</code>, so doesn't have to be explicity declared or
* caught. A <code>VisualProperty</code> can become invalid if it's <code>VisualObject</code> is removed from
* its project, or its project is closed, and the corresponding <code>VisualObjectListener</code> message is
* ignored, for example.
*
* @see VisualObject#getProperties
* @see InvalidVisualPropertyException
*
* @author Symantec Internet Tools Division
* @version 1.0
* @since VCafe 3.0
*/
public abstract class VisualProperty
{
/**
* Gets the (human readable) name of this property.
*
* @return the name of this property.
*/
public abstract String getName();
/**
* Gets the <code>VisualObject</code> that owns this property.
*
* @return this property's <code>VisualObject</code>.
*/
public abstract VisualObject getVisualObject();
/**
* Gets the (internal, unique) name of this property.
*
* @return the unique name for this property.
*/
public abstract String getInternalPropertyName();
/**
* Gets the nesting level of this property (for grouped properties).
*
* @return this property's nesting level.
*/
public abstract int getLevel();
/**
* Gets the first child property of this property (for folders).
* @return this property's first child.
* @see #isFolder
*/
public abstract VisualProperty getFirstChild();
/**
* Gets the sibling property of this property (for grouped properties).
*
* @return this property's sibling.
*/
public abstract VisualProperty getSibling();
/**
* Gets an <code>Object</code> representation this property's value.
* For example, if this property represents a <code>VisualObject</code>'s font, a <code>java.awt.Font</code>
* object is returned.
*
* @return this property's value as an <code>Object</code>.
*/
public abstract Object getValue();
/**
* Gets a <code>String</code> representation of this property's value.
*
* @return this property's value as a <code>String</code>.
*/
public abstract String getValueString();
/**
* Set this property's value, given a <code>String</code> representation of the new value.
*
* @param pValue <code>String</code> representation of the new value.
* @return <code>true</code> if successfully set, <code>false</code> otherwise.
*/
public abstract boolean setValueString(String pValue);
/**
* Appends a new element with the given value to this property (for arrays).
* @param pValue <code>String</code> representation of the new value.
* @see #isArray
*/
public abstract void appendValueString(String pValue);
/**
* Gets the value of an array element (for arrays).
* @param index the zero-based element index.
* @return the value as a <code>String</code>.
* @see #isArray
*/
public abstract String getNthValueString(int index);
/**
* Sets the value of an array element (for arrays).
* @param index the zero-based element index.
* @param pValue <code>String</code> representation of the new value.
* @see #isArray
*/
public abstract void setNthValueString(int index, String pValue);
/**
* Gets the number of array elements this property has (for arrays).
* @return the size of the array.
* @see #isArray
*/
public abstract int getNumValues();
/**
* Sets the number of array elements a property has to zero (for arrays).
* @see #isArray
*/
public abstract void setArrayEmpty();
/**
* Gets the number of <code>String</code> values this property enumerates (for enumerations).
* @return the number of elements.
* @see #isEnumerated
*/
public abstract int getNumEnum();
/**
* Gets the value of an enumeration element (for enumerations).
* @param the zero-based enumeration index.
* @return the element value.
* @see #isEnumerated
*/
public abstract String getEnum(int index);
// Applicable only for enumerated, mapped properties
public abstract int getEnumKey(int index);
/**
* Gets the name of the method used to get the value of this property.
* @return the name of the method used to get the property value.
* @see #getSetterName
* @see #getPropertyType
*/
public abstract String getGetterName();
/**
* Gets the name of the method used to set the value of this property.
* @return the name of the method used to set the value of this property.
* @see #getSetterParameterType
* @see #getGetterName
* @see #getPropertyType
*/
public abstract String getSetterName();
/**
* Gets the class name of the the setter method's parameter.
* @return the class name of the parameter in the setter method.
* @see #getSetterParameterType
* @see #getPropertyType
*/
public abstract String getSetterParameterType();
/**
* Gets the class of this property's value.
* @return the class of this property's value.
* @see #getGetterName
* @see #getSetterName
*/
public abstract DTClass getPropertyType();
/**
* Gets the exceptions that setting this property can throw. The returned value is a comma-delimited
* <code>String</code> like:
* "java.lang.NullPointerException,java.lang.NumberFormatException".
* @return a <code>String</code> of exceptions.
*/
public abstract String getExceptions();
/**
* Gets the class name of the eidtor used to view and edit this property.
* @return the editor's class name.
*/
public abstract String getPropertyEditorName();
/**
* This method is intended for use when generating Java code to set the value of the property.
* It returns a fragment of Java code that can be used to initialize a variable with the current
* property value.
* Example results are: "2", "new Color(127,127,34)", "Color.orange", etc.
* @return a fragment of Java code representing an initializer for the current value.
*/
public abstract String getJavaInitializationString();
/**
* If the custom property has a reference to a java object, it will be released.
*/
public abstract void unloadPropertyObject();
/**
* Determines whether the value of this property is editable.
* @return <code>true</code> if the value is editable, <code>false</code> otherwise.
*/
public abstract boolean isEditable();
/**
* Determines whether this property is displayed in the Property List.
* @return <code>true</code> if <b>not</b>, <code>false</code> otherwise.
*/
public abstract boolean isInvisible();
/**
* Sets whether this property is displayed in the Property List.
* @param invisible <code>true</code> if this property should <b>not</b> be displayed in the Property List.
*/
public abstract void setInvisible(boolean invisible);
/**
* Determines whether this is a folder type property.
* @return <code>true</code> if so, <code>false</code> otherwise.
*/
public abstract boolean isFolder();
/**
* Determines whether this is an enumerated type property.
* @return <code>true</code> if so, <code>false</code> otherwise.
*/
public abstract boolean isEnumerated();
public abstract boolean isMapped();
/**
* Determines whether this is an array type property.
* @return <code>true</code> if so, <code>false</code> otherwise.
*/
public abstract boolean isArray();
/**
* Determines whether this property can be copied.
* @return <code>true</code> if so, <code>false</code> otherwise.
*/
public abstract boolean isCopyable();
public abstract boolean isBound();
public abstract boolean isConstrained();
public abstract boolean isCustom();
/**
* Determines whether editing the value of this property requires a custom editor.
* @return <code>true</code> if so, <code>false</code> otherwise.
*/
public abstract boolean isCustomEditor();
public abstract boolean isPaintable();
public abstract boolean isUserGroup();
/**
* Determines if this property is currently set to its default value.
* @return <code>true</code> if so, <code>false</code> otherwise.
*/
public abstract boolean isDefault();
/**
* Determines whether this is an object reference type property. If <code>true</code> the value of this
* property is a reference to a <code>VisualObject</code>.
* @return <code>true</code> if so, <code>false</code> otherwise.
* @see getReferencedVisualObjectID
* @see setReferencedVisualObjectID
*/
public abstract boolean isObjectReferenceProperty();
/**
* Indicates an object reference type property currently references the default <code>VisualObject</code>.
* @see #getReferencedVisualObjectID
* @see #NO_OBJECT_REFERENCED
*/
public static final int DEFAULT_OBJECT_REFERENCED = -1;
/**
* Indicates an object reference type property currently references no object (ie is "<code>null</code>").
* @see #getReferencedVisualObjectID
* @see #DEFAULT_OBJECT_REFERENCED
*/
public static final int NO_OBJECT_REFERENCED = 0;
/**
* Gets the id of the <code>VisualObject</code> the value of this property refers to.
* @return the object ID of the <code>VisualObject</code> this property refers to or <code>DEFAULT_OBJECT_REFERENCED</code>
* or <code>NODEFAULT_OBJECT_REFERENCED</code>.
* @see #DEFAULT_OBJECT_REFERENCED
* @see #NO_OBJECT_REFERENCED
* @see #setReferencedVisualObjectID
* @see #getReferencedVisualObject
* @see VisualObject#getObjectID
*/
public abstract int getReferencedVisualObjectID();
/**
* Gets the <code>VisualObject</code> the value of this property refers to, or <code>null</code>.
* @return the <code>VisualObject</code> the value of this property refers to, or <code>null</code>.
* @see #getReferencedVisualObjectID
*/
public abstract VisualObject getReferencedVisualObject();
/**
* Sets the value of this property to a reference to a <code>VisualObject</code>.
* @param refVisualObjectID the object i of the <code>VisualObject</code> this property refers to or
* <code>DEFAULT_OBJECT_REFERENCED</code> or <code>NODEFAULT_OBJECT_REFERENCED</code>.
* @see #DEFAULT_OBJECT_REFERENCED
* @see #NO_OBJECT_REFERENCED
* @see #getReferencedVisualObjectID
* @see #getReferencedVisualObject
* @see VisualObject#getObjectID
*/
public abstract void setReferencedVisualObjectID(int refVisualObjectID);
/**
* Determines if one <code>VisualProperty</code> is equivalent to another.
* @param other the <code>VisualProperty</code> to compare with.
* @return <code>true</code> if the two <code>VisualProperties</code> refer to the same property in the same
* <code>VisualObject</code>, <code>false</code> otherwise.
*/
public abstract boolean equals(VisualProperty other);
/**
* Determines if this <code>VisualProperty</code> corresponds to a valid property in its <code>VisualObject</code>.
* A <code>VisualProperty</code> can become invalid if it's <code>VisualObject</code> is removed from
* its project, or its project is closed, and the corresponding <code>VisualObjectListener</code> message is
* ignored, for example.
* @return <code>true</code> if the this <code>VisualProperty</code> is still valid, <code>false</code> otherwise
* @see #checkValidity
*/
public abstract boolean isValid();
/**
* Checks that this <code>VisualProperty</code> corresponds to a valid property in its <code>VisualObject</code>.
* Note that the implementation of all of <code>VisualProperty</code>'s abstract methods first call
* checkValidity(). Any method could therefore throw an <code>InvalidVisualPropertyException</code>.
*
* @exception com.symantec.itools.vcafe.openapi.InvalidVisualPropertyException
* when its <code>VisualObject</code> has been removed from its project, or its project has
* been closed, for example
* @see #isValid
*/
public void checkValidity() throws InvalidVisualPropertyException {
if (!isValid()) throw new InvalidVisualPropertyException();
}
/**
* Gets a <code>String</code> that represents this object.
* @return the <code>String</code>.
*/
public String toString() {
if (!isValid()) return "invalid VisualProperty: " + super.toString();
return "VisualProperty[" + getInternalPropertyName() + "]";
}
}