/** * Gets the global identifier for the panel in the center. * @return the identifier */ public String getCenterIdentifier(){ return getCenterIdentifier( uniqueId ); }
/** * Gets the global identifier for the panel in the center. * @return the identifier */ public String getCenterIdentifier(){ return getCenterIdentifier( uniqueId ); }
@Override public String findRoot() { CContentArea area = base.getContentArea(); if( area == null ) return CContentArea.getCenterIdentifier( CControl.CONTENT_AREA_STATIONS_ID ); else return area.getCenterIdentifier(); }
@Override public String findRoot() { CContentArea area = base.getContentArea(); if( area == null ) return CContentArea.getCenterIdentifier( CControl.CONTENT_AREA_STATIONS_ID ); else return area.getCenterIdentifier(); }
/** * Gets the station that is shown in the middle of the content-area. * @return the center */ public CGridPerspective getCenter(){ return (CGridPerspective)perspective.getStation( CContentArea.getCenterIdentifier( id )); }
/** * Gets the station that is shown in the middle of the content-area. * @return the center */ public CGridPerspective getCenter(){ return (CGridPerspective)perspective.getStation( CContentArea.getCenterIdentifier( id )); }
/** * Creates a location representing the maximized mode on <code>area</code>. It is the clients * responsibility to ensure that <code>area</code> actually allows maximization. * @param area the area on which an element will be maximized * @return the new maximization location */ public static CMaximizedLocation maximized( CContentArea area ){ return new CMaximizedLocation( area.getCenterIdentifier() ); }
/** * Creates a location representing the maximized mode on <code>area</code>. It is the clients * responsibility to ensure that <code>area</code> actually allows maximization. * @param area the area on which an element will be maximized * @return the new maximization location */ public static CMaximizedLocation maximized( CContentArea area ){ return new CMaximizedLocation( area.getCenterIdentifier() ); }
/** * Ensures the uniqueness of the identifier <code>uniqueId</code>. Throws * various exceptions if the id is not unique. * @param uniqueId the id that might be unique * @param adding the station that is about to be added */ private void checkStationIdentifierUniqueness( String uniqueId, CStation<?> adding ){ if( uniqueId == null ) throw new NullPointerException( "uniqueId must not be null" ); if( CContentArea.getCenterIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getEastIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getWestIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getSouthIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getNorthIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); for( CStation<?> station : stations ){ if( station.getUniqueId().equals( uniqueId )){ if( station == adding ){ throw new IllegalArgumentException( "The station has already been registered" ); } throw new IllegalArgumentException( "There exists already a station with id: " + uniqueId ); } } }
/** * Ensures the uniqueness of the identifier <code>uniqueId</code>. Throws * various exceptions if the id is not unique. * @param uniqueId the id that might be unique * @param adding the station that is about to be added */ private void checkStationIdentifierUniqueness( String uniqueId, CStation<?> adding ){ if( uniqueId == null ) throw new NullPointerException( "uniqueId must not be null" ); if( CContentArea.getCenterIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getEastIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getWestIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getSouthIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); if( CContentArea.getNorthIdentifier( CControl.CONTENT_AREA_STATIONS_ID ).equals( uniqueId ) ) throw new IllegalArgumentException( "The id " + uniqueId + " is reserved for special purposes" ); for( CStation<?> station : stations ){ if( station.getUniqueId().equals( uniqueId )){ if( station == adding ){ throw new IllegalArgumentException( "The station has already been registered" ); } throw new IllegalArgumentException( "There exists already a station with id: " + uniqueId ); } } }
this.id = id; String center = CContentArea.getCenterIdentifier( id ); String north = CContentArea.getNorthIdentifier( id ); String south = CContentArea.getSouthIdentifier( id );
this.id = id; String center = CContentArea.getCenterIdentifier( id ); String north = CContentArea.getNorthIdentifier( id ); String south = CContentArea.getSouthIdentifier( id );
/** * Creates a new content area. * @param control the control for which this area will be used * @param uniqueId a unique identifier of this center */ public CContentArea( CControl control, String uniqueId ){ this.control = control; this.uniqueId = uniqueId; CBaseLocation base = new CBaseLocation( this ); center = new CenterStation( getCenterIdentifier(), base.normal() ); north = new MinimizeStation( getNorthIdentifier(), new CMinimizedLocation( base, Side.NORTH ) ); south = new MinimizeStation( getSouthIdentifier(), new CMinimizedLocation( base, Side.SOUTH ) ); east = new MinimizeStation( getEastIdentifier(), new CMinimizedLocation( base, Side.EAST ) ); west = new MinimizeStation( getWestIdentifier(), new CMinimizedLocation( base, Side.WEST ) ); center.getStation().setExpandOnDoubleclick( false ); north.setDirection( Direction.SOUTH ); south.setDirection( Direction.NORTH ); east.setDirection( Direction.WEST ); west.setDirection( Direction.EAST ); setLayout( new BorderLayout() ); add( center.getStation(), BorderLayout.CENTER ); add( north, BorderLayout.NORTH ); add( south, BorderLayout.SOUTH ); add( east, BorderLayout.EAST ); add( west, BorderLayout.WEST ); stations = new CStation[]{ north, south, east, west, center }; }
/** * Creates a new content area. * @param control the control for which this area will be used * @param uniqueId a unique identifier of this center */ public CContentArea( CControl control, String uniqueId ){ this.control = control; this.uniqueId = uniqueId; CBaseLocation base = new CBaseLocation( this ); center = new CenterStation( getCenterIdentifier(), base.normal() ); north = new MinimizeStation( getNorthIdentifier(), new CMinimizedLocation( base, Side.NORTH ) ); south = new MinimizeStation( getSouthIdentifier(), new CMinimizedLocation( base, Side.SOUTH ) ); east = new MinimizeStation( getEastIdentifier(), new CMinimizedLocation( base, Side.EAST ) ); west = new MinimizeStation( getWestIdentifier(), new CMinimizedLocation( base, Side.WEST ) ); center.getStation().setExpandOnDoubleclick( false ); north.setDirection( Direction.SOUTH ); south.setDirection( Direction.NORTH ); east.setDirection( Direction.WEST ); west.setDirection( Direction.EAST ); setLayout( new BorderLayout() ); add( center.getStation(), BorderLayout.CENTER ); add( north, BorderLayout.NORTH ); add( south, BorderLayout.SOUTH ); add( east, BorderLayout.EAST ); add( west, BorderLayout.WEST ); stations = new CStation[]{ north, south, east, west, center }; }