Changeset 5626
- Timestamp:
- 09/24/08 16:36:58 (2 months ago)
- Location:
- trunk/SRC/org/openmicroscopy/shoola/agents/editor
- Files:
-
- 3 added
- 8 modified
-
IconManager.java (modified) (3 diffs)
-
browser/FieldPanel.java (modified) (7 diffs)
-
browser/FieldRenderer.java (modified) (1 diff)
-
browser/TreeOutlineCellRenderer.java (modified) (1 diff)
-
graphx/nuvola_encrypted16.png (added)
-
graphx/nuvola_encrypted_red16.png (added)
-
model/Field.java (modified) (3 diffs)
-
model/FieldNode.java (modified) (2 diffs)
-
model/IField.java (modified) (1 diff)
-
model/Lock.java (added)
-
model/TreeModelFactory.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/org/openmicroscopy/shoola/agents/editor/IconManager.java
r5625 r5626 231 231 public static int INDENT_LEFT = 54; 232 232 233 /** The <code>Template locked</code> icon. */ 234 public static int TEMPLATE_LOCK = 55; 235 236 /** The <code>Fully locked</code> icon. */ 237 public static int FULL_LOCK = 56; 238 233 239 234 240 /** … … 236 242 * Allows to correctly build arrays for direct indexing. 237 243 */ 238 private static int MAX_ID = 5 4;244 private static int MAX_ID = 56; 239 245 240 246 /** Paths of the icon files. */ … … 303 309 relPaths[INDENT_RIGHT] = "nuvola_indent_right16.png"; 304 310 relPaths[INDENT_LEFT] = "nuvola_indent_left16.png"; 311 relPaths[TEMPLATE_LOCK] = "nuvola_encrypted16.png"; 312 relPaths[FULL_LOCK] = "nuvola_encrypted_red16.png"; 305 313 } 306 314 -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/FieldPanel.java
r5596 r5626 59 59 import org.openmicroscopy.shoola.agents.editor.browser.paramUIs.TableEditor; 60 60 import org.openmicroscopy.shoola.agents.editor.model.Field; 61 import org.openmicroscopy.shoola.agents.editor.model.FieldNode; 61 62 import org.openmicroscopy.shoola.agents.editor.model.IAttributes; 62 63 import org.openmicroscopy.shoola.agents.editor.model.IField; 64 import org.openmicroscopy.shoola.agents.editor.model.Lock; 63 65 import org.openmicroscopy.shoola.agents.editor.model.params.IParam; 64 66 import org.openmicroscopy.shoola.agents.editor.uiComponents.CustomButton; … … 144 146 * Used eg. to set the selected field to this node with undo/redo 145 147 */ 146 private DefaultMutableTreeNodetreeNode;148 private FieldNode treeNode; 147 149 148 150 … … 233 235 nameLabel.setBackground(null); 234 236 nameLabel.setOpaque(false); 237 238 if (field.isFieldLocked()) { 239 Icon lockIcon = null; 240 Lock lock = field.getLock(); 241 switch (lock.getLockLevel()) { 242 case Lock.FULLY_LOCKED: 243 lockIcon = iconManager.getIcon(IconManager.FULL_LOCK); 244 break; 245 case Lock.TEMPLATE_LOCKED: 246 lockIcon = iconManager.getIcon(IconManager.TEMPLATE_LOCK); 247 break; 248 } 249 nameLabel.setIcon(lockIcon); 250 nameLabel.setToolTipText(lock.toString()); 251 } 235 252 236 253 // A description label displays description below the field. … … 438 455 String description = field.getAttribute( 439 456 Field.FIELD_DESCRIPTION); 440 boolean showDescription = 441 "true".equals(field.getDisplayAttribute("descVisible")); 457 boolean showDescription = treeNode.getDescriptionVisisibility(); 442 458 443 459 if ((description != null) && (description.trim().length() > 0)) { … … 573 589 this.field = field; 574 590 this.tree = tree; 575 this.treeNode = treeNode;591 this.treeNode = (FieldNode)treeNode; 576 592 this.controller = controller; 577 593 … … 674 690 } 675 691 692 /** 693 * Handles the actions of several buttons that could appear in 694 * this panel. 695 * 696 * @see ActionListener#actionPerformed(ActionEvent) 697 */ 676 698 public void actionPerformed(ActionEvent e) { 677 699 … … 682 704 683 705 else if (TOGGLE_DESCRIPTION_CMD.equals(cmd)) { 684 boolean visible = 685 "true".equals(field.getDisplayAttribute("descVisible")); 686 visible = ! visible; 687 field.setDisplayAttribute("descVisible", visible + ""); 706 treeNode.toggleDescriptionVisibility(); 688 707 refreshEditingOfPanel(); 689 708 } -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/FieldRenderer.java
r5590 r5626 101 101 IField field = (IField)object; 102 102 103 toolTipText = field.get DisplayAttribute(Field.TOOL_TIP_TEXT);103 toolTipText = field.getToolTipText(); 104 104 105 105 FieldPanel fieldPanel = new FieldPanel(field, tree, -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/browser/TreeOutlineCellRenderer.java
r5596 r5626 83 83 if (object instanceof IField) { 84 84 IField field = (IField)object; 85 toolTipText = field.get DisplayAttribute(Field.TOOL_TIP_TEXT);85 toolTipText = field.getToolTipText(); 86 86 87 87 if (field.getParamCount() < 1) { -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/Field.java
r5594 r5626 89 89 */ 90 90 private List<IParam> fieldParams; 91 92 /** 93 * A reference to a lock that may be applied to this field to prevent 94 * editing of some attributes or parameters. 95 */ 96 private Lock fieldLock; 91 97 92 98 /** … … 292 298 * @return see above. 293 299 */ 294 p rivateString getToolTipText()300 public String getToolTipText() 295 301 { 296 302 String desc = getAttribute(FIELD_DESCRIPTION); … … 313 319 return toolTipText; 314 320 } 321 322 /** 323 * Sets a lock on this field to prevent editing. 324 * @see #fieldLock 325 * 326 * @param lock 327 */ 328 public void setLock(Lock lock) 329 { 330 fieldLock = lock; 331 } 332 333 /** 334 * Returns this field's lock (or null if no lock). 335 * 336 * @return see above 337 */ 338 public Lock getLock() { return fieldLock; } 339 340 /** 341 * Implemented as specified by the {@link IField} interface. 342 * 343 * @see IField#isFieldLocked() 344 */ 345 public boolean isFieldLocked() { 346 if (fieldLock == null) return false; 347 348 return (! (fieldLock.getLockLevel() == Lock.NOT_LOCKED)); 349 } 315 350 } -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/FieldNode.java
r5594 r5626 46 46 */ 47 47 public class FieldNode 48 extends DefaultMutableTreeNode { 48 extends DefaultMutableTreeNode 49 { 49 50 50 private boolean nodeExpanded;51 private boolean descriptionVisible; 51 52 52 53 public FieldNode(IField newField) { … … 54 55 } 55 56 56 public void setExpanded(boolean expanded) { 57 nodeExpanded = expanded; 57 /** 58 * Sets the visibility of the the description. 59 * 60 * @param visible 61 */ 62 public void setDescriptionVisible(boolean visible) 63 { 64 descriptionVisible = visible; 58 65 } 59 66 67 /** 68 * Toggles the boolean {@link #descriptionVisible} and returns 69 * the new value. 70 * 71 * @return The new (toggled) value of {@link #descriptionVisible} 72 */ 73 public boolean toggleDescriptionVisibility() 74 { 75 descriptionVisible = !descriptionVisible; 76 77 return descriptionVisible; 78 } 79 80 /** 81 * Gets the boolean {@link #descriptionVisible} 82 * 83 * @return The value of {@link #descriptionVisible} 84 */ 85 public boolean getDescriptionVisisibility() 86 { 87 return descriptionVisible; 88 } 60 89 } -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/IField.java
r5594 r5626 95 95 */ 96 96 public boolean isFieldFilled(); 97 98 /**99 * UI classes may want to set display attributes that do not affect100 * the data (eg collapsed state, description visible).101 *102 * @param name The name of the display attribute.103 * @param value The new value of the attribute104 */105 public void setDisplayAttribute(String name, String value);106 107 97 108 98 /** 109 * UI classes may want to get display attributes that do not affect110 * t he data (eg collapsed state, description visible).99 * Returns a String containing the field description, plus the 100 * tool-tip-text from it's parameters. 111 101 * 112 * @param name The named attribute 113 * @return The value of the attribute 102 * @return see above. 114 103 */ 115 public String get DisplayAttribute(String name);104 public String getToolTipText(); 116 105 106 /** 107 * Returns true if the is a lock on this field. 108 * 109 * @return see above 110 */ 111 public boolean isFieldLocked(); 112 113 /** 114 * Returns this field's lock (or null if no lock). 115 * 116 * @return see above 117 */ 118 public Lock getLock(); 117 119 } -
trunk/SRC/org/openmicroscopy/shoola/agents/editor/model/TreeModelFactory.java
r5625 r5626 206 206 207 207 // Create a new field and set it's attributes. 208 IField field = new Field();208 Field field = new Field(); 209 209 210 210 field.setAttribute(Field.FIELD_NAME, fieldName); … … 212 212 field.setAttribute(Field.FIELD_URL, url); 213 213 field.setAttribute(Field.BACKGROUND_COLOUR, colour); 214 215 // Field lock 216 String lockLevel = allAttributes.get(DataFieldConstants.LOCK_LEVEL); 217 if (lockLevel != null) { 218 String userName = allAttributes.get 219 (DataFieldConstants.LOCKED_FIELD_USER_NAME); 220 int locking; 221 if (lockLevel.equals(DataFieldConstants.LOCKED_TEMPLATE)) { 222 locking = Lock.TEMPLATE_LOCKED; 223 } else { 224 locking = Lock.FULLY_LOCKED; 225 } 226 Lock lock = new Lock(locking, userName); 227 228 String utc = allAttributes.get(DataFieldConstants.LOCKED_FIELD_UTC); 229 lock.setTimeStamp(utc); 230 231 field.setLock(lock); 232 } 233 214 234 215 235 // Field will have 0 or 1 "parameters", depending on type
