@Override public UIRepositoryObject get( int index ) { return getChildren().get( index ); }
@Override public Iterator<UIRepositoryObject> iterator() { return getChildren().iterator(); }
@Override public int size() { return getChildren().size(); }
public void fireCollectionChanged() { firePropertyChange( "children", null, getChildren() ); getChildren(); // prime cache before firing event (already primed from above getChildren call but to be consistent) kidDirectoryCache.fireCollectionChanged(); try { getRepositoryObjects(); // prime cache before firing event if ( kidElementCache != null ) { kidElementCache.fireCollectionChanged(); } } catch ( KettleException ignored ) { // Ignore errors } }
@Override public UIRepositoryDirectory sourceToTarget( final UIRepositoryDirectory value ) { if ( value == null || value.size() == 0 ) { return null; } if ( !value.get( value.size() - 1 ).equals( trashDir ) ) { // add directly to children collection to bypass events value.getChildren().add( trashDir ); } return value; }
private boolean repositoryDirectoryHasLockedObject( DropEvent event, UIRepositoryDirectory dir ) throws KettleException { if ( areAnyRepositoryObjectsLocked( event, dir.getRepositoryObjects() ) ) { return true; } for ( UIRepositoryObject ro : dir.getChildren() ) { if ( ro instanceof UIRepositoryDirectory ) { UIRepositoryDirectory directory = (UIRepositoryDirectory) ro; repositoryDirectoryHasLockedObject( event, directory ); } } return false; }
public boolean contains( String dirName ) { UIRepositoryDirectories directories = getChildren(); UIRepositoryObject dir; for ( int i = 0; i < directories.size(); i++ ) { dir = directories.get( i ); if ( !( dir instanceof UIRepositoryDirectory ) ) { continue; } else if ( dir.getName() == null && dirName == null ) { return true; } else if ( dir.getName().equalsIgnoreCase( dirName ) ) { return true; } } return false; }
@Override public void move( UIRepositoryDirectory newParentDir ) throws Exception { if ( newParentDir != null ) { rep.renameRepositoryDirectory( obj.getObjectId(), newParentDir.getDirectory(), null ); // Try to make sure the directories are updated properly if ( !newParentDir.equals( getParent() ) ) { getParent().getChildren().remove( this ); newParentDir.getChildren().add( this ); getParent().refresh(); newParentDir.refresh(); } } }
public void delete( boolean deleteHomeDirectories ) throws Exception { if ( rep instanceof RepositoryExtended ) { ( (RepositoryExtended) rep ).deleteRepositoryDirectory( getDirectory(), deleteHomeDirectories ); } else { rep.deleteRepositoryDirectory( getDirectory() ); } if ( getParent().getChildren().contains( this ) ) { getParent().getChildren().remove( this ); } if ( getParent().getRepositoryObjects().contains( this ) ) { getParent().getRepositoryObjects().remove( this ); } getParent().refresh(); }
public void delete() throws Exception { if ( uiParent.checkDirNameExistsInRepo( getName() ) != null ) { rep.deleteRepositoryDirectory( getDirectory() ); } uiParent.getChildren().remove( this ); if ( uiParent.getRepositoryObjects().contains( this ) ) { uiParent.getRepositoryObjects().remove( this ); } uiParent.refresh(); }
public UIRepositoryDirectory createFolder( String name ) throws Exception { RepositoryDirectoryInterface thisDir = getDirectory(); RepositoryDirectoryInterface dir; //PDI-5202: the directory might exist already. If so, don't create a new one. String dirName = checkDirNameExistsInRepo( name ); if ( dirName == null ) { dir = rep.createRepositoryDirectory( thisDir, name ); } else { dir = rep.findDirectory( thisDir.getPath() + "/" + dirName ); } UIRepositoryDirectory newDir = null; try { newDir = UIObjectRegistry.getInstance().constructUIRepositoryDirectory( dir, this, rep ); } catch ( UIObjectCreationException uoe ) { newDir = new UIRepositoryDirectory( dir, this, rep ); } UIRepositoryDirectories directories = getChildren(); if ( !contains( directories, newDir ) ) { directories.add( newDir ); } else { throw new KettleException( "Unable to create folder with the same name [" + name + "]" ); } kidElementCache = null; // rebuild the element cache for correct positioning. return newDir; }
populateChildren(); for ( UIRepositoryObject child : getChildren() ) { kidElementCache.add( child );