public void createToolBar() {
bar = new CoolBar(shell, SWT.FLAT | SWT.TOP);
// bars
bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
createFileSection();
createEditBar();
createFontSection();
createSettingsBar();
bar.pack();
bar.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event arg0) {
pmTrans.adjustLayout();
}
});
}
java类org.eclipse.swt.widgets.CoolBar的实例源码
BarManager.java 文件源码
项目:pmTrans
阅读 25
收藏 0
点赞 0
评论 0
SWTCoolBarTestDemo.java 文件源码
项目:TranskribusSwtGui
阅读 32
收藏 0
点赞 0
评论 0
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;
}
LogAnalysis.java 文件源码
项目:AndroidRobot
阅读 23
收藏 0
点赞 0
评论 0
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();
}
JframeApp.java 文件源码
项目:jframe
阅读 26
收藏 0
点赞 0
评论 0
/**
*
*/
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();
}
TransformViewDataDialog.java 文件源码
项目:Hydrograph
阅读 23
收藏 0
点赞 0
评论 0
/**
* 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;
}
HTMLEditor.java 文件源码
项目:team-explorer-everywhere
阅读 21
收藏 0
点赞 0
评论 0
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);
}
ChessBoardUtils.java 文件源码
项目:raptor-chess-interface
阅读 29
收藏 0
点赞 0
评论 0
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);
}
LogAnalysis.java 文件源码
项目:AndroidRobot
阅读 21
收藏 0
点赞 0
评论 0
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();
}
ApplicationWindow.java 文件源码
项目:gef-gwt
阅读 27
收藏 0
点赞 0
评论 0
/**
* Returns whether or not children exist for this application window's cool
* bar control.
*
* @return boolean true if children exist, false otherwise
* @since 3.0
*/
protected boolean coolBarChildrenExist() {
Control coolControl = getCoolBarControl();
if (coolControl instanceof CoolBar) {
return ((CoolBar) coolControl).getItemCount() > 0;
}
return false;
}
ToolBarManager.java 文件源码
项目:gef-gwt
阅读 36
收藏 0
点赞 0
评论 0
/**
* 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;
}
}
}
}
}
CoolBarManager.java 文件源码
项目:gef-gwt
阅读 22
收藏 0
点赞 0
评论 0
/**
* Creates and returns this manager's cool bar control. Does not create a
* new control if one already exists.
*
* @param parent
* the parent control
* @return the cool bar control
*/
public CoolBar createControl(Composite parent) {
Assert.isNotNull(parent);
if (!coolBarExist()) {
coolBar = new CoolBar(parent, itemStyle);
coolBar.setMenu(getContextMenuControl());
coolBar.setLocked(false);
update(false);
}
return coolBar;
}
ApplicationWindowEx.java 文件源码
项目:swt-widgets
阅读 24
收藏 0
点赞 0
评论 0
/**
* Returns whether or not children exist for this application window's
* cool bar control.
*
* @return boolean true if children exist, false otherwise
* @since 3.0
*/
protected boolean coolBarChildrenExist() {
final Control coolControl = getCoolBarControl();
if (coolControl instanceof CoolBar) {
return ((CoolBar) coolControl).getItemCount() > 0;
}
return false;
}
IsoExplorerSashForm.java 文件源码
项目:jisocreator
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void createComponents() {
composites = new ArrayList<Composite>();
composites.add(new Composite(this, SWT.NONE));
composites.add(new Composite(this, SWT.NONE));
isoTreeCLabel = new CLabel(composites.get(0), SWT.NONE);
isoDirectoriesTree = new TreeViewer(composites.get(0),
SWT.VIRTUAL | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
isoTableCoolBar = new CoolBar(composites.get(1), SWT.WRAP | SWT.FLAT);
isoDirectoriesTable = new TableViewer(composites.get(1),
SWT.VIRTUAL | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
}
OSExplorerSashForm.java 文件源码
项目:jisocreator
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void createComponents() {
composites = new ArrayList<Composite>();
composites.add(new Composite(this, SWT.NONE));
composites.add(new Composite(this, SWT.NONE));
osTreeCLabel = new CLabel(composites.get(0), SWT.NONE);
osDirectoriesTree = new TreeViewer(composites.get(0),
SWT.VIRTUAL | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
osTableCoolBar = new CoolBar(composites.get(1), SWT.WRAP | SWT.FLAT);
osDirectoriesTable = new TableViewer(composites.get(1),
SWT.VIRTUAL | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
}
CoolBarTest.java 文件源码
项目:q7.quality.mockups
阅读 27
收藏 0
点赞 0
评论 0
public Control construct(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
.grab(true, true).applyTo(composite);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);
final Text t = new Text(composite, SWT.BORDER | SWT.MULTI);
t.setText ("Test at the pressing");
CoolBar bar = new CoolBar(composite, SWT.VERTICAL);
for (int i=1; i<6; i++) {
CoolItem item = new CoolItem (bar, SWT.NONE);
final Button button = new Button (bar, SWT.PUSH);
button.setText ("Button " + i);
Point size = button.computeSize (SWT.DEFAULT, SWT.DEFAULT);
item.setPreferredSize (item.computeSize (size.x, size.y));
item.setControl (button);
final String t2 = button.getText();
button.addListener (SWT.Selection, new Listener () {
public void handleEvent (Event e) {
t.setText(t2);
}
});
}
Rectangle clientArea = composite.getClientArea ();
bar.setLocation (clientArea.x, clientArea.y);
return null;
}
CoolBarWithResizing.java 文件源码
项目:q7.quality.mockups
阅读 22
收藏 0
点赞 0
评论 0
public Control construct(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
.grab(true, true).applyTo(composite);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);
CoolBar coolBar = new CoolBar(composite, SWT.NONE);
createItem(coolBar, 3);
createItem(coolBar, 2);
createItem(coolBar, 3);
createItem(coolBar, 4);
int style = SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL;
Text text = new Text(composite, style);
FormLayout layout = new FormLayout();
composite.setLayout(layout);
FormData coolData = new FormData();
coolData.left = new FormAttachment(0);
coolData.right = new FormAttachment(100);
coolData.top = new FormAttachment(0);
coolBar.setLayoutData(coolData);
coolBar.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event event) {
composite.layout();
}
});
FormData textData = new FormData();
textData.left = new FormAttachment(0);
textData.right = new FormAttachment(100);
textData.top = new FormAttachment(coolBar);
textData.bottom = new FormAttachment(100);
text.setLayoutData(textData);
return null;
}
HTMLEditor.java 文件源码
项目:team-explorer-everywhere
阅读 25
收藏 0
点赞 0
评论 0
private ToolBar createLinkToolBar(final CoolBar parent) {
final ToolBar toolBar = new ToolBar(parent, toolbarStyle);
linkButtonItem = new ToolItem(toolBar, SWT.PUSH);
linkButtonItem.setToolTipText(Messages.getString("HTMLEditor.ConvertToHyperlinkToolTip")); //$NON-NLS-1$
linkButtonItem.setImage(imageHelper.getImage("/images/htmleditor/link.gif")); //$NON-NLS-1$
linkButtonItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
/*
* IE and Mozilla do not give us the existing link on the
* selecte item (if there is one) through any
* queryCommandValue() invocation. To retrieve the current link,
* call a special method on the HTMLEditor.
*/
final Object existingLinkObject = evaluate("return editor.getLinkUnderSelection() || '';"); //$NON-NLS-1$
final String initialValue =
((existingLinkObject instanceof String) && existingLinkObject.toString().length() > 0)
? (String) existingLinkObject : "http://"; //$NON-NLS-1$
final StringInputDialog dialog =
new StringInputDialog(
getShell(),
Messages.getString("HTMLEditor.HyperlinkInputDialogPrompt"), //$NON-NLS-1$
initialValue,
Messages.getString("HTMLEditor.HyperlinkInputDialogTitle"), //$NON-NLS-1$
"HTMLEditor.toolBar.linkButtonItem"); //$NON-NLS-1$
/*
* Allow an empty string, to unset the link.
*/
dialog.setRequired(false);
if (dialog.open() == IDialogConstants.OK_ID) {
if (dialog.getInput() != null && dialog.getInput().length() > 0) {
/*
* Disallow Javascript links. These would be removed
* during the round-trip through save anyway (see
* HtmlFilter).
*/
if (dialog.getInput().startsWith("javascript:") == false) //$NON-NLS-1$
{
doEditorCommand("CreateLink", false, dialog.getInput()); //$NON-NLS-1$
}
} else {
doEditorCommand("Unlink", false, null); //$NON-NLS-1$
}
}
}
});
return toolBar;
}
BranchActionsProvider.java 文件源码
项目:gerrit-tools
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void fill(CoolBar parent, int index) {
throw new UnsupportedOperationException("Not implemented");
}
ChangesActionsProvider.java 文件源码
项目:gerrit-tools
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void fill(CoolBar parent, int index) {
throw new UnsupportedOperationException("Not implemented");
}
RaptorWindow.java 文件源码
项目:raptor-chess-interface
阅读 23
收藏 0
点赞 0
评论 0
protected void createLeftCoolbar() {
leftCoolbar = new CoolBar(windowComposite, SWT.FLAT | SWT.VERTICAL);
leftCoolbar.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true,
1, 1));
leftCoolbar.setVisible(false);
}
ChessBoard.java 文件源码
项目:raptor-chess-interface
阅读 24
收藏 0
点赞 0
评论 0
public CoolBar getCoolbar() {
return coolbar;
}
AbstractTrimWidget.java 文件源码
项目:gef-gwt
阅读 26
收藏 0
点赞 0
评论 0
public void fill(CoolBar parent, int index) {
}
SubContributionItem.java 文件源码
项目:gef-gwt
阅读 20
收藏 0
点赞 0
评论 0
public void fill(CoolBar parent, int index) {
if (visible) {
innerItem.fill(parent, index);
}
}
SubMenuManager.java 文件源码
项目:gef-gwt
阅读 21
收藏 0
点赞 0
评论 0
public void fill(CoolBar parent, int index) {
// do nothing
}
ToolBarContributionItem.java 文件源码
项目:gef-gwt
阅读 23
收藏 0
点赞 0
评论 0
public void saveWidgetState() {
if (checkDisposed()) {
return;
}
if (coolItem == null) {
return;
}
//1. Save current size
CoolBar coolBar = coolItem.getParent();
boolean isLastOnRow = false;
int lastIndex = coolBar.getItemCount() - 1;
int coolItemIndex = coolBar.indexOf(coolItem);
int[] wrapIndicies = getAdjustedWrapIndices(coolBar.getWrapIndices());
// Traverse through all wrap indicies backwards
for (int row = wrapIndicies.length - 1; row >= 0; row--) {
if (wrapIndicies[row] <= coolItemIndex) {
int nextRow = row + 1;
int nextRowStartIndex;
if (nextRow > (wrapIndicies.length - 1)) {
nextRowStartIndex = lastIndex + 1;
} else {
nextRowStartIndex = wrapIndicies[nextRow];
}
// Check to see if its the last item on the row
if (coolItemIndex == (nextRowStartIndex - 1)) {
isLastOnRow = true;
}
break;
}
}
// Save the preferred size as actual size for the last item on a row
int nCurrentWidth;
if (isLastOnRow) {
nCurrentWidth = coolItem.getPreferredSize().x;
} else {
nCurrentWidth = coolItem.getSize().x;
}
setCurrentWidth(nCurrentWidth);
setCurrentHeight(coolItem.getSize().y);
}
ToolBarContributionItem.java 文件源码
项目:gef-gwt
阅读 22
收藏 0
点赞 0
评论 0
/**
* Updates the cool items' preferred, minimum, and current size. The
* preferred size is calculated based on the tool bar size and extra trim.
*
* @param changeCurrentSize
* <code>true</code> if the current size should be changed to
* the preferred size, <code>false</code> to not change the
* current size
*/
private void updateSize(boolean changeCurrentSize) {
if (checkDisposed()) {
return;
}
// cannot set size if coolItem is null
if (coolItem == null || coolItem.isDisposed()) {
return;
}
boolean locked = false;
CoolBar coolBar = coolItem.getParent();
try {
// Fix odd behaviour with locked tool bars
if (coolBar != null) {
if (coolBar.getLocked()) {
coolBar.setLocked(false);
locked = true;
}
}
ToolBar toolBar = (ToolBar) coolItem.getControl();
if ((toolBar == null) || (toolBar.isDisposed())
|| (toolBar.getItemCount() <= 0)) {
// if the toolbar does not contain any items then dispose of
// coolItem
coolItem.setData(null);
Control control = coolItem.getControl();
if ((control != null) && !control.isDisposed()) {
control.dispose();
coolItem.setControl(null);
}
if (!coolItem.isDisposed()) {
coolItem.dispose();
}
} else {
// If the toolbar item exists then adjust the size of the cool
// item
Point toolBarSize = toolBar.computeSize(SWT.DEFAULT,
SWT.DEFAULT);
// Set the preffered size to the size of the toolbar plus trim
Point preferredSize = coolItem.computeSize(toolBarSize.x,
toolBarSize.y);
coolItem.setPreferredSize(preferredSize);
// note setMinimumSize must be called before setSize, see PR
// 15565
// Set minimum size
if (getMinimumItemsToShow() != SHOW_ALL_ITEMS) {
int toolItemWidth = toolBar.getItems()[0].getWidth();
int minimumWidth = toolItemWidth * getMinimumItemsToShow();
coolItem.setMinimumSize(minimumWidth, toolBarSize.y);
} else {
coolItem.setMinimumSize(toolBarSize.x, toolBarSize.y);
}
if (changeCurrentSize) {
// Set current size to preferred size
coolItem.setSize(preferredSize);
}
}
} finally {
// If the cool bar was locked, then set it back to locked
if ((locked) && (coolBar != null)) {
coolBar.setLocked(true);
}
}
}
MenuManager.java 文件源码
项目:gef-gwt
阅读 26
收藏 0
点赞 0
评论 0
public void fill(CoolBar parent, int index) {
}
MenuManagerEx.java 文件源码
项目:swt-widgets
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void fill(CoolBar parent, int index) {
}
MainShell.java 文件源码
项目:RepDev
阅读 33
收藏 0
点赞 0
评论 0
public CoolBar getCoolBar() {
return this.coolBar;
}
MenuManagerCopiedToAddCreateMenuWithMenuParent.java 文件源码
项目:Pydev
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void fill(CoolBar parent, int index) {
}