editor.horizontalAlignment = SWT.LEFT; Rectangle itemRect = item.getBounds(), rect = wTree.getClientArea(); editor.minimumWidth = Math.max( size.x, itemRect.width ) + inset * 2; int left = itemRect.x,
editor.horizontalAlignment = SWT.LEFT; Rectangle itemRect = item.getBounds(), rect = wTree.getClientArea(); editor.minimumWidth = Math.max( size.x, itemRect.width ) + inset * 2; int left = itemRect.x,
editor.horizontalAlignment = SWT.LEFT; Rectangle itemRect = item.getBounds(), rect = wTree.getClientArea(); editor.minimumWidth = Math.max( size.x, itemRect.width ) + inset * 2; int left = itemRect.x,
final int getVisibleRowCount( boolean includePartlyVisible ) { int clientHeight = getClientArea().height - getHeaderHeight(); int result = 0; if( clientHeight >= 0 ) { int itemHeight = getItemHeight(); result = clientHeight / itemHeight; if( includePartlyVisible && clientHeight % itemHeight != 0 ) { result++; } } return result; }
@Override public void handleEvent(Event event) { if(rations != null) { int width = tree.getClientArea().width; int index = 0; for(TreeColumn column : tree.getColumns()) { if(index < rations.length) { column.setWidth((int) (width * rations[index])); }else { column.setWidth(0); } index++; } } }
boolean needsVScrollBar() { int availableHeight = getClientArea().height; int height = getHeaderHeight(); height += itemCount * getItemHeight(); for( int i = 0; i < itemCount; i++ ) { TreeItem item = items[ i ]; if( item != null && item.getExpanded() ) { height += item.getInnerHeight(); } } return height > availableHeight; }
@Override public void controlResized(ControlEvent e) { Rectangle area = tree.getClientArea(); TreeColumn[] columns = tree.getColumns(); if (area.width > 0) { columns[0].setWidth(area.width * 40 / 100); columns[1].setWidth(area.width - columns[0].getWidth() - 4); tree.removeControlListener(this); } } });
@Override public void controlResized(ControlEvent e) { Rectangle area = tree.getClientArea(); TreeColumn[] columns = tree.getColumns(); if (area.width > 0) { columns[0].setWidth(area.width * 40 / 100); columns[1].setWidth(area.width - columns[0].getWidth() - 4); tree.removeControlListener(this); } } });
public void controlResized( ControlEvent e ) { if ( tree.getClientArea().width > 0 ) { int width = tree.getClientArea().width - 2 * tree.getBorderWidth(); if ( tree.getVerticalBar().isVisible() ) { width -= tree.getVerticalBar().getSize().x; } tree.getColumn( EntryEditorWidgetTableMetadata.VALUE_COLUMN_INDEX ).setWidth( width - tree.getColumn( EntryEditorWidgetTableMetadata.KEY_COLUMN_INDEX ).getWidth() ); } } } );
public void controlResized(ControlEvent e) { Rectangle area = tree.getClientArea(); TreeColumn[] columns = tree.getColumns(); if (area.width > 0) { columns[0].setWidth(area.width * 40 / 100); columns[1].setWidth(area.width - columns[0].getWidth() - 4); tree.removeControlListener(this); } } });
Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); TreeItem item = tree.getItem(point); if (item == null) { Rectangle area = tree.getClientArea(); if (area.contains(point)) { int treeBottom = area.y + area.height; item = tree.getTopItem(); while (item != null) { Rectangle rect = item.getBounds(); int itemBottom = rect.y + rect.height; if (rect.y <= point.y && point.y < itemBottom) return item; if (itemBottom > treeBottom) break; item = nextItem(tree, item); } return null; } } return item; }
Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); TreeItem item = tree.getItem(point); if (item == null) { Rectangle area = tree.getClientArea(); if (area.contains(point)) { int treeBottom = area.y + area.height; item = tree.getTopItem(); while (item != null) { Rectangle rect = item.getBounds(); int itemBottom = rect.y + rect.height; if (rect.y <= point.y && point.y < itemBottom) return item; if (itemBottom > treeBottom) break; item = nextItem(tree, item); } return null; } } return item; }
Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); TreeItem item = tree.getItem(point); if (item == null) { Rectangle area = tree.getClientArea(); if (area.contains(point)) { int treeBottom = area.y + area.height; item = tree.getTopItem(); while (item != null) { Rectangle rect = item.getBounds(); int itemBottom = rect.y + rect.height; if (rect.y <= point.y && point.y < itemBottom) return item; if (itemBottom > treeBottom) break; item = nextItem(tree, item); } return null; } } return item; }
Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); TreeItem item = tree.getItem(point); if (item == null) { Rectangle area = tree.getClientArea(); if (area.contains(point)) { int treeBottom = area.y + area.height; item = tree.getTopItem(); while (item != null) { Rectangle rect = item.getBounds(); int itemBottom = rect.y + rect.height; if (rect.y <= point.y && point.y < itemBottom) return item; if (itemBottom > treeBottom) break; item = nextItem(tree, item); } return null; } } return item; }
Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); TreeItem item = tree.getItem(point); if (item == null) { Rectangle area = tree.getClientArea(); if (area.contains(point)) { int treeBottom = area.y + area.height; item = tree.getTopItem(); while (item != null) { Rectangle rect = item.getBounds(); int itemBottom = rect.y + rect.height; if (rect.y <= point.y && point.y < itemBottom) return item; if (itemBottom > treeBottom) break; item = nextItem(tree, item); } return null; } } return item; }
Widget getItem(Tree tree, int x, int y) { Point point = new Point(x, y); point = tree.toControl(point); TreeItem item = tree.getItem(point); if (item == null) { Rectangle area = tree.getClientArea(); if (area.contains(point)) { int treeBottom = area.y + area.height; item = tree.getTopItem(); while (item != null) { Rectangle rect = item.getBounds(); int itemBottom = rect.y + rect.height; if (rect.y <= point.y && point.y < itemBottom) return item; if (itemBottom > treeBottom) break; item = nextItem(tree, item); } return null; } } return item; }
public void activate() { Object element = fTreeItem.getData(); String value = cellModifier.getValue(element, fProperty).toString(); if (fControl instanceof Text) { Text text = (Text) fControl; int requiredSize = value.length() + 100; if (text.getTextLimit() < requiredSize) { text.setTextLimit(requiredSize); } } Rectangle r = fTreeItem.getBounds(); if (r != null) { fControl.setBounds(columnPosition + 5, r.y + 1, fTree1.getClientArea().width - (columnPosition + 5), r.height - 1); fControl.setVisible(true); fCellEditor.setValue(value); fCellEditor.addListener(this); fCellEditor.setFocus(); fControl.addFocusListener(this); } }
@Override public void menuShown(MenuEvent e) { Utils.disposeSWTObjects(menuTree.getItems()); bShown = true; Point ptMouse = tree.toControl(e.display.getCursorLocation()); int indent = END_INDENT ? tree.getClientArea().width - 1 : 0; TreeItem treeItem = tree.getItem(new Point(indent, ptMouse.y)); if (treeItem == null) { return; } SideBarEntrySWT entry = (SideBarEntrySWT) treeItem.getData("MdiEntry"); fillMenu(menuTree, entry, "sidebar"); if (menuTree.getItemCount() == 0) { Utils.execSWTThreadLater(0, new AERunnable() { @Override public void runSupport() { menuTree.setVisible(false); } }); } } });
@Override ViewerCell getInitialFocusCell() { Tree tree = (Tree) getViewer().getControl(); if (! tree.isDisposed() && tree.getItemCount() > 0 && ! tree.getTopItem().isDisposed()) { ViewerRow aViewerRow = getViewer().getViewerRowFromItem(tree.getTopItem()); if (tree.getColumnCount() == 0) { return aViewerRow.getCell(0); } Rectangle clientArea = tree.getClientArea(); for (int i = 0; i < tree.getColumnCount(); i++) { if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i)) return aViewerRow.getCell(i); } } return null; }
@Override ViewerCell getInitialFocusCell() { Tree tree = (Tree) getViewer().getControl(); if (! tree.isDisposed() && tree.getItemCount() > 0 && ! tree.getTopItem().isDisposed()) { ViewerRow aViewerRow = getViewer().getViewerRowFromItem(tree.getTopItem()); if (tree.getColumnCount() == 0) { return aViewerRow.getCell(0); } Rectangle clientArea = tree.getClientArea(); for (int i = 0; i < tree.getColumnCount(); i++) { if (aViewerRow.getWidth(i) > 0 && columnInVisibleArea(clientArea,aViewerRow,i)) return aViewerRow.getCell(i); } } return null; }