@Override public boolean equals( Object obj ){ if( obj instanceof CLocation ){ CLocation that = (CLocation)obj; return equals( findRoot(), that.findRoot() ) && equals( findMode(), that.findMode() ) && equals( findProperty(), that.findProperty() ); } return false; }
/** * Tries to create a location that resembles <code>property</code>. * @param controller the controller in whose realm this method is called, may be used to load * extensions * @param property some location * @return a location whose {@link #findProperty()} would create * <code>property</code> again, or <code>null</code> in case that <code>property</code> * can't be used */ public final CLocation expandProperty( DockController controller, DockableProperty property ){ return expandProperty( property, new DefaultExpandStrategy( controller ) ); }
@Override public int hashCode(){ Object root = findRoot(); Object mode = findMode(); Object property = findProperty(); int result = 0; if( root != null ){ result = root.hashCode(); } result *= 31; if( mode != null ){ result += mode.hashCode(); } result *= 31; if( property != null ){ result += property.hashCode(); } return result; } }
private CFlapIndexLocation getMinimizedLocation(DockPosition position) { switch (position) { case CENTER: return CLocation.base().minimalSouth(); case EAST: return CLocation.base().minimalEast(); case NORTH: return CLocation.base().minimalNorth(); case SOUTH: return CLocation.base().minimalSouth(); case WEST: return CLocation.base().minimalWest(); default: throw new IllegalArgumentException(); } }
/** * Gets a path describing this location in terms of the * DockingFrames. The method is ignoring any children of this location. * @return the path to this location or <code>null</code> */ public DockableProperty findProperty(){ return findProperty( null ); }
@Override public ExtendedMode findMode(){ if( parent != null ){ return parent.findMode(); } return ExtendedMode.EXTERNALIZED; }
@Override public String findRoot(){ if( parent != null ){ return parent.findRoot(); } return CControl.EXTERNALIZED_STATION_ID; }
@SuppressWarnings("deprecation") private CLocation getDefaultLocation(Map<String,CLocation> lastToolBarLocation, String logicalGroupId) { CLocation defaultLocation = lastToolBarLocation.get(logicalGroupId); if(defaultLocation==null) { defaultLocation = area.getNorthToolbar().getStationLocation().group(createdToolbars++).toolbar(0,0).item(0); } else { // Aside is deprecated but It has to be used if the ToolBarItem is new. defaultLocation = defaultLocation.aside(); } return defaultLocation; } /**
/** * Creates a new event. * @param dockable the source of the event * @param oldShowing the old visibility state * @param newShowing the new visibility state * @param oldLocation the old location, may be <code>null</code> * @param newLocation the new location, may be <code>null</code> */ public CDockableLocationEvent( CDockable dockable, boolean oldShowing, boolean newShowing, CLocation oldLocation, CLocation newLocation ){ this.dockable = dockable; this.oldShowing = oldShowing; this.newShowing = newShowing; this.oldLocation = oldLocation; this.newLocation = newLocation; if( oldLocation == null && newLocation != null ){ locationChanged = true; } else if( oldLocation != null && !oldLocation.equals( newLocation )){ locationChanged = true; } }
@Override public int hashCode(){ Object root = findRoot(); Object mode = findMode(); Object property = findProperty(); int result = 0; if( root != null ){ result = root.hashCode(); } result *= 31; if( mode != null ){ result += mode.hashCode(); } result *= 31; if( property != null ){ result += property.hashCode(); } return result; } }
/** * Fetch the ccontrol panel list to find the provided panelName * @param ccontrol * @param panelName * @return The panel location */ private static CLocation getPanelLocation(CControl ccontrol, String panelName) { SingleCDockable dockable = ccontrol.getSingleDockable(panelName); if(dockable!=null) { return dockable.getBaseLocation(); } MultipleCDockable mDockable = ccontrol.getMultipleDockable(panelName); if(mDockable!=null) { return mDockable.getBaseLocation(); } return CLocation.base(); } /**
/** * Gets a path describing this location in terms of the * DockingFrames. The method is ignoring any children of this location. * @return the path to this location or <code>null</code> */ public DockableProperty findProperty(){ return findProperty( null ); }
@Override public ExtendedMode findMode() { if( parent != null ){ return parent.findMode(); } return ExtendedMode.NORMALIZED; }
@Override public String findRoot(){ if( parent != null ){ return parent.findRoot(); } return null; }
private void setNextPosition(ToolBarItem item,ToolBarItem itemNext) { if(!item.isVisible()) { item.setVisible(true); } // itemNext.setLocationsAside(item); CLocation location = commonControl.getLocationManager().getLocation(item.intern()); if(location!=null) { itemNext.setLocation(location.aside()); itemNext.setVisible(true); } } /**
/** * Creates a new event. * @param dockable the source of the event * @param oldShowing the old visibility state * @param newShowing the new visibility state * @param oldLocation the old location, may be <code>null</code> * @param newLocation the new location, may be <code>null</code> */ public CDockableLocationEvent( CDockable dockable, boolean oldShowing, boolean newShowing, CLocation oldLocation, CLocation newLocation ){ this.dockable = dockable; this.oldShowing = oldShowing; this.newShowing = newShowing; this.oldLocation = oldLocation; this.newLocation = newLocation; if( oldLocation == null && newLocation != null ){ locationChanged = true; } else if( oldLocation != null && !oldLocation.equals( newLocation )){ locationChanged = true; } }
String root = location.findRoot(); if( root == null ) throw new IllegalArgumentException( "the location is not sufficient to find the root station" ); DockableProperty property = location.findProperty(); if( property == null ) throw new IllegalArgumentException( "the location does not carry enough information to find the location of dockable" ); ExtendedMode locationMode = location.findMode(); if( locationMode == null ){ throw new IllegalArgumentException( "the location does not carry enough information to find the mode of dockable" );
@Override public boolean equals( Object obj ){ if( obj instanceof CLocation ){ CLocation that = (CLocation)obj; return equals( findRoot(), that.findRoot() ) && equals( findMode(), that.findMode() ) && equals( findProperty(), that.findProperty() ); } return false; }
/** * Tries to create a location that resembles <code>property</code>. * @param controller the controller in whose realm this method is called, may be used to load * extensions * @param property some location * @return a location whose {@link #findProperty()} would create * <code>property</code> again, or <code>null</code> in case that <code>property</code> * can't be used */ public final CLocation expandProperty( DockController controller, DockableProperty property ){ return expandProperty( property, new DefaultExpandStrategy( controller ) ); }
UIManager.MAIN_AREA.setLocation(CLocation.base().normalRectangle(0, 0, 1, 1)); UIManager.MAIN_AREA.setVisible(true);