org.eclipse.swt.widgets.Tree.getClientArea()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.eclipse.swt.widgets.Tree.getClientArea()方法的一些代码示例,展示了Tree.getClientArea()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getClientArea()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getClientArea

Tree.getClientArea介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

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,

代码示例来源:origin: pentaho/pentaho-kettle

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,

代码示例来源:origin: pentaho/pentaho-kettle

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,

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

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;
}

代码示例来源:origin: org.xworker/xworker_swt

@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++;
    }
  }
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.views

@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);
    }
  }
});

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.views

@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);
    }
  }
});

代码示例来源:origin: org.apache.directory.studio/ldapbrowser.common

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() );
    }
  }
} );

代码示例来源:origin: org.eclipse/org.eclipse.ui.views

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);
    }
  }
});

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

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;
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt

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;
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

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;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

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;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui

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);
  }
}

代码示例来源:origin: BiglySoftware/BiglyBT

@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);
        }
      });
    }
  }
});

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

@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;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@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;
}

相关文章

Tree类方法