 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.treasurelist;
22 import java.awt.Color;
23 import java.awt.Component;
25 import javax.swing.BorderFactory;
26 import javax.swing.JTree;
27 import javax.swing.tree.DefaultMutableTreeNode;
28 import javax.swing.tree.DefaultTreeCellRenderer;
42 import org.jetbrains.annotations.NotNull;
79 private final DefaultMutableTreeNode
root;
93 setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
101 public void visit(@NotNull
final NoTreasureObj treasureObj) {
102 setForeground(Color.gray);
109 if (treasureObj.getName().equalsIgnoreCase(
"none")) {
111 setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
113 setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
117 if (treasureObj.getName().equalsIgnoreCase(
"none")) {
119 setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
121 setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0));
129 setForeground(Color.gray);
151 public Component
getTreeCellRendererComponent(
final JTree tree,
final Object value,
final boolean sel,
final boolean expanded,
final boolean leaf,
final int row,
final boolean hasFocus) {
152 super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
154 final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
156 setFont(getFont().deriveFont(Font.PLAIN));
158 setForeground(Color.gray);
164 if (node.getParent() ==
root) {
166 setFont(getFont().deriveFont(Font.BOLD));
171 setFont(getFont().deriveFont(Font.BOLD));
Interface for visitors of TreasureObj instances.
static final long serialVersionUID
Serial Version UID.
R getArchetype(@NotNull String archetypeName)
Returns an Archetype by its name.
Subclass: Nodes in the CFTreasureListTree.
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for looking up faces.
Base package of all Gridarta classes.
final TreasureObjVisitor treasureObjVisitor
The TreasureObjVisitor for setting rendering parameters.
Exception thrown if an Archetype does not exist.
A TreasureObj representing a "treasure" entry.
final DefaultMutableTreeNode root
The root node.
Subclass: UserObject (= content object) for nodes in the CFTreasureListTree These can be either treas...
Provider for faces of GameObjects and Archetypes.
This cell renderer is responsible for drawing the treasure-object cells in the JTree.
A TreasureObj representing a "yes" entry.
static final String TREASURE_LIST
static final String TREASURE_YES
A TreasureObj representing an "arch" entry.
A TreasureObj representing a "no" entry.
final ArchetypeSet<?, ?, ?> archetypeSet
The ArchetypeSet.
Interface that captures similarities between different ArchetypeSet implementations.
public< G extends GameObject< G, A, R >, A extends MapArchObject< A >, R extends Archetype< G, A, R > > ImageIcon getFace(@NotNull final BaseObject< G, A, R, ?> baseObject)
Returns the face of a BaseObject as an ImageIcon.
Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus)
ImageIcon getResourceIcon(@NotNull final String iconName)
Returns the image icon for the given icon name.
final ResourceIcons resourceIcons
The ResourceIcons for creating icons.
static final String TREASUREONE_LIST
static final String TREASURE_NO
Type of TreasureListTreasureObj instances.
The face is the appearance of an object.
TreasureObj getTreasureObj()
A TreasureObj representing a folder.
Creates ImageIcon instances from resources.
abstract void visit(@NotNull TreasureObjVisitor visitor)
Calls the TreasureObjVisitor callback function appropriate for this instance.
TreasureCellRenderer(@NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final DefaultMutableTreeNode root, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final ResourceIcons resourceIcons)
Creates a new instance: loads icons and initializes fonts.
static final String SQUARE_NO_ARCH