private void traverseDomSetReadOnly( XulComponent component, boolean readonly ) { component.setDisabled( readonly ); List<XulComponent> children = component.getChildNodes(); if ( children != null && children.size() > 0 ) { for ( XulComponent child : children ) { child.setDisabled( readonly ); traverseDomSetReadOnly( child, readonly ); } } }
public void removeMenuItem( String itemid, boolean removeTrailingSeparators ) { XulMenuitem item = (XulMenuitem) mainSpoonContainer.getDocumentRoot().getElementById( itemid ); if ( item != null ) { XulComponent menu = item.getParent(); item.getParent().removeChild( item ); if ( removeTrailingSeparators ) { List<XulComponent> children = menu.getChildNodes(); if ( children.size() > 0 ) { XulComponent lastMenuItem = children.get( children.size() - 1 ); if ( lastMenuItem instanceof XulMenuseparator ) { menu.removeChild( lastMenuItem ); // above call should work, but doesn't for some reason, removing separator by force // the menu separators seem to not be modeled as individual objects in XUL try { Menu swtm = (Menu) menu.getManagedObject(); swtm.getItems()[swtm.getItemCount() - 1].dispose(); } catch ( Throwable t ) { LogChannel.GENERAL.logError( "Error removing XUL menu item", t ); } } } } } else { log.logError( "Could not find menu item with id " + itemid + " to remove from Spoon menu" ); } }
if ( !listener.tableItemInserted( table.getItem( tRow.getParent().getParent().getChildNodes().indexOf( tRow.getParent() ) ), v ) ) { tRow.getParent().getParent().removeChild( tRow.getParent() );