private TreeItem createTreeItem( TreeItem parent, String text, Image image, int index, boolean disabled ) { TreeItem item = index == -1 ? new TreeItem( parent, SWT.NONE ) : new TreeItem( parent, SWT.NONE, index ); if ( disabled ) { item.setForeground( getDisabledColor() ); } item.setText( text ); item.setImage( image ); return item; }
private void populateTreeItem( TreeItem childTreeItem, TreeNode treeNode ) { childTreeItem.setText( treeNode.getLabel() != null ? treeNode.getLabel() : "" ); childTreeItem.setImage( treeNode.getImage() ); childTreeItem.setData( treeNode.getData() ); childTreeItem.setForeground( treeNode.getForeground() ); childTreeItem.setBackground( treeNode.getBackground() ); childTreeItem.setFont( treeNode.getFont() ); treeNode.getData().forEach( childTreeItem::setData ); treeNodeItemMap.put( treeNode, childTreeItem ); }
/** * Gets a directory tree on a TreeItem to work with. * * @param ti * The TreeItem to set the directory tree on * @param dircolor * The color of the directory tree item. */ public static void getDirectoryTree( TreeItem ti, Color dircolor, RepositoryDirectoryInterface dir ) { ti.setText( dir.getName() ); ti.setForeground( dircolor ); // First, we draw the directories for ( int i = 0; i < dir.getNrSubdirectories(); i++ ) { RepositoryDirectory subdir = dir.getSubdirectory( i ); TreeItem subti = new TreeItem( ti, SWT.NONE ); subti.setImage( GUIResource.getInstance().getImageFolder() ); getDirectoryTree( subti, dircolor, subdir ); } }
private static void createTreeItem( TreeItem parent, RepositoryElementMetaInterface repositoryObject ) { TreeItem tiObject = new TreeItem( parent, SWT.NONE ); tiObject.setData( repositoryObject ); if ( repositoryObject.getObjectType() == RepositoryObjectType.TRANSFORMATION ) { tiObject.setImage( GUIResource.getInstance().getImageTransRepo() ); } else if ( repositoryObject.getObjectType() == RepositoryObjectType.JOB ) { tiObject.setImage( GUIResource.getInstance().getImageJobRepo() ); } SimpleDateFormat simpleDateFormat = new SimpleDateFormat( DATE_FORMAT ); tiObject.setText( 0, Const.NVL( repositoryObject.getName(), "" ) ); tiObject.setText( 1, Const.NVL( repositoryObject.getObjectType().getTypeDescription(), "" ).toUpperCase() ); tiObject.setText( 2, Const.NVL( repositoryObject.getModifiedUser(), "" ) ); tiObject.setText( 3, repositoryObject.getModifiedDate() != null ? simpleDateFormat .format( repositoryObject.getModifiedDate() ) : "" ); tiObject.setText( 4, Const.NVL( repositoryObject.getDescription(), "" ) ); if ( repositoryObject.isDeleted() ) { tiObject.setForeground( GUIResource.getInstance().getColorRed() ); } }
itemWaitFieldsIn.setForeground( guiresource.getColorDirectory() ); iteminput.setExpanded( true ); itemWaitFieldsOut.setForeground( guiresource.getColorDirectory() ); itemoutput.setExpanded( true );
itemWaitFieldsIn.setForeground( guiresource.getColorDirectory() ); iteminput.setExpanded( true ); itemWaitFieldsOut.setForeground( guiresource.getColorDirectory() ); itemoutput.setExpanded( true );
treeItem.setText( 5, Long.toString( res.getEntryNr() ) ); if ( res.getResult() ) { treeItem.setForeground( GUIResource.getInstance().getColorSuccessGreen() ); } else { treeItem.setForeground( GUIResource.getInstance().getColorRed() );
itemWaitFieldsIn.setForeground( guiResource.getColorDirectory() ); itemInput.setExpanded( true ); itemWaitFieldsInfo.setForeground( guiResource.getColorDirectory() ); itemInfo.setExpanded( true ); itemWaitFieldsOut.setForeground( guiResource.getColorDirectory() ); itemOutput.setExpanded( true );
public void mouseExit(MouseEvent e) { validateLastItem(); if (lastItem != null) { TreeItem item = lastItem; lastItem = null; item.setForeground(null); } } });
@Override public void setForeground(int columnIndex, Color color) { item.setForeground(columnIndex, color); }
@Override public void setForeground(int columnIndex, Color color) { item.setForeground(columnIndex, color); }
public void setForeground(int columnIndex, Color color) { item.setForeground(columnIndex, color); }
@Override public void handleEvent (Event e) { String url = text.getText(); if ( validURL(url)){ text.setForeground( null ); item.setForeground( null ); }else{ text.setForeground( Colors.colorError ); item.setForeground( Colors.colorError ); } item.setText(url); computeSaveEnable(); removeEditor(); } });
@Override public void handleEvent (Event e) { String url = text.getText(); if ( validURL(url)){ text.setForeground( null ); item.setForeground( null ); }else{ text.setForeground( Colors.colorError ); item.setForeground( Colors.colorError ); } item.setText(url); computeSaveEnable(); } });
@Override public void handleEvent (Event e) { String url = text.getText(); if ( validURL(url)){ text.setForeground( null ); item.setForeground( null ); }else{ text.setForeground( Colors.colorError ); item.setForeground( Colors.colorError ); } item.setText(url); computeSaveEnable(); } });
@Override public void handleEvent (Event e) { String url = text.getText(); if ( validURL(url)){ text.setForeground( null ); item.setForeground( null ); }else{ text.setForeground( Colors.colorError ); item.setForeground( Colors.colorError ); } item.setText(url); computeSaveEnable(); removeEditor(); } });
/** * Sets the foreground color of the Node 1 TreeItems in column 1. */ void setCellForeground () { if (!instance.startup) { textNode1.setForeground (1, cellForegroundColor); imageNode1.setForeground (1, cellForegroundColor); } /* Set the foreground color item's image to match the foreground color of the cell. */ Color color = cellForegroundColor; if (color == null) color = textNode1.getForeground (1); TableItem item = colorAndFontTable.getItem(CELL_FOREGROUND_COLOR); Image oldImage = item.getImage(); if (oldImage != null) oldImage.dispose(); item.setImage (colorImage(color)); }
/** * Sets the foreground color of the Node 1 TreeItems. */ void setItemForeground () { if (!instance.startup) { textNode1.setForeground (itemForegroundColor); imageNode1.setForeground (itemForegroundColor); } /* Set the foreground button's color to match the foreground color of the item. */ Color color = itemForegroundColor; if (color == null) color = textNode1.getForeground (); TableItem item = colorAndFontTable.getItem(ITEM_FOREGROUND_COLOR); Image oldImage = item.getImage(); if (oldImage != null) oldImage.dispose(); item.setImage (colorImage(color)); }
/** * Recursively mark all submenues as enabled/disabled */ private void setItemEnabledRec(MenuItem item, boolean enabled) { TreeItem node = (TreeItem) item.getAttached(); if(enabled&&isMenuItemEnabled(item)) { node.setForeground(item.foreground); item.foreground=null; node.setImage(item.image); for(Iterator it=item.getItems().iterator();it.hasNext();) { setItemEnabledRec((MenuItem) it.next(), enabled); } } else if(!enabled) { if(item.foreground==null) { item.foreground=node.getForeground(); } node.setForeground(appShell.getComponent().getDisplay().getSystemColor(SWT.COLOR_GRAY)); node.setImage(getDisabledIcon(item.image)); for(Iterator it=item.getItems().iterator();it.hasNext();) { setItemEnabledRec((MenuItem) it.next(), enabled); } } }
private void setColorsAndFonts(TreeItem[] items) { for (int i = 0; i < items.length; i++) { DecorationResult decoration = getDecoration(items[i].getData()); items[i].setBackground(decoration.getBackgroundColor()); items[i].setForeground(decoration.getForegroundColor()); items[i].setFont(decoration.getFont()); setColorsAndFonts(items[i].getItems()); } }