public ScreenDockStationLayout getLayout( ScreenDockStation station, Map<Dockable, Integer> children ) { return new ScreenDockStationLayout( station.getPlaceholders( children ) ); }
public void layoutPerspective( ScreenDockPerspective perspective, ScreenDockStationLayout layout, Map<Integer, PerspectiveDockable> children ){ perspective.read( layout.getPlaceholders(), children ); }
public void write( ScreenDockStationLayout layout, DataOutputStream out ) throws IOException { if( layout instanceof RetroScreenDockStationLayout ){ RetroScreenDockStationLayout retro = (RetroScreenDockStationLayout)layout; Version.write( out, Version.VERSION_1_0_4 ); out.writeInt( retro.size() ); for( int i = 0, n = retro.size(); i<n; i++ ){ out.writeInt( retro.id( i ) ); out.writeInt( retro.x( i ) ); out.writeInt( retro.y( i ) ); out.writeInt( retro.width( i ) ); out.writeInt( retro.height( i ) ); } } else{ PlaceholderMap map = layout.getPlaceholders(); Version.write( out, Version.VERSION_1_0_8 ); map.write( out ); } }
public ScreenDockStationLayout getPerspectiveLayout( ScreenDockPerspective element, Map<PerspectiveDockable, Integer> children ){ return new ScreenDockStationLayout( element.toMap( children ) ); }
public void setLayout( ScreenDockStation station, ScreenDockStationLayout layout, Map<Integer, Dockable> children, PlaceholderStrategy placeholders ) { for( int i = station.getDockableCount()-1; i >= 0; i-- ) station.removeDockable( i ); if( layout instanceof RetroScreenDockStationLayout ){ RetroScreenDockStationLayout retro = (RetroScreenDockStationLayout) layout; for( int i = 0, n = retro.size(); i<n; i++ ){ Dockable dockable = children.get( retro.id( i ) ); if( dockable != null ){ Rectangle location = new Rectangle( retro.x( i ), retro.y( i ), retro.width( i ), retro.height( i )); station.addDockable( dockable, location, true ); } } } else{ station.setPlaceholders( layout.getPlaceholders().filter( placeholders ), children ); } }
public ScreenDockStationLayout read( DataInputStream in, PlaceholderStrategy placeholders ) throws IOException{ Version version = Version.read( in ); version.checkCurrent(); boolean version8 = version.compareTo( Version.VERSION_1_0_8 ) >= 0; if( version8 ){ PlaceholderMap map = new PlaceholderMap( in, placeholders ); return new ScreenDockStationLayout( map ); } else{ RetroScreenDockStationLayout layout = new RetroScreenDockStationLayout(); int count = in.readInt(); for( int i = 0; i < count; i++ ){ int id = in.readInt(); int x = in.readInt(); int y = in.readInt(); int width = in.readInt(); int height = in.readInt(); layout.add( id, x, y, width, height ); } return layout; } }
public void write( ScreenDockStationLayout layout, XElement element ) { if( layout instanceof RetroScreenDockStationLayout ){ RetroScreenDockStationLayout retro = (RetroScreenDockStationLayout)layout; for( int i = 0, n = retro.size(); i<n; i++ ){ XElement child = element.addElement( "child" ); child.addInt( "id", retro.id( i ) ); child.addInt( "x", retro.x( i ) ); child.addInt( "y", retro.y( i ) ); child.addInt( "width", retro.width( i ) ); child.addInt( "height", retro.height( i ) ); } } else{ layout.getPlaceholders().write( element.addElement( "placeholders" ) ); } }
public ScreenDockStationLayout read( XElement element, PlaceholderStrategy placeholders ){ XElement xplaceholders = element.getElement( "placeholders" ); if( xplaceholders != null ){ return new ScreenDockStationLayout( new PlaceholderMap( xplaceholders, placeholders ) ); } else{ RetroScreenDockStationLayout layout = new RetroScreenDockStationLayout(); for( XElement child : element.getElements( "child" )){ layout.add( child.getInt( "id" ), child.getInt( "x" ), child.getInt( "y" ), child.getInt( "width" ), child.getInt( "height" ) ); } return layout; } }
DockablePlaceholderList.simulatedRead( layout.getPlaceholders(), new PlaceholderListItemAdapter<Dockable, PlaceholderListItem<Dockable>>() { @Override public PlaceholderListItem<Dockable> convert( ConvertedPlaceholderListItem item ) {