All Packages Class Hierarchy This Package Previous Next Index
Interface pub.java.gui.builders.BuilderComponentBeanInfo
- public interface BuilderComponentBeanInfo
An extension to the standard BeanInfo to make working with complex Beans
easier and more accurate. The extensions are designed to provide GUI
builders with information on the content and layout as well as providing
a null argument constructor that may be used to set up internal structure
within a Bean.
This interface is designed to be used by any GUI Builder that requires
this functionality and has not been specifically written for
the JForge GUI Builder.
Copyright Cameron Newham. Permission to use and redistribute this source
file for any purpose is hereby granted.
-
addComponent(Component, Component)
- Adds a child component to the component.
-
getChildren(Component)
- Returns the children of this component (i.e.: those children
that can be editted and are managed by this component).
-
getContent(Component)
- Returns a component to which layouts and other components can
be added.
-
getDefaultLayout()
- Returns the default Layout Manager for this component.
-
getJavaConstructorString(Component)
- Returns a string that would create a new instance of the component when
compiled and run.
-
getJavaInitializationStrings(Component)
- Returns an array of strings that would regenerate the component
when compiled and run.
-
getVisibleChildren(Component)
- Returns the currently visible children of this component.
-
isAddProvided()
- Returns a boolean indicating whether this bean info provides the
functionality to perform an add() via the method addComponent.
-
isRemoveProvided()
- Returns a boolean indicating whether this bean info provides the
functionality to perform a remove() via the method removeComponent.
-
newInstance()
- Returns a new instance of the component.
-
removeComponent(Component, Component)
- Removes a child component from the component.
newInstance
public abstract Component newInstance()
- Returns a new instance of the component. For simple components this
could be: return new MyComponent(); For components that need to
do special initialisation (e.g.: JTabbedPane might automatically insert
a tab and a panel for convenience), return the component after
doing initialisation.
- Returns:
- a new instance of the component.
getContent
public abstract Container getContent(Component component)
- Returns a component to which layouts and other components can
be added. For simple components this would be: return component;
For more complex components, e.g. JFrame, it could be:
return component.getContentPane(); A return of null indicates
that the component can't be added to. For components with multiple
content places (e.g.: JTabbedPane) it should return the currently
visible content.
- Parameters:
- component - the component to find the content for.
- Returns:
- the container object for the component.
isAddProvided
public abstract boolean isAddProvided()
- Returns a boolean indicating whether this bean info provides the
functionality to perform an add() via the method addComponent.
This method is called when the user explicitely tries to add one component
to another. If true is returned, the addComponent method is
called, otherwise the add takes place through the normal (non-constraint
based) add() provided by the Container class.
- Returns:
- whether the addComponent method may be used.
addComponent
public abstract void addComponent(Component component,
Component child)
- Adds a child component to the component. For simple components this
can do nothing (in which case a normal add() will be used). For
complex components that, for example, have multiple content areas
(cf: JSplitPane), this method adds the child to the correct place
(and may have to pop up a dialogue to ask the user for the
information on this). This method is called when the user explicitely
adds one component to another. The method isAddProvided is
called first to see if this method should be used.
- Parameters:
- component - the component to add the child to.
- child - the component to add.
isRemoveProvided
public abstract boolean isRemoveProvided()
- Returns a boolean indicating whether this bean info provides the
functionality to perform a remove() via the method removeComponent.
This method is called when the user explicitely tries to remove a component
from another. If true is returned, the removeComponent method is
called, otherwise the remove takes place through the normal remove()
provided by the Container class.
- Returns:
- whether the removeComponent method may be used.
removeComponent
public abstract void removeComponent(Component component,
Component child)
- Removes a child component from the component. For nearly all components
this can do nothing (in which case a normal remove() will be used). For
complex components that require a special remove() or delete(), this
method should perform the removal. This method is called when the user
explicitely removes one component from another. The method
isRemoveProvided is called first to see if this method should be
used.
- Parameters:
- component - the component to remove the child from.
- child - the component to remove.
getDefaultLayout
public abstract LayoutManager getDefaultLayout()
- Returns the default Layout Manager for this component. In most cases
it will return the default Layout Manager for the content. For a
simple component e.g. JPanel, it could be:
return new JPanel().getLayout();
or return new FlowLayout();
It should only return the layout for a newly
created component of this type (essentially a dummy component). The
returned layout has the potential to be used by another component so it
should not already be in use (and hence attempting to manage more than
one component). If the component does not have a content then it
should return null.
- Returns:
- the default content Layout Manager for this type of component.
getChildren
public abstract Component[] getChildren(Component component)
- Returns the children of this component (i.e.: those children
that can be editted and are managed by this component). For
simple components (containers) it could be:
container.getComponents();
For more complex components (e.g.: JTabbedPane) it should return
all managed children. May return null.
- Parameters:
- component - the component to find the children for.
- Returns:
- an array of child components.
getVisibleChildren
public abstract Component[] getVisibleChildren(Component component)
- Returns the currently visible children of this component. For
a simple component this could be: container.getComponents();
For more complex components (e.g.: JTabbedPane) it should return
the currently visible children (visible as in being potentially able
to be seen on the screen - which includes components with
isVisible() == false). This could be as simple as a call to:
getContent().getComponents(); May return null.
- Parameters:
- component - the component to find the visible children for.
- Returns:
- an array of visible child components.
getJavaConstructorString
public abstract String getJavaConstructorString(Component component)
- Returns a string that would create a new instance of the component when
compiled and run. A return value of null indicates that the Builder
should use its own code generation code to construct the component
constructor. The string should be of the form new myComponent().
- Parameters:
- component - the component to generate Java code for.
- Returns:
- a String representing a new instance of the component.
getJavaInitializationStrings
public abstract String[] getJavaInitializationStrings(Component component)
- Returns an array of strings that would regenerate the component
when compiled and run. A return value of null indicates that
the Builder should use its own code generation code to write out the
component. If you provide this for JForge, you may use the JForge Code
Generation API to generate code for child components and layouts.
Each line should be a valid Java code line (including an ending ";").
- Parameters:
- component - the component to generate Java code for.
- Returns:
- an array of Strings representing the component.
All Packages Class Hierarchy This Package Previous Next Index