1 19 20 21 package org.netbeans.core.windows.model; 22 23 import java.util.HashMap ; 24 import java.util.Map ; 25 import org.netbeans.core.windows.ModeImpl; 26 import org.netbeans.core.windows.SplitConstraint; 27 import org.openide.windows.TopComponent; 28 29 38 final class TopComponentContextSubModel { 39 40 private static final class Context { 41 ModeImpl mode; 43 int index = -1; 45 SplitConstraint[] constraints; 46 } 48 50 private final Map <String , Context> tcID2Contexts = new HashMap <String , Context> (10); 51 52 public TopComponentContextSubModel() { 53 } 54 55 public void setTopComponentPreviousConstraints(String tcID, SplitConstraint[] constraints) { 56 Context context = tcID2Contexts.get(tcID); 57 if (context == null) { 58 context = new Context(); 59 tcID2Contexts.put(tcID, context); 60 } 61 context.constraints = constraints; 62 } 63 64 public void setTopComponentPreviousMode(String tcID, ModeImpl mode, int index) { 65 Context context = tcID2Contexts.get(tcID); 66 if (context == null) { 67 context = new Context(); 68 tcID2Contexts.put(tcID, context); 69 } 70 context.mode = mode; 71 context.index = index; 72 } 73 74 public SplitConstraint[] getTopComponentPreviousConstraints(String tcID) { 75 Context context = tcID2Contexts.get(tcID); 76 return context == null ? null : context.constraints; 77 } 78 79 public ModeImpl getTopComponentPreviousMode(String tcID) { 80 Context context = tcID2Contexts.get(tcID); 81 return context == null ? null : context.mode; 82 } 83 84 public int getTopComponentPreviousIndex(String tcID) { 85 Context context = tcID2Contexts.get(tcID); 86 return context == null ? -1 : context.index; 87 } 88 } 89 | Popular Tags |