当前位置: 首页>>代码示例>>Java>>正文


Java CoolItem类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.CoolItem的典型用法代码示例。如果您正苦于以下问题:Java CoolItem类的具体用法?Java CoolItem怎么用?Java CoolItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CoolItem类属于org.eclipse.swt.widgets包,在下文中一共展示了CoolItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createContents

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
protected Control createContents(Composite parent) {
  // --- Create the window title. ---

  getShell().setText("CoolBar Test");

  String asCoolItemSection[] = { "File", "Formatting", "Search" };
  CoolBar composite = new CoolBar(parent, SWT.NONE);
  for (int idxCoolItem = 0; idxCoolItem < 3; ++idxCoolItem) {
    CoolItem item = new CoolItem(composite, SWT.NONE);
    ToolBar tb = new ToolBar(composite, SWT.FLAT);
    for (int idxItem = 0; idxItem < 3; ++idxItem) {
      ToolItem ti = new ToolItem(tb, SWT.NONE);
      ti
          .setText(asCoolItemSection[idxCoolItem] + " Item #"
              + idxItem);
    }
    Point p = tb.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    tb.setSize(p);
    Point p2 = item.computeSize(p.x, p.y);
    item.setControl(tb);
    item.setSize(p2);
  }
  return composite;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:25,代码来源:SWTCoolBarTestDemo.java

示例2: createToolBar

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
public void createToolBar() {
    Composite compCoolBar = new Composite(shell, SWT.BORDER);
    compCoolBar.setLayout(new FillLayout());

    CoolBar coolBarSort = new CoolBar(compCoolBar, SWT.NONE);

    CoolItem coolItemSort = new CoolItem(coolBarSort, SWT.NONE);

    Combo prjCombo = new Combo(coolBarSort, SWT.READ_ONLY);
    prjCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    prjCombo.setItems(new String[] { "显示所有用例", "只显示成功的用例", "只显示失败的用例" });
    prjCombo.select(0);

    Point p = prjCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    prjCombo.setSize(p);
    Point p2 = coolItemSort.computeSize(p.x, p.y);
    coolItemSort.setSize(p2);
    coolItemSort.setControl(prjCombo);

    coolBarSort.pack();

}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:23,代码来源:LogAnalysis.java

示例3: dispose

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * Disposes the given cool item.
 * 
 * @param item
 *            the cool item to dispose
 */
private void dispose(CoolItem item) {
    if ((item != null) && !item.isDisposed()) {

        item.setData(null);
        Control control = item.getControl();
        // if the control is already disposed, setting the coolitem
        // control to null will cause an SWT exception, workaround
        // for 19630
        if ((control != null) && !control.isDisposed()) {
            item.setControl(null);
            // we created it, we dispose it, see bug 293433
        	control.dispose();
        }
        item.dispose();
    }
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:23,代码来源:CoolBarManager.java

示例4: if

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * Sets the tab order of the coolbar to the visual order of its items.
 */
/* package */void updateTabOrder() {
    if (coolBar != null) {
        CoolItem[] items = coolBar.getItems();
        if (items != null) {
            ArrayList children = new ArrayList(items.length);
            for (int i = 0; i < items.length; i++) {
                if ((items[i].getControl() != null)
                        && (!items[i].getControl().isDisposed())) {
                    children.add(items[i].getControl());
                }
            }
            // Convert array
            Control[] childrenArray = new Control[0];
            childrenArray = (Control[]) children.toArray(childrenArray);

            if (childrenArray != null) {
                coolBar.setTabList(childrenArray);
            }

        }
    }
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:CoolBarManager.java

示例5: createToolBar

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * 
 */
protected void createToolBar() {
    CoolBar bar = new CoolBar(shell, SWT.FLAT);
    bar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    bar.setLayout(new RowLayout());

    CoolItem item = new CoolItem(bar, SWT.NONE);
    Button button = new Button(bar, SWT.FLAT);
    // button.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
    button.setText("Button");
    Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    item.setPreferredSize(item.computeSize(size.x, size.y));
    item.setControl(button);

    Rectangle clientArea = shell.getClientArea();
    bar.setLocation(clientArea.x, clientArea.y);
    bar.pack();
}
 
开发者ID:dzh,项目名称:jframe,代码行数:21,代码来源:JframeApp.java

示例6: updateCoolBarWrapIndices

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
protected void updateCoolBarWrapIndices(){
	int coolBarWidth = this.coolBar.getClientArea().width;
	int coolItemsWidth = 0;
	
	List coolItemIndices = new ArrayList();
	
	CoolItem[] items = this.coolBar.getItems();
	for(int i = 0;i < items.length; i ++){
		Point controlSise = items[i].getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
		Point itemSize = items[i].computeSize(controlSise.x, controlSise.y);
		
		int nextCoolItemsWidth = ( coolItemsWidth + itemSize.x );
		if( nextCoolItemsWidth > coolBarWidth ){
			coolItemIndices.add( new Integer( i ) );
			nextCoolItemsWidth = itemSize.x;
		}
		coolItemsWidth = nextCoolItemsWidth;
	}
	
	int[] coolItemIndicesArray = new int[ coolItemIndices.size() ];
	for(int i = 0;i < coolItemIndicesArray.length; i ++){
		coolItemIndicesArray[i] = ((Integer)coolItemIndices.get(i)).intValue();
	}
	
	this.coolBar.setWrapIndices( coolItemIndicesArray );
}
 
开发者ID:Totallicks,项目名称:totallicks-tuxguitar,代码行数:27,代码来源:ItemManager.java

示例7: createDialogArea

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * Create contents of the dialog.
 * @param parent
 */

@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));
	
	Shell shell=container.getShell();
	shell.setText("View Transform");
	shell.setImage(ImagePathConstant.APP_ICON.getImageFromRegistry());
	
	CoolBar coolBar = new CoolBar(container, SWT.FLAT);
	coolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
	
	 CoolItem buttonItem = new CoolItem(coolBar, SWT.NONE | SWT.DROP_DOWN);
	  Composite buttonComposite = new Composite(coolBar, SWT.NONE);
	  buttonComposite.setLayout(new GridLayout(3, false));
	 
	  	createWrapButton(buttonComposite);

	    createCopyButton(buttonComposite);
	    
	    buttonComposite.pack();

	    Point size = buttonComposite.getSize();
	    buttonItem.setControl(buttonComposite);
	    buttonItem.setSize(buttonItem.computeSize(size.x, size.y));

	    createStyleTextEditor(container);
	
		getShell().setMinimumSize(290,290);
		return container;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:37,代码来源:TransformViewDataDialog.java

示例8: createCoolItem

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
private void createCoolItem(final CoolBar coolBar, final ToolBar toolBar) {
    Check.notNull(coolBar, "coolBar"); //$NON-NLS-1$
    Check.notNull(toolBar, "toolBar"); //$NON-NLS-1$

    // Compute the size of the toolbar
    toolBar.pack();
    final Point toolBarSize = toolBar.getSize();

    // Create a CoolItem to hold the toolbar
    final CoolItem coolItem = new CoolItem(coolBar, SWT.NONE);
    coolItem.setControl(toolBar);

    // Set the preferred size to what was computed from the toolbar
    final Point coolItemSize = coolItem.computeSize(toolBarSize.x, toolBarSize.y);

    /*
     * SWT Quirk (Bug?)
     *
     * The cool item should have its PREFERRED size set to the result of its
     * OWN computeSize() calculation, but its MINIMUM size should be set to
     * its "child" TOOL BAR's computed size. I think it should rightly use
     * the same size (its OWN computed size) for minimum size, but this
     * leaves way too much empty space in the right side of the toolbar.
     */
    coolItem.setPreferredSize(coolItemSize);
    coolItem.setMinimumSize(toolBarSize);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:28,代码来源:HTMLEditor.java

示例9: adjustCoolbar

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
public static void adjustCoolbar(ChessBoard board, ToolBar toolbar) {
	clearCoolbar(board);
	toolbar.pack();
	Point size = toolbar.getSize();
	board.getCoolbar().setVisible(true);
	board.getCoolbar().setLocked(true);
	CoolItem coolItem = new CoolItem(board.getCoolbar(), SWT.NONE);
	coolItem.setControl(toolbar);
	coolItem.setSize(size.x, size.y);
	coolItem.setPreferredSize(size.x, size.y);
	coolItem.setMinimumSize(size);
	board.getControl().layout();
}
 
开发者ID:evilwan,项目名称:raptor-chess-interface,代码行数:14,代码来源:ChessBoardUtils.java

示例10: clearCoolbar

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
public static void clearCoolbar(ChessBoard board) {
	CoolBar coolbar = board.getCoolbar();
	CoolItem[] items = coolbar.getItems();
	for (CoolItem item : items) {
		if (item.getControl() != null && !item.getControl().isDisposed()) {
			item.getControl().dispose();
		}
		item.dispose();
	}
	board.getCoolbar().setVisible(false);
}
 
开发者ID:evilwan,项目名称:raptor-chess-interface,代码行数:12,代码来源:ChessBoardUtils.java

示例11: createStatusBar

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
private void createStatusBar() {
    coolBar1 = new CoolBar(shell, SWT.NONE);
    FormData formData1 = new FormData();
    formData1.left = new FormAttachment(0, 0);
    formData1.right = new FormAttachment(100, 0);
    formData1.top = new FormAttachment(100, -24);
    formData1.bottom = new FormAttachment(100, 0);
    coolBar1.setLayoutData(formData1);
    CoolItem coolItem1 = new CoolItem(coolBar1, SWT.NONE);
    toolBar1 = new ToolBar(coolBar1, SWT.NONE);

    ToolItem tiStatusBarTotal = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarPass = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarFail = new ToolItem(toolBar1, SWT.NONE);
    ToolItem tiStatusBarRate = new ToolItem(toolBar1, SWT.NONE);

    tiStatusBarPass.setText("通过:0");
    tiStatusBarFail.setText("失败:0");
    tiStatusBarRate.setText("通过率:0%");
    tiStatusBarTotal.setText("总用例数:0");

    coolItem1.setControl(toolBar1);

    Control control = coolItem1.getControl();
    Point pt = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    pt = coolItem1.computeSize(pt.x, pt.y);
    coolItem1.setSize(pt);

    coolBar1.pack();
}
 
开发者ID:hoozheng,项目名称:AndroidRobot,代码行数:31,代码来源:LogAnalysis.java

示例12: relayout

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * Re-lays out the tool bar.
 * <p>
 * The default implementation of this framework method re-lays out the
 * parent when the number of items are different and the new count != 0
 * 
 * @param layoutBar
 *            the tool bar control
 * @param oldCount
 *            the old number of items
 * @param newCount
 *            the new number of items
 */
protected void relayout(ToolBar layoutBar, int oldCount, int newCount) {
	if ((oldCount != newCount) && (newCount!=0)) {
		Point beforePack = layoutBar.getSize();
		layoutBar.pack(true);
		Point afterPack = layoutBar.getSize();
		
		// If the TB didn't change size then we're done
		if (beforePack.equals(afterPack))
			return;
		
		// OK, we need to re-layout the TB
		layoutBar.getParent().layout();
		
		// Now, if we're in a CoolBar then change the CoolItem size as well
		if (layoutBar.getParent() instanceof CoolBar) {
			CoolBar cb = (CoolBar) layoutBar.getParent();
			CoolItem[] items = cb.getItems();
			for (int i = 0; i < items.length; i++) {
				if (items[i].getControl() == layoutBar) {
					Point curSize = items[i].getSize();
					items[i].setSize(curSize.x+ (afterPack.x - beforePack.x),
								curSize.y+ (afterPack.y - beforePack.y));
					return;
				}
			}
		}
	}
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:42,代码来源:ToolBarManager.java

示例13: findCoolItem

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
private CoolItem findCoolItem(CoolItem[] items, IContributionItem item) {
      if (items == null) {
	return null;
}

      for (int i = 0; i < items.length; i++) {
          CoolItem coolItem = items[i];
          IContributionItem data = (IContributionItem) coolItem.getData();
          if (data != null && data.equals(item)) {
		return coolItem;
	}
      }
      return null;
  }
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:15,代码来源:CoolBarManager.java

示例14: itemRemoved

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * Subclasses may extend this <code>ContributionManager</code> method,
 * but must call <code>super.itemRemoved</code>.
 * 
 * @see org.eclipse.jface.action.ContributionManager#itemRemoved(org.eclipse.jface.action.IContributionItem)
 */
protected void itemRemoved(IContributionItem item) {
    Assert.isNotNull(item);
    super.itemRemoved(item);
    CoolItem coolItem = findCoolItem(item);
    if (coolItem != null) {
        coolItem.setData(null);
    }
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:15,代码来源:CoolBarManager.java

示例15: setItems

import org.eclipse.swt.widgets.CoolItem; //导入依赖的package包/类
/**
 * Replaces the current items with the given items.
 * Forces an update.
 * 
 * @param newItems the items with which to replace the current items
 */
public void setItems(IContributionItem[] newItems) {
    // dispose of all the cool items on the cool bar manager
    if (coolBar != null) {
        CoolItem[] coolItems = coolBar.getItems();
        for (int i = 0; i < coolItems.length; i++) {
            dispose(coolItems[i]);
        }
    }
    // Set the internal structure to this order
    internalSetItems(newItems);
    // Force and update
    update(true);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:20,代码来源:CoolBarManager.java


注:本文中的org.eclipse.swt.widgets.CoolItem类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。