16 package net.squiz.matrix.matrixtree;
18 import net.squiz.matrix.core.*;
21 import javax.swing.tree.*;
22 import net.squiz.matrix.ui.*;
23 import java.awt.event.*;
24 import net.squiz.matrix.plaf.*;
44 private boolean selected =
false;
46 private boolean allSelected =
false;
48 public void flipSelection() {
49 allSelected = (allSelected) ?
false :
true;
73 node = (MatrixTreeNode) value;
77 setText(getNodeDisplayText(node));
80 if (!isNavNode(node)) {
81 setToolTipText(asset.getType().getName() +
" [" + asset.getId() +
"]");
82 this.selected = selected;
83 if (!(asset.isAccessible())) {
84 CompoundIcon icon = (CompoundIcon) GUIUtilities.getCompoundIconForTypeCode(
85 asset.getType().getTypeCode(), Matrix.getProperty(
"parameter.url.notaccessibleicon"), asset.getId());
87 setDisabledIcon(icon.getDisabledIcon());
88 }
else if (node.getLinkType() == LINK_TYPE_2) {
89 CompoundIcon icon = (CompoundIcon) GUIUtilities.getCompoundIconForTypeCode(
90 asset.getType().getTypeCode(), Matrix.getProperty(
"parameter.url.type2icon"), asset.getId());
92 setDisabledIcon(icon.getDisabledIcon());
94 setDisabledIcon(null);
95 if (asset.getType() != null)
96 setIcon(asset.getType().getIcon());
106 setToolTipText(Matrix.translate(
"asset_map_tooltip_next_node"));
107 setIcon(GUIUtilities.getAssetMapIcon(
"down_arrows.png"));
109 setToolTipText(Matrix.translate(
"asset_map_tooltip_previous_node"));
110 setIcon(GUIUtilities.getAssetMapIcon(
"up_arrows.png"));
115 if (!((
MatrixTree)tree).inCueMode() && ((ExpandingNode)node).usingCueModeName()) {
116 ((ExpandingNode)node).switchName();
117 ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
118 setText(((ExpandingNode)node).getAssetName());
121 setIcon(GUIUtilities.getAssetMapIcon(
"loading_node.png"));
124 }
else if (value instanceof DefaultMutableTreeNode) {
125 DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
126 if (node.getUserObject() instanceof String) {
127 setText((String) node.getUserObject());
143 protected String getNodeDisplayText(MatrixTreeNode node) {
144 if ((node instanceof ExpandingNode)) {
145 return ((ExpandingNode)node).getAssetName();
147 return node.getName() +
" ";
157 if (node instanceof ExpandingNode) {
158 ((ExpandingNode)node).setInitStrWidth(getWidth()+5);
159 int width = ((ExpandingNode)node).getInitStrWidth();
160 g.setColor(MatrixLookAndFeel.PANEL_COLOUR);
161 g.fillRoundRect(0, 0, width, getHeight(), 10, 10);
164 if ((selected || allSelected) && !isNavNode(node)) {
165 int offset = getIcon().getIconWidth() + (getIconTextGap() / 2);
166 if (selected && allSelected) {
167 g.setColor(asset.getStatusColour().darker());
169 g.setColor(asset.getStatusColour());
171 g.fillRect(offset, 2, getWidth(), getHeight() - 4);
172 g.setColor(asset.getStatusColour().darker());
173 g.drawRect(offset, 2, getWidth() - offset - 1, getHeight() - 4);
199 public void repaint(
long tm,
int x,
int y,
int width,
int height) {}
214 if (propertyName ==
"text") {
215 super.firePropertyChange(propertyName, oldValue, newValue);