- Timestamp:
- 07/12/13 23:41:06 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
java/main/src/main/java/com/framsticks/gui/ObjectPanel.java
r99 r100 1 1 package com.framsticks.gui; 2 2 3 import com.framsticks.core.Path; 3 4 import com.framsticks.gui.controls.Control; 4 5 import com.framsticks.gui.controls.ControlOwner; 5 6 import com.framsticks.gui.controls.ValueControl; 6 7 import com.framsticks.gui.controls.ValueControlListener; 7 import com.framsticks.params.Access Interface;8 import com.framsticks.params.Access; 8 9 import com.framsticks.params.Param; 9 10 import com.framsticks.params.ValueParam; 10 11 11 import org.apache.log4j.Logger; 12 import org.apache.logging.log4j.Logger; 13 import org.apache.logging.log4j.LogManager; 12 14 13 15 import javax.swing.*; 14 import javax.swing.tree.TreePath;15 16 16 17 import java.util.Collection; … … 24 25 public class ObjectPanel extends ModifiablePanel implements ControlOwner { 25 26 26 private static final Logger log = Log ger.getLogger(ObjectPanel.class);27 private static final Logger log = LogManager.getLogger(ObjectPanel.class); 27 28 28 29 final protected Map<Param, Control> components = new IdentityHashMap<Param, Control>(); … … 32 33 protected final JScrollPane scrollPane; 33 34 34 public ObjectPanel( Panel.Parameters parameters, Collection<Param> params) {35 public ObjectPanel(TreePanel.Parameters parameters, Collection<Param> params) { 35 36 super(parameters); 36 37 … … 49 50 @Override 50 51 public boolean onChange(Object newValue) { 51 if (current TreePath == null) {52 if (currentPath == null) { 52 53 return true; 53 54 } 54 boolean result = treeAtFrame.changeValue(current TreePath, c, newValue);55 boolean result = treeAtFrame.changeValue(currentPath.assureResolved().getTopObject(), c, newValue); 55 56 refreshControlButtons(); 56 57 return result; … … 66 67 protected void applyChanges() { 67 68 assert frame.isActive(); 68 assert current TreePath != null;69 treeAtFrame.pushLocalChanges(current TreePath);69 assert currentPath != null; 70 treeAtFrame.pushLocalChanges(currentPath); 70 71 } 71 72 72 73 protected void refreshControlButtons() { 73 74 assert frame.isActive(); 74 applyButton.setEnabled(treeAtFrame.hasLocalChanges(currentTreePath)); 75 } 76 77 protected static void fillControlsWithValues(Map<ValueControl, Object> map) { 75 applyButton.setEnabled(treeAtFrame.hasLocalChanges(currentPath.getTopObject())); 78 76 } 79 77 80 78 @Override 81 public void pullValuesFromLocalToUser(Access Interfaceaccess) {82 assert current TreePath != null;79 public void pullValuesFromLocalToUser(Access access) { 80 assert currentPath != null; 83 81 log.debug("refreshing components"); 84 82 … … 89 87 90 88 91 NodeAtFrame nodeAtFrame = treeAtFrame.getLocalInfo(current TreePath);89 NodeAtFrame nodeAtFrame = treeAtFrame.getLocalInfo(currentPath.getTopObject()); 92 90 if (nodeAtFrame != null) { 93 91 for (Map.Entry<ValueControl, Object> e : nodeAtFrame.localChanges.entrySet()) { … … 120 118 121 119 @Override 122 public TreePath getCurrentTreePath() {123 return super.getCurrent TreePath();120 public Path getCurrentPath() { 121 return super.getCurrentPath(); 124 122 } 125 123 126 127 124 }
Note: See TracChangeset
for help on using the changeset viewer.