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

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

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

ToolBar.indexOf介绍

[英]Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item. If no item is found, returns -1.
[中]从第一项(索引0)开始搜索接收方列表,直到找到与参数相等的项,并返回该项的索引。如果未找到任何项,则返回-1。

代码示例

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

public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
        e.result = chevronItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
        e.result = chevronItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
        e.result = minItem.getToolTipText();
      } else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
        e.result = maxItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
        e.result = minItem.getToolTipText();
      } else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
        e.result = maxItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
        e.result = minItem.getToolTipText();
      } else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
        e.result = maxItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
        e.result = chevronItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
        e.result = chevronItem.getToolTipText();
      }
    }
  }
});

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

public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
        e.result = minItem.getToolTipText();
      } else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
        e.result = maxItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (minItem != null && e.childID == minMaxTb.indexOf(minItem)) {
        e.result = minItem.getToolTipText();
      } else if (maxItem != null && e.childID == minMaxTb.indexOf(maxItem)) {
        e.result = maxItem.getToolTipText();
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      if (chevronItem != null && e.childID == chevronTb.indexOf(chevronItem)) {
        e.result = chevronItem.getToolTipText();
      }
    }
  }
});

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

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

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

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

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

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

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

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

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

@Override
Widget computeTabGroup () {
  ToolItem [] items = _getItems ();
  if (tabItemList == null) {
    int i = 0;
    while (i < items.length && items [i].control == null) i++;
    if (i == items.length) return super.computeTabGroup ();
  }
  int index = indexOf(currentFocusItem);
  if (index == -1) index = items.length - 1;
  while (index >= 0) {
    ToolItem item = items [index];
    if (item.isTabGroup ()) return item;
    index--;
  }
  return super.computeTabGroup ();
}

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

@Override
Widget computeTabGroup () {
  ToolItem [] items = _getItems ();
  if (tabItemList == null) {
    int i = 0;
    while (i < items.length && items [i].control == null) i++;
    if (i == items.length) return super.computeTabGroup ();
  }
  int index = indexOf(currentFocusItem);
  if (index == -1) index = items.length - 1;
  while (index >= 0) {
    ToolItem item = items [index];
    if (item.isTabGroup ()) return item;
    index--;
  }
  return super.computeTabGroup ();
}

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

@Override
Widget computeTabGroup () {
  ToolItem [] items = _getItems ();
  if (tabItemList == null) {
    int i = 0;
    while (i < items.length && items [i].control == null) i++;
    if (i == items.length) return super.computeTabGroup ();
  }
  int index = indexOf(currentFocusItem);
  if (index == -1) index = items.length - 1;
  while (index >= 0) {
    ToolItem item = items [index];
    if (item.isTabGroup ()) return item;
    index--;
  }
  return super.computeTabGroup ();
}

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

static void renderInitialization( final ToolItem toolItem,
                 final String param )
 throws IOException
{
 JSWriter writer = JSWriter.getWriterFor( toolItem );
 ToolBar toolBar = toolItem.getParent();
 Integer index = new Integer( toolBar.indexOf( toolItem ) );
 // TODO [tb] For the index, it is currently ignored that controls
 //           attached to a ToolItem use an index-slot of their own on
 //           the client, while they don't on the server. In theory,
 //           this could lead to an incorrect order of the items on the
 //           client, which is problematic with the keyboard-control
 //           and radio-groups.
 Boolean flat = Boolean.valueOf( ( toolBar.getStyle() & SWT.FLAT ) != 0 );
 writer.newWidget( QX_TYPE, new Object[]{ param, flat } );
 writer.call( toolBar, "addAt", new Object[]{ toolItem, index } );
 WidgetLCAUtil.writeStyleFlag( toolItem, SWT.FLAT, "FLAT" );
 if( ( toolBar.getStyle() & SWT.VERTICAL ) != 0 ) {
  writer.call( JSConst.QX_FUNC_ADD_STATE, new Object[] { "rwt_VERTICAL"} );
 }
}

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

/**
 * Adds a tool item to the toolbar.
 * Note: Only called by standalone.
 */
private ToolItem addToolItem(final ToolBar toolbar, final Tool tool) {
  final String id = tool.group + '.' + tool.name;
  ToolItem item = new ToolItem (toolbar, tool.type);
  item.setText (getResourceString(id + ".label"));
  item.setToolTipText(getResourceString(id + ".tooltip"));
  item.setImage(tool.image);
  item.addSelectionListener(widgetSelectedAdapter(e -> tool.action.run()));
  final int childID = toolbar.indexOf(item);
  toolbar.getAccessible().addAccessibleListener(new AccessibleAdapter() {
    @Override
    public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
      if (e.childID == childID) {
        e.result = getResourceString(id + ".description");
      }
    }
  });
  return item;
}

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

@Override
public void renderInitialization( ToolItem item ) throws IOException {
 ToolBar toolBar = item.getParent();
 // TODO [tb] For the index, it is currently ignored that controls
 //           attached to a ToolItem use an index-slot of their own on
 //           the client, while they don't on the server. In theory,
 //           this could lead to an incorrect order of the items on the
 //           client, which is problematic with the keyboard-control
 //           and radio-groups.
 RemoteObject remoteObject = createRemoteObject( item, TYPE );
 remoteObject.setHandler( new ToolItemOperationHandler( item ) );
 remoteObject.set( "parent", getId( toolBar ) );
 remoteObject.set( "style", createJsonArray( getStyles( item, ALLOWED_STYLES ) ) );
 remoteObject.set( "index", toolBar.indexOf( item ) );
}

相关文章

ToolBar类方法