@Override public ConvertedPlaceholderListItem convert( int index, ScreenPerspectiveWindow child ) { if( children == null ){ return null; } ConvertedPlaceholderListItem item = new ConvertedPlaceholderListItem(); item.putInt( "id", children.get( child.asDockable() ) ); item.putInt( "x", child.getX() ); item.putInt( "y", child.getY() ); item.putInt( "width", child.getWidth() ); item.putInt( "height", child.getHeight() ); item.putBoolean( "fullscreen", child.isFullscreen() ); Path placeholder = child.asDockable().getPlaceholder(); if( placeholder != null ){ item.putString( "placeholder", placeholder.toString() ); item.setPlaceholder( placeholder ); } return item; } });
@Override public ScreenPerspectiveWindow convert( ConvertedPlaceholderListItem item ){ if( children == null ){ return null; } int id = item.getInt( "id" ); PerspectiveDockable dockable = children.get( id ); if( dockable != null ){ ScreenPerspectiveWindow child = new ScreenPerspectiveWindow( dockable ); dockable.setParent( ScreenDockPerspective.this ); child.setX( item.getInt( "x" ) ); child.setY( item.getInt( "y" ) ); child.setWidth( item.getInt( "width" ) ); child.setHeight( item.getInt( "height" ) ); child.setFullscreen( item.getBoolean( "fullscreen" ) ); return child; } return null; } });
/** * Adds <code>dockable</code> at location <code>x/y</code> with size <code>width/height</code> to * this perspective. * @param dockable the element to add, not <code>null</code> * @param x the x-coordinate on the screen * @param y the y-coordinate on the screen * @param width the width of the window * @param height the height of the window * @param fullscreen whether <code>dockable</code> should be extended to fullscreen mode */ public void add( PerspectiveDockable dockable, int x, int y, int width, int height, boolean fullscreen ){ DockUtilities.ensureTreeValidity( this, dockable ); ScreenPerspectiveWindow child = new ScreenPerspectiveWindow( dockable ); dockable.setParent( this ); child.setX( x ); child.setY( y ); child.setWidth( width ); child.setHeight( height ); child.setFullscreen( fullscreen ); dockables.dockables().add( child ); }
@Override public ScreenPerspectiveWindow convert( ConvertedPlaceholderListItem item ){ if( children == null ){ return null; } int id = item.getInt( "id" ); PerspectiveDockable dockable = children.get( id ); if( dockable != null ){ ScreenPerspectiveWindow child = new ScreenPerspectiveWindow( dockable ); dockable.setParent( ScreenDockPerspective.this ); child.setX( item.getInt( "x" ) ); child.setY( item.getInt( "y" ) ); child.setWidth( item.getInt( "width" ) ); child.setHeight( item.getInt( "height" ) ); child.setFullscreen( item.getBoolean( "fullscreen" ) ); return child; } return null; } });
@Override public ConvertedPlaceholderListItem convert( int index, ScreenPerspectiveWindow child ) { if( children == null ){ return null; } ConvertedPlaceholderListItem item = new ConvertedPlaceholderListItem(); item.putInt( "id", children.get( child.asDockable() ) ); item.putInt( "x", child.getX() ); item.putInt( "y", child.getY() ); item.putInt( "width", child.getWidth() ); item.putInt( "height", child.getHeight() ); item.putBoolean( "fullscreen", child.isFullscreen() ); Path placeholder = child.asDockable().getPlaceholder(); if( placeholder != null ){ item.putString( "placeholder", placeholder.toString() ); item.setPlaceholder( placeholder ); } return item; } });
/** * Adds a placeholder for <code>dockable</code> and all its children to this * station. * @param dockable the element whose placeholder should be inserted * @param x the x-coordinate on the screen * @param y the y-coordinate on the screen * @param width the width of the window * @param height the height of the window */ public void addPlaceholder( PerspectiveDockable dockable, int x, int y, int width, int height ){ ScreenPerspectiveWindow child = new ScreenPerspectiveWindow( dockable ); child.setX( x ); child.setY( y ); child.setWidth( width ); child.setHeight( height ); child.setFullscreen( false ); dockables.dockables().add( child ); remove( dockable ); }
/** * Adds <code>dockable</code> at location <code>x/y</code> with size <code>width/height</code> to * this perspective. * @param dockable the element to add, not <code>null</code> * @param x the x-coordinate on the screen * @param y the y-coordinate on the screen * @param width the width of the window * @param height the height of the window * @param fullscreen whether <code>dockable</code> should be extended to fullscreen mode */ public void add( PerspectiveDockable dockable, int x, int y, int width, int height, boolean fullscreen ){ DockUtilities.ensureTreeValidity( this, dockable ); ScreenPerspectiveWindow child = new ScreenPerspectiveWindow( dockable ); dockable.setParent( this ); child.setX( x ); child.setY( y ); child.setWidth( width ); child.setHeight( height ); child.setFullscreen( fullscreen ); dockables.dockables().add( child ); }
/** * Gets the index of <code>dockable</code>. * @param dockable some child of this station * @return the index or -1 if <code>dockable</code> was not found */ public int indexOf( PerspectiveDockable dockable ){ int count = 0; for( ScreenPerspectiveWindow child : dockables.dockables() ){ if( child.asDockable() == dockable ){ return count; } count++; } return -1; }
/** * Gets the index of <code>dockable</code>. * @param dockable some child of this station * @return the index or -1 if <code>dockable</code> was not found */ public int indexOf( PerspectiveDockable dockable ){ int count = 0; for( ScreenPerspectiveWindow child : dockables.dockables() ){ if( child.asDockable() == dockable ){ return count; } count++; } return -1; }
/** * Removes the <code>index</code>'th element of this station. * @param index the index of the element to remove * @return the removed element */ public PerspectiveDockable remove( int index ){ PlaceholderMetaMap map = dockables.dockables().getMetaMap( index ); ScreenPerspectiveWindow child = dockables.dockables().get( index ); map.putInt( "x", child.getX() ); map.putInt( "y", child.getY() ); map.putInt( "width", child.getWidth() ); map.putInt( "height", child.getHeight() ); dockables.remove( child ); child.dockable.setParent( null ); return child.dockable; }
/** * Removes the <code>index</code>'th element of this station. * @param index the index of the element to remove * @return the removed element */ public PerspectiveDockable remove( int index ){ PlaceholderMetaMap map = dockables.dockables().getMetaMap( index ); ScreenPerspectiveWindow child = dockables.dockables().get( index ); map.putInt( "x", child.getX() ); map.putInt( "y", child.getY() ); map.putInt( "width", child.getWidth() ); map.putInt( "height", child.getHeight() ); dockables.remove( child ); child.dockable.setParent( null ); return child.dockable; }
/** * Adds a placeholder for <code>dockable</code> and all its children to this * station. * @param dockable the element whose placeholder should be inserted * @param x the x-coordinate on the screen * @param y the y-coordinate on the screen * @param width the width of the window * @param height the height of the window */ public void addPlaceholder( PerspectiveDockable dockable, int x, int y, int width, int height ){ ScreenPerspectiveWindow child = new ScreenPerspectiveWindow( dockable ); child.setX( x ); child.setY( y ); child.setWidth( width ); child.setHeight( height ); child.setFullscreen( false ); dockables.dockables().add( child ); remove( dockable ); }
public PerspectiveDockable getDockable( int index ){ return dockables.dockables().get( index ).asDockable(); }
public PerspectiveDockable getDockable( int index ){ return dockables.dockables().get( index ).asDockable(); }
/** * Gets access to the window that shows <code>dockable</code> * @param dockable the element whose window is requested * @return the window or <code>null</code> if <code>dockable</code> was not found */ public ScreenPerspectiveWindow getWindow( PerspectiveDockable dockable ){ for( ScreenPerspectiveWindow child : dockables.dockables() ){ if( child.asDockable() == dockable ){ return child; } } return null; }
/** * Gets access to the window that shows <code>dockable</code> * @param dockable the element whose window is requested * @return the window or <code>null</code> if <code>dockable</code> was not found */ public ScreenPerspectiveWindow getWindow( PerspectiveDockable dockable ){ for( ScreenPerspectiveWindow child : dockables.dockables() ){ if( child.asDockable() == dockable ){ return child; } } return null; }
public DockableProperty getDockableProperty( PerspectiveDockable child, PerspectiveDockable target ){ ScreenPerspectiveWindow window = getWindow( child ); if( window == null ){ throw new IllegalArgumentException( "child is not a child of this station" ); } Path placeholder = null; if( target != null ){ placeholder = target.getPlaceholder(); } else{ placeholder = child.getPlaceholder(); } return new ScreenDockProperty( window.getX(), window.getY(), window.getWidth(), window.getHeight(), placeholder, window.isFullscreen() ); }
public DockableProperty getDockableProperty( PerspectiveDockable child, PerspectiveDockable target ){ ScreenPerspectiveWindow window = getWindow( child ); if( window == null ){ throw new IllegalArgumentException( "child is not a child of this station" ); } Path placeholder = null; if( target != null ){ placeholder = target.getPlaceholder(); } else{ placeholder = child.getPlaceholder(); } return new ScreenDockProperty( window.getX(), window.getY(), window.getWidth(), window.getHeight(), placeholder, window.isFullscreen() ); }
public boolean isChild( PerspectiveDockable dockable ){ if( dockable.getParent() == intern() ){ return delegate.getWindow( dockable ).isFullscreen(); } return false; }
public boolean isChild( PerspectiveDockable dockable ){ if( dockable.getParent() == intern() ){ return delegate.getWindow( dockable ).isFullscreen(); } return false; }