The Java version of the GLG Toolkit provides a 100% pure Java class library that loads and displays GLG drawings in Java applications. The Java version of the GLG library supports all the GLG Toolkit features available to C and C++ applications, and provides the GLG Standard and Extended APIs for Java applications.
It also provides the Glg Bean, a Java bean component that seemlessly integrates the GLG Toolkit into a Java environment, embedding Java-based GLG components into Java application frameworks and Java IDEs. The bean may also be used as an applet, integrating GLG components as Java applets into a browser and HTML environment.
The Java version of the Toolkit uses GLG drawings saved with the GLG Graphics Builder. The drawings must be saved in ASCII format, either compressed or uncompressed. The same drawing may be used by both the Java and C/C++ versions of the Toolkit. The drawing can also be generated on the fly using the Extended API.
GlgObject is the main class of the Java version of the GLG Toolkit. The GlgObject class contains all the functionality available to GLG objects. Since all objects implement the Get and SetResource functions central to the GLG architecture, it's only natural that the GlgObject superclass is heavily used, making it a Superclass in a more general sense. Using one main superclass also makes it easier to deal with GLG objects by limiting the number of classes and methods one has to learn.
The GLG Toolkit also contains Java classes for different GLG objects: polygons, arcs, etc. However, only the constructors of these classes are used. Once the object is created, all further object manipulation is done by using the GlgObject methods.
The GLG Toolkit also provides classes such as GlgPoint , GlgCube and some other utility classes, mainly used to exchange information between different object methods.
There are three GLG listeners: GlgInputListener , GlgSelectListener and GlgTraceListener used to handle user interaction and object selection. These listeners are supported by both the GlgObject and Glg bean classes, as described below.
In addition to GlgObject , several Glg Bean classes are provided:
AWT-based Java bean and applet.
Heavyweight Swing-based Java bean and applet (JApplet).
Lightweight Swing-based Java bean for use with JDesktopPane and JInternalFrame.
All Glg Bean classes have the same Glg-inherited interface and differ only in the methods inherited from respective AWT or Swing superclasses. The AWT and Swing-based GLG beans should not be intermixed in one application. The light-weight version of the GLG bean (GlgJLWBean) uses Swing's light-weight model which imposes a performance penalty related to the absence of a native window and a necessity to handle clipping in software. Although it is OK to use the light-weight component for small to medium drawings, a heavy-weight component is recommended for large graphically-intensive drawings.
The type of the top level bean may be different from the type of the components used to render GLG viewport objects displayed inside the GlgBean and GlgJBean. By default, the GlgBean uses AWT components, while the GlgJBean and GlgJLWBean use Swing-based components.
The GlgSwingUsage global configuration resource described on page 277 of Appendix A: Global Configuration Resources may be used to change the default type of components used to render GLG viewport objects inside the bean. See the GlgSwingUsage resource description for details. The resource is global, affects all GLG viewports and must be set at the application start-up. If the resource is not used, the type of components is determined by the type the Glg Bean (AWT or Swing) used by an application.
The Glg Bean is a Java bean encapsulation of a GLG viewport object that loads, displays and animates a GLG drawing. The bean provides several properties that facilitate loading the drawing and using the bean as an applet in a browser environment.
The Glg Bean exposes methods similar to those of GlgObject . While the GlgObject methods have to be invoked for individual objects, the bean provides a central place for invoking methods on any object or resource. Since the methods exposed by the Glg Bean are the same as the methods of the GlgObject class, there are two ways of using GLG and Glg Bean in a Java application:
The Glg Bean may be used to integrate a GLG drawing into a Java application by creating a Glg Bean and using its SetDrawing methods to load a drawing. After loading the drawing, the viewport object (a GlgObject ) of the loaded drawing may be extracted by calling Glg Bean 's GetDrawingObject method, after which all further processing may be done using the GlgObject class methods of the viewport or individual objects inside the viewport.
The Glg Bean may only be used with the methods exposed by the Glg Bean itself. This is especially convenient when the Glg Bean is used as an applet inside a web browser that supports Java Script and the object's methods are invoked by the script.
In addition to the input, select and trace listeners, the bean provides a few additional listeners, GlgHListener, GlgVListener and GlgReadyListener, which simplify setting the initial resources and program initialization. The bean implements all listener interfaces and acts as a default listener. This makes it more convenient to create custom beans by subclassing the Glg bean and overriding some or all of its listener interfaces.
The Toolkit also provides a GlgErrorHandler interface for custom error handling.
The GlgAntiAliasing global configuration resource described on page 277 of Appendix A: Global Configuration Resources controls the use of anti-aliasing in Java 2 and Java 2D environment.
This chapter describes language-specific details of using the Java version of the Toolkit. Refer to Using the C/C++ version of the Toolkit for a detailed description of semantics of the Standard and Extended API methods, as well as details of handling user input (described in Handling Input Events on page 85). The semantics of all API methods is the same in all versions of the Toolkit, and the C/C++ section provides examples and details of using them.
Refer to the GLG Programming Tutorial for Java for detailed examples and a walk-through tutorial.
An on-line documentation for the Toolkit's Java class library in the JavaDoc format is also provided. The JavaDoc documentation is intended as a quick reference for the GLG Java classes and their methods, but not as a definitive guide to using the Toolkit in Java. Refer to Using the Java version of the GLG Toolkit for more details. Refer to Using the C/C++ version of the Toolkits for examples of using the GLG methods for specific tasks.
The Java version of the Toolkit uses the GLG Java Class Library from the GlgEval2.jar, Glg2.jar or GlgExt2.jar archive files. The GlgEval2.jar file supplies a free evaluation version, the Glg2.jar supplies a purchased version with the GLG Standard API, and the GlgExt2.jar file supplies the purchased version with the GLG Extended API.
All three libraries use Java2D renderer and support anti-aliasing, gradient shading, transparency and alpha blending, as well as Swing and light-weight components.
This callback method is invoked every time a user interacts with input objects in the drawing or selects objects in the drawing with the mouse. More information about the type of the input activity may be extracted from the message object passed by the message_object parameter. The object parameter is the listener's viewport object. Refer to Input Callback of Handling Input Events for more details.
Listener interface used to handle an object selection with the mouse, provides a simplified name-based interface for object selection handling.
This callback is invoked every time user uses the mouse to select one or more objects in the drawing. The name_array parameter is a null-terminated array of names of selected objects. The button parameter is the mouse button used for selection (1, 2 or 3). The object parameter is the listener's viewport object. Refer to Selection Callback of Handling Input Events for more details.
This callback is invoked for every event occurring in any of the drawing's viewports and may be used to implement custom selection or hot-spots logic and to handle Java events. The object parameter is the listener's viewport object. Refer to Trace Callbacks of Handling Input Events for more details.
This callback is invoked after the bean's drawing is loaded, but before the drawing hierarchy is set up. It may be used to set the initial resources of the bean's drawing, such as the number of samples in a GLG graph object. The viewport parameter is the listener's viewport object.
This callback is invoked after the bean's drawing is loaded and set up, but before it is displayed for the first time. It may be used to set the initial resources of the bean's drawing. For example, it may be used to supply data for the initial appearance of a GLG graph object. The viewport parameter is the listener's viewport object.
Lightweight Swing-based Java bean for use with JDesktopPane and JInternalFrame.
Glg Beans are Java bean components that integrate GLG objects into the Java environment. The Glg Bean is a Java Bean encapsulation of a GLG viewport object that loads, displays and animates a GLG drawing. All Glg Bean classes have the same Glg-inherited interface and differ only in the methods inherited from their respective AWT or Swing superclasses. The AWT and Swing-based GLG beans should not be intermixed in one application.
The Glg Bean provides methods similar to those of GlgObject . Methods of the Glg Bean and the bean's viewport GlgObject may be used interchangeably.
The Glg Bean implements all GLG listener interfaces and automatically adds listeners for all GLG events. The bean's listener interface methods may be overwritten by the bean's subclass.
The Glg Bean provides functionality for following HTML links when used in the browser and HTML environment. If an object contains an S resource named "$href" , the value of the resource is interpreted as a URL which defines an HTML link. If the user selects an object in the drawing which has an HTML link, the link's URL will be automatically loaded. Custom Properties may be used to attach the "$href" property to objects in the Builder. The HRefTarget property of the bean may be used to define an html target name to open the link in a different browser window.
If the TraceHRef property of the bean in set to true , the bean also traces the link's hot spot and changes the cursor shape when cursor moves over an object that represents a link.
The URL of the drawing to be loaded into the bean. If a relative filename, such as drawing.g , is used, it will be interpreted relatively to the applet's DocumentBase .
A relative drawing name. This can be used to transparently specify the drawing location for both the applet and stand-alone Java application. For an applet, it is relative to it's DocumentBase . For a stand-alone application, it is relative to the current directory.
The URL of the setup script in the Glg Script Format to use for initializing drawing's resources.
The URL of the data script in the Glg Script Format to use for periodic updates of the drawing's resources.
String properties used to initialize drawing's resources before hierarchy setup. For information about the format of the strings see Dynamic Resource String Syntax on page 173.
String properties used to initialize drawing's resources after hierarchy setup. For information about the format of the strings see Dynamic Resource String Syntax on page 173.
If set to true , the bean will trace the hot spots for http links which are defined in the drawing. To make a graphical object a hot spot, it needs to have a custom property of an S type named " $href ". The value of the custom property defines link's URL. When the mouse moves over an object with a link, the cursor will change and, if the bean is used inside the browser, the links' URLs will be displayed in the browser's status area. The default value of the property is false .
Specifies a name of the browser frame to use when opening http links defined in the drawing. The default value is null , causing link's URL to replace the bean.
Prints the message to stdout. Provided for convenience when used with Java Script in a web browser.
Sets a new value of the DrawingName property, loads the drawing and displays it in the bean. If the bean is used as an applet or part of another applet (bean's SetParentApplet method was used), the DrawingName is interpreted as a URL relative to the applet's document base directory. Otherwise, the DrawingName is interpreted as a file relative to the current directory.
Sets a new value of the DrawingURL property, loads the drawing from the URL and displays it in the bean.
Sets a new value of the DrawingFile property, loads the drawing from the file and displays it in the bean.
Sets a new value of the DataURL property, reads and executes the new DataURL script. If the UpdatePeriod property is greater then 0, the DataURL will be read periodically with the period defined by the UpdatePeriod. The data script will be read once each time the drawing is reloaded using the SetDrawing methods, and then periodically if the UpdatePeriod property is set.
Sets a new value of the SetupDataURL property. The SetupDataURL script is read and executed once after a new drawing is loaded into a bean and every time the drawing is reloaded by using the SetDrawing methods.
Sets a new value of the UpdatePeriod property and starts or stops periodic reading of DataURL if necessary. The DataURL is read periodically if the UpdatePeriod is greater then 0.
Activates logging debugging messages to stdout or the Java Console.
Activates logging messages for setting resources from data scripts.
Activates logging API calls, which is convenient for debugging Java Scripts in a web browser.
public void SetHResource1( String value )
public void SetHResource2( String value )
public void SetHResource3( String value )
public void SetHResource4( String value )
Set the value of the H properties. These properties are used to set resources of the bean's drawing before the drawing's object hierarchy is created.
The syntax of these properties is described in Dynamic Resource String Syntax of Using the ActiveX Control. Refer to H and V Resources of Details of using GLG Standard API for C and C++ for more details on H and V resources.
public void SetVResource1( String value )
public void SetVResource2( String value )
public void SetVResource3( String value )
public void SetVResource4( String value )
Set the value of the V properties. These properties are used to set resources of the bean's drawing after the drawing's object hierarchy is created.
The syntax of these properties is described in Dynamic Resource String Syntax of Using the ActiveX Control. Refer to H and V Resources of Details of using GLG Standard API for C and C++ for more details on H and V resources.
Sets the value of the TraceHRef property. If the property is set to true , the bean traces the mouse movements and changes the cursor shape when cursor moves over objects in the drawing which have HTML links. If an object contains an S resource named "$href" , the value of the resource is interpreted as a URL which defines an HTML link.
Sets the value of the TraceHRef property which defines the target name for showing html links. If set to null, clicking on the hot spot defined by the "$href" property with the left mouse button opens the link in the same browser window, or in a separate window with the "_blank" target name if other mouse buttons are used. If HRefTarget property is not null, the link is always opened in a separate window with the target name defined by the HRefTarget property.
Sets the value of the IgnoreErrors properties. If set to true , suppresses GLG error messages.
This is useful in the bean box test program, which tries to set the value of a string property on every starting change before the entry is finished, which results in errors for the string properties that define URLs.
Returns the Ready status of the bean. The bean is ready when it finished loading the drawing and reading setup data and data URLs.
Sets the parent applet used to determine the document base when the bean is used as part of another applet.Use null for the parent_applet parameter to unset the parent applet.
Returns the full path name. If the bean is used as an applet or a part of another applet (the SetParentApplet method was used), the method prepends the applet's document path to the filename. Otherwise, the filename parameter is returned unchanged.
public double GetDTag( String tag_name )
Returns the value of the D-type resource or tag of the bean's drawing.
public String GetSTag( String tag_name )
Returns the value of the S-type resource or tag of the bean's drawing.
public double GetYTag( String tag_name )
public double GetZTag( String tag_name )
Return the X, Y or Z values of the G-type resource or tag of the bean's drawing.
public boolean SetDResource( String res_name, double dvalue, boolean if_changed )
public boolean SetDTag( String tag_name, double dvalue, boolean if_changed )
Sets the value of the D-type resource or tag of the bean's drawing. Returns true if the value of the resource or tag was successfully changed.
public boolean SetSResource( String res_name, String svalue, boolean if_changed )
public boolean SetSTag( String tag_name, String svalue, boolean if_changed )
Sets the value of the S-type resource or tag of the bean's drawing. Returns true if the value of the resource or tag was successfully changed.
public boolean SetGResource( String res_name, double dvalue1, double dvalue2, double dvalue3, boolean if_changed )
public boolean SetGTag( String tag_name, double dvalue1, double dvalue2, double dvalue3, boolean if_changed )
Sets the values of the G-type resource or tag of the bean's drawing (x, y and z values of a point or R, G and B values or a color). Returns true if the value of the resource or tag was successfully changed.
Sets the value of the S-type resource of the bean's drawing to a string obtained by converting the supplied double value ( dvalue ) according to the given format. The format parameter is a C-like format string. Returns true if the value of the resource was successfully changed.
Performs a zoom or pan operation specified by the type parameter. If the res_name parameter is null, the bean's viewport is zoomed. Otherwise, the zoom operation will be performed on its child viewport specified by the res_name parameter. The value parameter defines a zoom factor or pan distance. Refer to GlgSetZoom on page 71 for a complete list of all zoom and pan types.
If the method attempts to set a very large zoom factor which would result in the overflow of the integer coordinate values used by the native windowing system, the zoom operation is not performed and the method returns false.
Prints the bean's drawing and saves it in a PostScript file. Returns true if the drawing was successfully printed. The inherited print() method is used for native Java printing.
Creates and returns a resource name string by inserting a number ( resource_index ) to the template string ( template_name ). The number is inserted at the position indicated by the "%" character, or at the end of the template name if it does not contain the "%" character.
Enables or disables an automatic update performed at the end of the bean's InputCallback . Returns the previous enabled status.
Adds a GLG event listener to the bean. The callback_type parameter may have one of the following values: SELECT_CB, INPUT_CB, TRACE_CB, TRACE2_CB, H_CB, V_CB or READY_CB. The type of the listener provided by the second parameter must match the type parameter and may have one of the following values: GlgSelectListener, GlgInputListener, GlgTraceListener, GlgHListener, GlgVListener or GlgReadyListener, respectively. Only one listener of each type may be added. If no listener was added for some event types, the bean is used as a default listener. Use with null as the listener parameter to remove the listener specified by the callback_type parameter.
The default HCallback invoked after the bean's drawing is loaded, but before its object hierarchy is set up. The bean's AddListener method may be used to change the default callback. The vp parameter is the top level viewport of the bean's drawing.
The default VCallback invoked after the bean's drawing is loaded and set up, but before it is displayed for the first time. The bean's AddListener method may be used to change the default callback. The vp parameter is the top level viewport of the bean's drawing.
The default ReadyCallback invoked after the bean has finished loading the drawing and reading its data. The bean's AddListener method may be used to change the default callback. The vp parameter is the top level viewport of the bean's drawing.
This callback is invoked after the bean finished reading data on periodic updates. The ReadyCallback is invoked the first time, and the UpdateCallback is invoked on any subsequent data updates.
The default InputCallback invoked every time the user interacts with input objects in the drawing. More information about the type of the input activity may be extracted from the message_object parameter. Refer to Input Callback of Handling Input Events for more details. The bean's AddListener method may be used to change the default callback. The vp parameter is the top level viewport of the bean's drawing.
The default SelectCallback invoked every time the user selects one or more objects in the drawing with the mouse. The name_array parameter is a null-terminated array of names of selected objects. The button parameter is the mouse button used for selection (1, 2 or 3). Refer to Selection Callback Handling Input Events for more details. The bean's AddListener method may be used to change the default callback. The vp parameter is the top level viewport of the bean's drawing.
The TraceCallback and Trace2Callbacks are invoked for every event occurring in any of the drawing's viewports. They may be used as an escape mechanism to handle low-level Java events. The TraceCallback is invoked before dispatching the event for processing, while the Trace2Callback is invoked after the event has been processed. The vp parameter is the top level viewport of the bean's drawing. These callbacks are disabled by default and must be explicitly enabled by invoking the bean's AddListener method.
Sets a new viewport object as a drawing for the bean and displays the new drawing.
Loads a viewport named "$Widget" from a file or URL, and returns it. The media type parameter defines the loading type (URL or FILE). Returns null if the drawing can't be loaded or if it the "$Widget" viewport can't be found.
Finds a viewport named "$Widget" inside the object and returns it. Returns null if the "$Widget" viewport can't be found.
Draws a viewport object for the first time. If the viewport object does not have a parent, it will appear as a separate top level window. Sets up the hierarchy if it wasn't set up yet.
Creates and returns an full or constrained copy of an object according the clone_type (WEAK_CLONE, STRONG_CLONE, FULL_CLONE or CONSTRAINED_CLONE).
Loads an object from a file or URL, and returns it. The media_type parameter defines the loading type (URL or FILE). Returns null if the object can't be loaded.
Saves the object into a file with the given filename . Returns true if the object was successfully saved.
Adds the object to the beginning of the container . Returns true if the object was successfully added.
Adds the object to the end of container . Returns true if the object was successfully added.
Adds the object to the container at the index position . Returns false if index is invalid.
Adds an object to the container at the position indicated by the access_type (BOTTOM, TOP or CURRENT). If the access type is CURRENT, the object is added before or after the element indicated by the container's current position, as indicated by the position_modifier parameter (BEFORE or AFTER). Sets the container's current position to point to the added object. Returns true if the object was successfully added.
Deletes the first object of this container. Returns true if the object was successfully deleted.
Deletes the first object of this container. Returns true if the object was successfully deleted.
Deletes the object of the container at the index position . Returns false if index is invalid.
Deletes an object from container . Returns true if the object was successfully deleted.
Returns the element of the container indicated by the index .
Returns the index of the first occurrence of the object in the container or -1 if the object wasn't found in the container.
Returns an index of the first occurrence of the string in the container or -1 if the string wasn't found in the container.
Returns the named element of the container defined by the name parameter.
Moves the container's element from the old_index to the new_index position. The function returns false if indexes are out of range.
Initializes the container for traversing. This function should be called before invoking the container's Iterate method.
Sets the object's transformation to a constrained copy of the xform parameter. If the object has already been drawn, it has to be suspended with the SuspendObject method before setting its transformation. If the xform parameter is null, the function removes any object transformations. The CopyObject and CloneObject methods may be used in conjunction with the SetXform to add unconstrained copies of the same transformation to several objects.
Finds and returns a named resource or an attribute of the object. The resource or attribute must be of the GlgObject type, and is specified with the res_name parameter.
Sets the new value of the object's attribute specified by the resource_name . It is used for attaching Custom Property objects and aliases .
Finds and returns a named resource or an attribute of the object. The resource or attribute may be of the Object type or any subclass of the Object .
Constrains an attribute object ( from_object ) to the object defined by the to_object attribute parameter. The attribute object being constrained must be obtained by using either a default attribute name at the end of the resource path name, or using the container access functions. If the object has already been drawn, a SuspendObject method should be invoked on either the attribute object or its parent before constraining.
Unconstrains the input attribute object. The input object is obtained by using either a default attribute name at the end of the resource path name, or using container access functions. If the object has already been drawn, a SuspendObject method should be invoked on either the attribute object or its parent before constraining.
Suspends the object for editing. This function must be called before adding a transformation or constraining attributes of the object whose object hierarchy has been setup (the object has been drawn). The method returns a GlgObject , which can be used as the suspend_info parameter to a subsequent call to the ReleaseObject method.
Releases the object after suspending for editing. The suspend_info parameter is a returned value of a previous call to SuspendObject.
Returns the number of parents of the object. Used to determine a type of the return value of the GetParent method.
Returns the objects' parent if the object has one parent. If object has more than one parent, returns an array of parents. The type of the return value may be determined by using GetNumParents method.
Returns the value of an object's D-type resource specified by res_name .
Returns the value of an object's S-type resource specified by res_name .
public double GetYResource( GlgObject object, String res_name )
public double GetZResource( GlgObject object, String res_name )
Returns the X, Y or Z values of an object's G-type resource specified by res_name .
Sets the value of the D-type resource (specified by res_name ) of object to dvalue . Returns true if the value of the resource was successfully changed.
Sets the value of the S-type resource (specified by res_name ) of the object. Returns true if the value of the resource was successfully changed.
Sets the new values of the G-type resource (specified by res_name ) of the object. Returns true if the value of the resource was successfully changed.
Updates the viewport to display the latest resource settings.
Prints a drawing of the viewport to a PostScript file. The x, y, width and height parameters define the page layout of the print output in the GLG coordinate system (use x=-1000, y=-1000, width=2000, height = 2000 to use the whole page). The portrait parameter defines the portrait or landscape orientation. If the stretch parameter is false, the aspect ratio of the drawing is preserved. The function returns true if the drawing was successfully printed.
Sets the value of the data or matrix resource (specified by res_name ) to the value of the o_value object. The resource types should match, otherwise false is returned . Returns true if the value of the resource was successfully changed.
Sets the value of the input object's S-type resource (specified by res_name ) to a string obtained by converting the supplied double value ( dvalue ) according to the format. The format parameter is a C-like format string. Returns true if the value of the resource was successfully changed.
abstract public class GlgObject
GlgObject is the main class of the Java implementation of the GLG Toolkit. It provides functionality available to all GLG objects. The instances of this class are never created directly. Instead, GLG objects are either loaded from a GLG drawing created using the GLG Graphics Builder, or, for advanced users, created using one of the constructors for the GLG graphical objects (See the GLG objects classes later in this chapter) and then accessed using the GlgObject superclass.
The GlgObject contains the following public data variables:
public static final int CROSS;
public static final int FILLED_BOX;
public static final int CIRCLE;
public static final int FILLED_CIRCLE;
public static final int DIAMOND;
public static final int FILLED_DIAMOND;
public static final int FIXED_TEXT;
public static final int AUTOSCALED_TEXT;
public static final int HORIZONTAL;
public static final int VERTICAL;
public static final int USE_TEMPLATE;
public static final int DRAWING_AREA_WIDGET;
public static final int PUSH_BUTTON_WIDGET;
public static final int DRAWN_BUTTON_WIDGET;
public static final int TOGGLE_BUTTON_WIDGET;
public static final int MAIN_WINDOW_WIDGET;
public static final int BULLETIN_WIDGET;
public static final int FORM_WIDGET;
public static final int ROW_COLUMN_WIDGET;
public static final int LEFT_ARROW_WIDGET;
public static final int RIGHT_ARROW_WIDGET;
public static final int UP_ARROW_WIDGET;
public static final int DOWN_ARROW_WIDGET;
public static final int HORIZONTAL_SCALE_WIDGET;
public static final int VERTICAL_SCALE_WIDGET;
public static final int HORIZONTAL_SCROLL_WIDGET;
public static final int VERTICAL_SCROLL_WIDGET;
public static final int MENU_BAR_WIDGET;
public static final int MS_FRAME_WIDGET;
public static final int TEXT_WIDGET;
public static final int LABEL_WIDGET;
public static final int OPTION_MENU_WIDGET;
public static final int PULL_DOWN_MENU_WIDGET;
public static final int VERTICAL_SEPARATOR_WIDGET;
public static final int HORIZONTAL_SEPARATOR_WIDGET;
public static final int LIST_WIDGET;
public static final int MULTI_LIST_WIDGET;
public static final int EXT_LIST_WIDGET;
public static final int NO_TOP_SHELL;
public static final int REFERENCE;
public static final int ATTRIBUTE;
public static final int MATRIX;
public static final int FUNCTION;
public static final int XFORM;
public static final int VECTOR;
public static final int POLYGON;
public static final int ARRAY;
public static final int SCREEN;
public static final int DISPLAY;
public static final int VIEWPORT;
public static final int MARKER;
public static final int FONTTABLE;
public static final int PARALLELOGRAM;
public static final int SQUARE_SERIES;
public static final int SERIES;
public static final int COLORTABLE;
public static final int HISTORY;
public static final int POLYLINE;
public static final int POLYSURFACE;
public static final int FRAME;
public static final int IMAGE;
public static final int GLG_OBJECT;
public static final int STRING;
public static final int WEAK_CLONE;
public static final int STRONG_CLONE;
public static final int TRANSLATE_XF;
public static final int MATRIX_XF;
public static final int PATH_XF;
public static final int TRANSLATE_X_XF;
public static final int TRANSLATE_Y_XF;
public static final int TRANSLATE_Z_XF;
public static final int TRANSLATE_XYZ_XF;
public static final int SCALE_X_XF;
public static final int SCALE_Y_XF;
public static final int SCALE_Z_XF;
public static final int SCALE_XYZ_XF;
public static final int ROTATE_X_XF;
public static final int ROTATE_Y_XF;
public static final int ROTATE_Z_XF;
public static final int CONCATENATE_XF;
public static final int LINEAR_XF;
public static final int D_FORMAT_XF;
public static final int S_FORMAT_XF;
public static final int DIVIDE_XF;
public static final int TRANSFER_XF;
public static final int RANGE_XF;
public static final int SCALE_TRANSLATE_XF;
public static final int SCALE_TRANSLATE_XYZ_XF;
public static final int COMBO_XF;
public static final int SHEAR_X_XF;
public static final int SHEAR_Y_XF;
public static final int UNDEFINED_XR;
public static final int POINT_XR;
public static final int COLOR_XR;
public static final int GEOM_XR;
public static final int GDATA_XR;
public static final int LOCAL;
public static final int SEMI_GLOBAL;
public static final int GLOBAL;
public static final int INPUT_CB;
public static final int SELECT_CB;
public static final int TRACE_CB;
public static final int NO_ARROW;
public static final int START_ARROW;
public static final int END_ARROW;
public static final int START_END_ARROW;
public static final int MIDDLE_ARROW;
public static final int MIDDLE_INVERSED_ARROW;
public static final int START_FILL_ARROW;
public static final int END_FILL_ARROW;
public static final int START_END_FILL_ARROW;
The GlgObject class provides the following public methods.
Draws a viewport object for the first time. If the viewport object does not have a parent, it will appear as a separate top level window. Sets up the hierarchy if it wasn't set up yet.
Performs a zoom or pan operation specified by the type parameter. If the res_name parameter is null, the viewport itself is zoomed. Otherwise, the zoom operation will be performed on its child viewport specified by the res_name parameter. The value parameter defines the zoom factor or pan distance. Refer to GlgSetZoom on page 71 for a complete list of all zoom and pan types.
If the method attempts to set a very large zoom factor which would result in the overflow of the integer coordinate values used by the native windowing system, the zoom operation is not performed and the method returns false.
Sets or resets a viewport's GIS Zoom Mode. If the GIS zoom mode is set, any zooming and panning operations invoked by the SetZoom method will zoom and pan the map displayed in the viewport's GIS object instead of being applied to the viewport's drawing. If the res_name parameter is null, the GIS zoom mode of the viewport itself will be set. Otherwise, the GIS zoom mode will be set for its child viewport specified by the res_name parameter. If the gis_name parameter is not null, it specifies the resource path of the GIS object relative to the gis_object parameter, or relative to the viewport if the gis_object parameter is null. The method may be invoked with gis_object=null and gis_name=null to reset the GIS zoom mode.
Loads an object from a file or URL (given by filename ) and returns it. The media_type parameter defines the loading type (URL or FILE). Returns null if the object can't be loaded.
Loads a viewport named "$Widget" from a file or URL, and returns it. The media_type parameter defines the loading type (URL or FILE). Returns null if the drawing can't be loaded or if it the "$Widget" viewport can't be found.
Finds a viewport named "$Widget" inside the object and returns it. Returns null if the "$Widget" viewport can't be found.
Sends a message specified by the message parameter. If the res_name parameter is null, the message is sent to the object itself. Otherwise, the message is sent to the object's child specified by the res_name parameter. The param<n> arguments define additional parameters of the message depending on the message type. The Integer object must be used to pass integer values to the message. Integer values returned by the query messages are returned as Integer objects.
Refer to Input Objects on page 103 of the GLG User's Guide and Builder Reference Manual for a list of messages supported by each type of the available input handlers.
Writes all text strings defined in the drawing specified by the object parameter into a string translation file using requested separator characters and encoding. Refer to Localization Support on page 101 of the GLG User's Guide and Builder Reference Manual for information about the string translation file format. The method returns the number of exported strings or -1 in case of an error.
Replaces text strings in the drawing defined by the object parameter with the strings loaded from a string translation file with the specified encoding. Refer to Localization Support on page 101 of the GLG User's Guide and Builder Reference Manual for information about the string translation file format.The method returns the number of imported strings or -1 in case of an error.
Writes all tag names defined in the drawing specified by the object parameter into a file using requested separator characters and encoding. The method uses the same file format as the ExportStrings method. Refer to Localization Support on page 101 of the GLG User's Guide and Builder Reference Manual for information about the file format. The method returns the number of exported tag names or -1 in case of an error.
Replaces tag names in the drawing defined by the object parameter with the tag names loaded from a tag translation file using the specified encoding. The method uses the same file format as the ImportStrings method. Refer to Localization Support on page 101 of the GLG User's Guide and Builder Reference Manual for information about the tag translation file format.The method returns the number of imported tag names or -1 in case of an error.
Prints the viewport object's drawing and saves it in a PostScript file. The x, y, width and height parameters define the page layout of the print output in the GLG coordinate system (use x=-1000, y=-1000, width=2000, height = 2000 to use the whole page). The portrait parameter defines the portrait or landscape orientation. If the stretch parameter is false, the aspect ratio of the drawing is preserved. The function returns true if the drawing was successfully printed.
Prints the viewport object's drawing into a provided graphics object. The origin of graphics is assumed to be (0,0) and clipping to be set the viewport's window width and height. Returns true if the drawing was successfully printed.
Generates an image of the visible area of the viewport's drawing and returns it in a form of the Java Image object. The res_name parameter specifies the resource name of a child viewport whose image to generate, or null to generate the image of the viewport itself. The function returns null if image creation fails.
Generates an image of the area of the drawing defined by the image_area (in the screen pixels), and returns it in a form of the Java Image object. If image_area is null, the image of the whole drawing is generated, which may be bigger than the visible area of the viewport if the drawing is zoomed in. The gap parameter specifies the padding space between the extent of the drawing and the edge of the image when the image_area is null. The viewport's zoom factor defines the scaling factor for objects in the drawing when the image is saved. The res_name parameter specifies the resource name of a child viewport whose image to generate, or null to generate the image of the viewport itself. The function returns null if image creation fails.
Creates and returns a resource name string by inserting the given number ( resource_index ) to the template_name string. The index is inserted at the position indicated by the "%" character, or at the end of the template name if it does not contain the "%" character.
Creates a "/"- separated resource name by appending the second resource name to the first one, and inserting the "/" separator is necessary.
public boolean SetDResource( String resource_name, Double d_value )
public boolean SetDResource( String resource_name, double d_value, boolean if_changed )
public boolean SetDResource( String resource_name, Double d_value, boolean if_changed )
public boolean SetDTag( String tag_name, double d_value, boolean if_changed )
public boolean SetDTag( String tag_name, Double d_value, boolean if_changed )
Sets the value of scalar resource or tag. Returns true if the value of the resource or tag was successfully changed.
public boolean SetGResource( String resource_name, GlgPoint g_value )
public boolean SetGResource( String resource_name, double g_value1, double g_value2,
double g_value3, boolean if_changed )
public boolean SetGResource( String resource_name, GlgPoint g_value, boolean if_changed )
public boolean SetGTag( String tag_name, double g_value1, double g_value2, double g_value3, boolean if_changed )
public boolean SetGTag( String tag_name, GlgPoint g_value, boolean if_changed )
Sets the value of a G-type resource or tag. Returns true if the value of the resource or tag was successfully changed.
public boolean SetSResource( String resource_name, String s_value, boolean if_changed )
public boolean SetSTag( String tag_name, String s_value, boolean if_changed )
Sets the value of a string resource or tag. Returns true if the value of the resource or tag was successfully changed.
Sets the value of a string resource or tag to a string obtained by converting the supplied double value according to the specified format. The format parameter is a C-like format string. Returns true if the value of the resource or tag was successfully changed.
Sets the new value of the resource object defined by the resource name to the value of the o_value object. The resource types should match. Returns true if the value of the resource was successfully changed.
Converts coordinates between the GIS coordinate system of the GIS Object and GLG coordinate system of the drawing. If the res_name parameter is NULL, the coordinate system of this object is used for conversion. If the res_name parameter is not NULL, it specifies the resource name of the GIS object inside of this object whose coordinate system will be used for conversion. The coord_type parameter specifies the type of the GLG coordinate system type to convert to or from: SCREEN_COORD for screen coordinates or OBJECT_COORD for world coordinates. If the coord_to_lat_lon parameter is true, coordinat