/** * Gets the last successor in the property chain beginning at <code>property</code>. * @param property the start of the chain * @return the end of the chain */ public static DockableProperty getLastProperty( DockableProperty property ){ while( property.getSuccessor() != null ) property = property.getSuccessor(); return property; }
/** * Writes <code>property</code> and all its successors into <code>out</code>. * @param property the property to write * @param out a stream to write into * @throws IOException if the stream throws an exception */ public void write( DockableProperty property, DataOutputStream out ) throws IOException{ Version.write( out, Version.VERSION_1_0_4 ); int count = 0; DockableProperty successor = property; while( successor != null ) { count++; successor = successor.getSuccessor(); } out.writeInt( count ); while( property != null ) { out.writeUTF( property.getFactoryID() ); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); DataOutputStream datas = new DataOutputStream( bytes ); property.store( datas ); datas.close(); byte[] written = bytes.toByteArray(); out.writeInt( written.length ); out.write( written ); property = property.getSuccessor(); } }
/** * Writes <code>property</code> and all its successors into <code>out</code>. * @param property the property to write * @param out a stream to write into * @throws IOException if the stream throws an exception */ public void write( DockableProperty property, DataOutputStream out ) throws IOException{ Version.write( out, Version.VERSION_1_0_4 ); int count = 0; DockableProperty successor = property; while( successor != null ) { count++; successor = successor.getSuccessor(); } out.writeInt( count ); while( property != null ) { out.writeUTF( property.getFactoryID() ); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); DataOutputStream datas = new DataOutputStream( bytes ); property.store( datas ); datas.close(); byte[] written = bytes.toByteArray(); out.writeInt( written.length ); out.write( written ); property = property.getSuccessor(); } }
private DockableProperty answerLocation( AsideAnswer successor ){ if( successor == null || successor.getLocation() == null ){ return resultingLocation; } if( resultingLocation == null ){ return successor.getLocation(); } DockableProperty last = resultingLocation; while( last.getSuccessor() != null ){ last = last.getSuccessor(); } last.setSuccessor( successor.getLocation() ); return resultingLocation; }
private DockableProperty answerLocation( AsideAnswer successor ){ if( successor == null || successor.getLocation() == null ){ return resultingLocation; } if( resultingLocation == null ){ return successor.getLocation(); } DockableProperty last = resultingLocation; while( last.getSuccessor() != null ){ last = last.getSuccessor(); } last.setSuccessor( successor.getLocation() ); return resultingLocation; }
/** * Tries to create a location that resembles <code>property</code>. * @param property some location * @param strategy a strategy helping to convert the properties * @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 CLocation expandProperty( DockableProperty property, CLocationExpandStrategy strategy ){ CLocation location = strategy.expand( this, property ); if( location == null ){ return null; } property = property.getSuccessor(); if( property == null ){ return location; } return location.expandProperty( property, strategy ); }
/** * Tries to create a location that resembles <code>property</code>. * @param property some location * @param strategy a strategy helping to convert the properties * @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 CLocation expandProperty( DockableProperty property, CLocationExpandStrategy strategy ){ CLocation location = strategy.expand( this, property ); if( location == null ){ return null; } property = property.getSuccessor(); if( property == null ){ return location; } return location.expandProperty( property, strategy ); }
private DockableProperty copyAndSetStackLocation( DockableProperty property, int delta ){ if( property == null ){ return null; } property = property.copy(); DockableProperty last = property; while( last.getSuccessor() != null ){ last = last.getSuccessor(); } if( last instanceof StackDockProperty ){ ((StackDockProperty)last).setIndex( ((StackDockProperty)last).getIndex() + delta ); } else{ StackDockProperty stack = new StackDockProperty( delta ); last.setSuccessor( stack ); } return property; } }
public boolean equalsNoSuccessor( DockableProperty property ){ DockableProperty successor = this.successor; DockableProperty successorProperty = property.getSuccessor(); try{ this.successor = null; property.setSuccessor( null ); return equals( property ); } finally{ this.successor = successor; property.setSuccessor( successorProperty ); } }
private DockableProperty copyAndSetStackLocation( DockableProperty property, int delta ){ if( property == null ){ return null; } property = property.copy(); DockableProperty last = property; while( last.getSuccessor() != null ){ last = last.getSuccessor(); } if( last instanceof StackDockProperty ){ ((StackDockProperty)last).setIndex( ((StackDockProperty)last).getIndex() + delta ); } else{ StackDockProperty stack = new StackDockProperty( delta ); last.setSuccessor( stack ); } return property; } }
public DockableProperty getLocation( Dockable child ){ DockableProperty property = DockUtilities.getPropertyChain( getStation(), child ); SplitDockFullScreenProperty result = new SplitDockFullScreenProperty(); result.setSuccessor( property.getSuccessor() ); return result; }
public DockableProperty getLocation( Dockable child ){ DockableProperty property = DockUtilities.getPropertyChain( getStation(), child ); SplitDockFullScreenProperty result = new SplitDockFullScreenProperty(); result.setSuccessor( property.getSuccessor() ); return result; }
/** * Writes <code>property</code> and all its successors into * <code>element</code>. * @param property the property to write * @param element an xml element to which this method will add some children */ public void writeXML( DockableProperty property, XElement element ){ while( property != null ) { XElement xnode = element.addElement( "property" ); xnode.addString( "factory", property.getFactoryID() ); property.store( xnode ); property = property.getSuccessor(); } }
/** * Writes <code>property</code> and all its successors into * <code>element</code>. * @param property the property to write * @param element an xml element to which this method will add some children */ public void writeXML( DockableProperty property, XElement element ){ while( property != null ) { XElement xnode = element.addElement( "property" ); xnode.addString( "factory", property.getFactoryID() ); property.store( xnode ); property = property.getSuccessor(); } }
protected AsideAnswer forward( Forward forward ){ DockableProperty successor = null; if( location != null ){ successor = location.getSuccessor(); } DefaultAsideRequest request = createForwardRequest( successor ); request.setCurrent( forward ); request.setParentStation( current.getStation() ); successorAnswer = request.execute(); return successorAnswer; }
protected AsideAnswer forward( Forward forward ){ DockableProperty successor = null; if( location != null ){ successor = location.getSuccessor(); } DefaultAsideRequest request = createForwardRequest( successor ); request.setCurrent( forward ); request.setParentStation( current.getStation() ); successorAnswer = request.execute(); return successorAnswer; }
private CLocation getCLocation( DockableProperty property ){ CLocation stationLocation = station.getStationLocation(); CMaximizedLocation result = new CMaximizedLocation( stationLocation.findRoot() ); if( property != null ){ property = property.getSuccessor(); } if( property != null ){ return result.expandProperty( station.getStation().getController(), property ); } else{ return result; } } }
private CLocation getCLocation( DockableProperty property ){ CLocation stationLocation = station.getStationLocation(); CMaximizedLocation result = new CMaximizedLocation( stationLocation.findRoot() ); if( property != null ){ property = property.getSuccessor(); } if( property != null ){ return result.expandProperty( station.getStation().getController(), property ); } else{ return result; } } }
private CLocation expand( DockableProperty property ){ if( property instanceof ScreenDockProperty ){ ScreenDockProperty screen = (ScreenDockProperty)property; CLocation result; if( screen.isFullscreen() ){ result = new CMaximalExternalizedLocation( screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight() ); } else{ result = new CExternalizedLocation( screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight() ); } if( property.getSuccessor() != null ){ return result.expandProperty( station.getStation().getController(), property.getSuccessor() ); } else{ return result; } } return null; }
private CLocation expand( DockableProperty property ){ if( property instanceof ScreenDockProperty ){ ScreenDockProperty screen = (ScreenDockProperty)property; CLocation result; if( screen.isFullscreen() ){ result = new CMaximalExternalizedLocation( screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight() ); } else{ result = new CExternalizedLocation( screen.getX(), screen.getY(), screen.getWidth(), screen.getHeight() ); } if( property.getSuccessor() != null ){ return result.expandProperty( station.getStation().getController(), property.getSuccessor() ); } else{ return result; } } return null; }