org.formaria.editor.project.helper
Class BuddyHelper

java.lang.Object
  extended by org.formaria.editor.project.helper.BuddyHelper

public class BuddyHelper
extends java.lang.Object

Extends StyleFactory by adding a caption component whenever a new component is added. This is intended for use with components such as TextFields, Choice and so on that normally have an associated label or caption

Copyright: Copyright (c) Formaria Ltd., 1998-2003
License: see license.txt


Constructor Summary
BuddyHelper(StyleFactory sf)
          Constructs a new BuddyHelper.
 
Method Summary
 java.lang.Object addComponent(java.lang.String type, int x1, int x2, int x3, int y, int w, int h, java.lang.String caption, java.lang.String txt, java.lang.String suffix, java.lang.String style)
          Pass the addNamedComponent call to the StyleFactory base Class
 java.lang.Object addComponent(java.lang.String type, int x1, int x2, int y, int w, int h, java.lang.String caption, java.lang.String txt, java.lang.String style)
          Pass the addNamedComponent call to the StyleFactory base Class
 java.lang.Object addComponent(java.lang.String type, int x, int y, int w, int h, java.lang.String caption, java.lang.String txt, java.lang.String style)
          Pass the addNamedComponent call to the StyleFactory base Class
 java.lang.Object getBuddy(java.lang.Object comp)
          Gets the associated buddy label.
 java.lang.Object getBuddySuffix(java.lang.Object comp, int item)
          Get a component following the referenced component.
 void setEnabled(java.lang.Object comp, boolean b)
          Set the enabled state for the component and its buddy
 void setVisible(java.lang.Object comp, boolean b)
          Set the visible state for the component and its buddy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuddyHelper

public BuddyHelper(StyleFactory sf)
Constructs a new BuddyHelper.

Parameters:
sf - the StyleFactory used to create the new components.
Method Detail

addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     int x1,
                                     int x2,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String caption,
                                     java.lang.String txt,
                                     java.lang.String style)
Pass the addNamedComponent call to the StyleFactory base Class

Parameters:
type - The type of object being constructed
x1 - The x coordinate of the new label component
x2 - The x coordinate of the new primary component
y - The y coordinate of the new component
w - The total width of the new components
h - The height of the new component
caption - The text of the associated label
txt - The text/content of the new component
style - The name of the style to apply
Returns:
the new component

addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     int x1,
                                     int x2,
                                     int x3,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String caption,
                                     java.lang.String txt,
                                     java.lang.String suffix,
                                     java.lang.String style)
Pass the addNamedComponent call to the StyleFactory base Class

Parameters:
suffix - the suffix text
type - The type of object being constructed
x1 - The x coordinate of the new label component
x2 - The x coordinate of the new primary component
x3 - The x coordinate of the suffix label
y - The y coordinate of the new component
w - The total width of the new components
h - The height of the new component
caption - The text of the associated label
txt - The text/content of the new component
style - The name of the style to apply
Returns:
the new component

addComponent

public java.lang.Object addComponent(java.lang.String type,
                                     int x,
                                     int y,
                                     int w,
                                     int h,
                                     java.lang.String caption,
                                     java.lang.String txt,
                                     java.lang.String style)
Pass the addNamedComponent call to the StyleFactory base Class

Parameters:
type - The type of object being constructed
x - The x coordinate of the new component
y - The y coordinate of the new component
w - The total width of the new components
h - The height of the new component
caption - The text of the associated label
txt - The text/content of the new component
style - The name of the style to apply
Returns:
the new component

getBuddy

public java.lang.Object getBuddy(java.lang.Object comp)
Gets the associated buddy label. The buddy is assumed

Parameters:
comp - the component for which the buddy label was added
Returns:
the buddy component

getBuddySuffix

public java.lang.Object getBuddySuffix(java.lang.Object comp,
                                       int item)
Get a component following the referenced component. This method can be used to retrieve the suffix of a component added using the addComponent method for 3 components.

Parameters:
comp - the main component
item - the offset, normally 1
Returns:
the suffix component

setVisible

public void setVisible(java.lang.Object comp,
                       boolean b)
Set the visible state for the component and its buddy

Parameters:
comp - the component for which the buddy label was added
b - true to show the component, false to hide

setEnabled

public void setEnabled(java.lang.Object comp,
                       boolean b)
Set the enabled state for the component and its buddy

Parameters:
comp - the component for which the buddy label was added
b - true to enable the component, false to disable