1 19 20 package org.netbeans.core.windows.model; 21 22 import java.util.ArrayList ; 23 import java.util.Iterator ; 24 import java.util.List ; 25 import java.util.Set ; 26 import org.netbeans.core.windows.Constants; 27 import org.netbeans.core.windows.ModeImpl; 28 29 35 public class DockingStatus { 36 37 protected Model model; 38 protected List <String > docked = new ArrayList <String >(10); 39 protected List <String > slided = new ArrayList <String >(10); 40 41 42 DockingStatus( Model model ) { 43 this.model = model; 44 } 45 46 49 public void mark() { 50 Set <ModeImpl> modes = model.getModes(); 51 for( Iterator <ModeImpl> i=modes.iterator(); i.hasNext(); ) { 52 ModeImpl modeImpl = i.next(); 53 if( modeImpl.getState() == Constants.MODE_STATE_SEPARATED ) 54 continue; 55 56 List <String > views = model.getModeOpenedTopComponentsIDs( modeImpl ); 57 if( modeImpl.getKind() == Constants.MODE_KIND_VIEW ) { 58 docked.addAll( views ); 59 slided.removeAll( views ); 60 } else if( modeImpl.getKind() == Constants.MODE_KIND_SLIDING ) { 61 docked.removeAll( views ); 62 slided.addAll( views ); 63 } 64 } 65 } 66 67 71 public boolean shouldDock( String tcID ) { 72 return null != tcID && docked.contains( tcID ); 73 } 74 75 79 public boolean shouldSlide( String tcID ) { 80 return null != tcID && (slided.contains( tcID ) 81 || (!slided.contains( tcID ) && !docked.contains( tcID ))); 83 } 84 85 88 public void addDocked( String tcID ) { 89 if( null != tcID ) { 90 docked.add( tcID ); 91 slided.remove( tcID ); 92 } 93 } 94 95 98 public void addSlided( String tcID ) { 99 if( null != tcID ) { 100 slided.add( tcID ); 101 docked.remove( tcID ); 102 } 103 } 104 105 109 public boolean isDocked( String tcID ) { 110 return null != tcID && docked.contains( tcID ); 111 } 112 113 117 public boolean isSlided( String tcID ) { 118 return null != tcID && slided.contains( tcID ); 119 } 120 121 124 void clear() { 125 docked.clear(); 126 slided.clear(); 127 } 128 } 129 | Popular Tags |