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; } }
/** * 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(); } }
public void load( DataInputStream in ) throws IOException{ placeholder = new Path( in.readUTF() ); switch( in.readByte() ){ case 0: backup = null; break; case 1: backup = new SplitDockProperty(); backup.load( in ); break; case 2: backup = new SplitDockPathProperty(); backup.load( in ); break; default: throw new IllegalArgumentException( "unknown type of backup 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 ); } }
/** * Creates a copy of <code>root</code> and sets <code>property</code> * as the successor of the very last element in the property chain beginning * at <code>root</code>. * @param root the root of the chain, can be <code>null</code> * @param property the new last element of the chain * @return the root of the new chain */ public static DockableProperty append( DockableProperty root, DockableProperty property ){ if( root == null ) return property; root = root.copy(); getLastProperty( root ).setSuccessor( property ); return root; }
/** * 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; }
temp.load( datas ); datas.close(); property = temp; } else { property.setSuccessor( temp ); property = temp;
/** * Copies the fields of this property to <code>copy</code>. * @param copy the copy of <code>this</code> */ protected void copy( AbstractDockableProperty copy ){ if( successor != null ) copy.successor = successor.copy(); }
@Override public void setSuccessor( DockableProperty successor ){ super.setSuccessor( successor ); if( backup != null ){ backup.setSuccessor( successor ); } }
public void store( DataOutputStream out ) throws IOException{ out.writeUTF( placeholder.toString() ); if( backup == null ){ out.writeByte( 0 ); } else if( backup instanceof SplitDockProperty ){ out.writeByte( 1 ); backup.store( out ); } else if( backup instanceof SplitDockPathProperty ){ out.writeByte( 2 ); backup.store( out ); } else{ throw new IllegalStateException( "never happens" ); } }
/** * 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 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; }
public void finish( DockableProperty newParentLocation ){ if( valid ){ DockableProperty newLeafLocation = validLocation(); if( newLeafLocation == null && newParentLocation != null ){ newLeafLocation = newParentLocation.copy(); } if( newLeafLocation != null ){ newLeafLocation.setSuccessor( oldLocation ); composition.getLayout().setLocation( newLeafLocation ); } else{ invalidate(); } } }
temp.load( datas ); datas.close(); property = temp; } else { property.setSuccessor( temp ); property = temp;
public SplitDockPlaceholderProperty copy(){ SplitDockPlaceholderProperty copy = new SplitDockPlaceholderProperty( placeholder, backup == null ? null : backup.copy() ); copy( copy ); return copy; }
temp.setSuccessor( property ); property = temp;
public void store( XElement element ){ element.addElement( "placeholder" ).setString( placeholder.toString() ); if( backup instanceof SplitDockProperty ){ backup.store( element.addElement( "backup-location" ) ); } else if( backup instanceof SplitDockPathProperty ){ backup.store( element.addElement( "backup-path" ) ); } }
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; } }
/** * 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 ); }
/** * 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(); } }