|
EchoPoint API - 3.0.0b5 App Webcontainer |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnextapp.echo.app.Component
echopoint.internal.AbstractContainer
echopoint.TagCloud
public class TagCloud
A tag cloud component
based on client-side code contribued by Tod. Please note that the tag
model objects specified for this component should have a unique name
property. This component supports the
following style properties in addition to those defined in Component:
rolloverEnabled - A flag used to indicate that the tag
components should support change of style on mouse rollover.rolloverBackground - The colour to use as the background
of the tag element over which the mouse hovers.rolloverForeground - The colour to use for the title
of the tag element over which the mouse hovers.Note: There is a bug in how updates to the tags properties are
handled by the update manager at present. For the time-being, please
remove and re-add the tag cloud to its parent if the tags have been
updated during an event cycle (see TagCloudTest for example).
The following shows sample usage of this component:
import echopoint.TagCloud;
import echopoint.event.TagEvent;
import echopoint.model.Tag;
import nextapp.echo.app.Row;
...
final Collection<Tag> tags = new LinkedHashSet<Tag>();
tags.add( new Tag( "Java", 50 ) );
tags.add( new Tag( "Objective-C", 25 ) );
tags.add( new Tag( "Groovy", 10 ) );
tags.add( new Tag( "JavaScript", 15 ) );
final Row row = new Row();
final TagCloud tc = new TagCloud();
tc.setRolloverEnabled( true );
tc.setRolloverBackground( new Color( 0xa1a1a1 ) );
tc.setRolloverForeground( new Color( 0xc1c1c1 ) );
tc.setTags( tags );
row.add( tc );
tc.addActionListener( new ActionListener()
{
public void actionPerformed( final ActionEvent event )
{
final TagEvent te = (TagEvent) event;
if ( te.getTag() != null )
{
final Component content = Application.getContent().getTestArea();
content.add( new Label( "Clicked Tag: " + te.getTag().getName() ) );
}
}
});
| Field Summary | |
|---|---|
static String |
PROPERTY_ROLLOVER_BACKGROUND
The rollover background for the tag element. |
static String |
PROPERTY_ROLLOVER_ENABLED
A flag indicating whether rollover is enabled for a tag. |
static String |
PROPERTY_ROLLOVER_FOREGROUND
The rollover foreground for the tag element. |
static String |
PROPERTY_TAGS
The collection of Tag instances to be
represented in the component. |
| Fields inherited from class echopoint.internal.AbstractContainer |
|---|
ACTION_COMMAND_PROPERTY, ACTION_LISTENERS_CHANGED_PROPERTY, INPUT_ACTION, PROPERTY_ALIGNMENT, PROPERTY_BACKGROUND_IMAGE, PROPERTY_BORDER, PROPERTY_HEIGHT, PROPERTY_INSETS, PROPERTY_WIDTH |
| Constructor Summary | |
|---|---|
TagCloud()
|
|
| Method Summary | |
|---|---|
void |
addActionListener(ActionListener listener)
Add the specified action listener to this component. |
protected Collection<Tag> |
getData()
Return the collection of tags that represent the model for this component. |
Color |
getRolloverBackground()
Return the value of the PROPERTY_ROLLOVER_BACKGROUND property. |
boolean |
getRolloverEnabled()
Return the value of the PROPERTY_ROLLOVER_ENABLED property. |
Color |
getRolloverForeground()
Return the value of the PROPERTY_ROLLOVER_BACKGROUND property. |
Tag |
getTag(String name)
Return the tag identified by its name. |
Collection<Tag> |
getTags()
Return the value of the PROPERTY_TAGS property. |
boolean |
hasActionListeners()
Determines if the button has any ActionListeners registered. |
boolean |
isValidChild(Component child)
TagCloud is NOT allowed to have any children. |
void |
processInput(String name,
Object value)
|
void |
removeActionListener(ActionListener listener)
Remove the specified action listener from the component. |
void |
setRolloverBackground(Color background)
Set the value of the PROPERTY_ROLLOVER_BACKGROUND property. |
void |
setRolloverEnabled(boolean enabled)
Set the value of the PROPERTY_ROLLOVER_ENABLED property. |
void |
setRolloverForeground(Color foreground)
Set the value of the PROPERTY_ROLLOVER_BACKGROUND property. |
void |
setTags(Collection<Tag> tags)
Set the value of the PROPERTY_TAGS property. |
| Methods inherited from class echopoint.internal.AbstractContainer |
|---|
fireActionPerformed, getAlignment, getBackgroundImage, getBorder, getHeight, getInsets, getWidth, setAlignment, setBackgroundImage, setBorder, setHeight, setInsets, setWidth |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PROPERTY_ROLLOVER_ENABLED
public static final String PROPERTY_ROLLOVER_BACKGROUND
public static final String PROPERTY_ROLLOVER_FOREGROUND
public static final String PROPERTY_TAGS
Tag instances to be
represented in the component.
| Constructor Detail |
|---|
public TagCloud()
| Method Detail |
|---|
public boolean isValidChild(Component child)
isValidChild in class ComponentComponent.isValidChild(nextapp.echo.app.Component)public boolean getRolloverEnabled()
PROPERTY_ROLLOVER_ENABLED property.
public void setRolloverEnabled(boolean enabled)
PROPERTY_ROLLOVER_ENABLED property.
enabled - The flag indicating whether rollover behaviour is to be
enabled or not.public Color getRolloverBackground()
PROPERTY_ROLLOVER_BACKGROUND property.
public void setRolloverBackground(Color background)
PROPERTY_ROLLOVER_BACKGROUND property.
background - The colour used as the background while rolling over.public Color getRolloverForeground()
PROPERTY_ROLLOVER_BACKGROUND property.
public void setRolloverForeground(Color foreground)
PROPERTY_ROLLOVER_BACKGROUND property.
foreground - The colour used as the foreground while rolling over.public Collection<Tag> getTags()
PROPERTY_TAGS property.
protected Collection<Tag> getData()
public Tag getTag(String name)
name - The unique name for the tag.
null if no such tag exists.public void setTags(Collection<Tag> tags)
PROPERTY_TAGS property. Note that there
is not way to individually add/delete tag instances other than setting
a new collection (or a modified version of the original collection you
used to set the property).
tags - The collection of tag instances to be represented in this
component. Please note that a Set implementation
is preferred since this implementation requires unique tag names.public void addActionListener(ActionListener listener)
addActionListener in class AbstractContainerlistener - The action listener to add.Component.firePropertyChange(String, Object, Object)public void removeActionListener(ActionListener listener)
removeActionListener in class AbstractContainerlistener - The listener that is to be removed.Component.firePropertyChange(String, Object, Object)public boolean hasActionListeners()
ActionListeners registered.
hasActionListeners in class AbstractContainer
public void processInput(String name,
Object value)
processInput in class Component
|
EchoPoint API - 3.0.0b5 App Webcontainer |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||