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

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

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

ToolBar.layout介绍

暂无

代码示例

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

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_GRID_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolBar.layout( true, true );
 } catch ( Throwable t ) {
  log.logError( toString(), Const.getStackTracker( t ) );
  new ErrorDialog( transGridComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_GRID_TOOLBAR ),
   new Exception( t ) );
 }
}

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

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "import-rules-toolbar" );
  ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
  swtToolbar.layout( true, true );
 } catch ( Throwable t ) {
  LogChannel.GENERAL.logError( Const.getStackTracker( t ) );
  new ErrorDialog( shell,
   BaseMessages.getString( PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "ImportRulesDialog.Exception.ErrorReadingXULFile.Message", XUL_FILE_TOOLBAR ),
   new Exception( t ) );
 }
}

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

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_LOG_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  ToolBar swtToolbar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolbar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolbar.layout( true, true );
 } catch ( Throwable t ) {
  log.logError( Const.getStackTracker( t ) );
  new ErrorDialog( jobLogComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_LOG_TOOLBAR ),
   new Exception( t ) );
 }
}

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

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_LOG_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolBar.layout( true, true );
 } catch ( Throwable t ) {
  log.logError( Const.getStackTracker( t ) );
  new ErrorDialog( transLogComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_LOG_TOOLBAR ),
   new Exception( t ) );
 }
}

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

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_GRID_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  refreshButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById( "refresh-history" );
  fetchNextBatchButton =
   (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById( "fetch-next-batch-history" );
  fetchAllButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById( "fetch-all-history" );
  ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolBar.layout( true, true );
 } catch ( Throwable t ) {
  log.logError( Const.getStackTracker( t ) );
  new ErrorDialog( jobHistoryComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_GRID_TOOLBAR ),
   new Exception( t ) );
 }
}

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

private void addToolBar() {
 try {
  KettleXulLoader loader = new KettleXulLoader();
  loader.setIconsSize( 16, 16 );
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = new XulSpoonResourceBundle( Spoon.class );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_GRID_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  refreshButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById( "refresh-history" );
  fetchNextBatchButton =
   (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById( "fetch-next-batch-history" );
  fetchAllButton = (XulToolbarbutton) xulDomContainer.getDocumentRoot().getElementById( "fetch-all-history" );
  ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolBar.layout( true, true );
 } catch ( Throwable t ) {
  log.logError( Const.getStackTracker( t ) );
  new ErrorDialog( transHistoryComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_GRID_TOOLBAR ),
   new Exception( t ) );
 }
}

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

private void addToolBar() {
 try {
  XulLoader loader = new KettleXulLoader();
  loader.setSettingsManager( XulSpoonSettingsManager.getInstance() );
  ResourceBundle bundle = GlobalMessages.getBundle( "org/pentaho/di/ui/spoon/messages/messages" );
  XulDomContainer xulDomContainer = loader.loadXul( XUL_FILE_TRANS_PREVIEW_TOOLBAR, bundle );
  xulDomContainer.addEventHandler( this );
  toolbar = (XulToolbar) xulDomContainer.getDocumentRoot().getElementById( "nav-toolbar" );
  ToolBar swtToolBar = (ToolBar) toolbar.getManagedObject();
  spoon.props.setLook( swtToolBar, Props.WIDGET_STYLE_TOOLBAR );
  swtToolBar.layout( true, true );
  swtToolBar.pack();
  firstRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-first" );
  lastRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-last" );
  offRadio = (SwtRadio) xulDomContainer.getDocumentRoot().getElementById( "preview-off" );
  PropsUI.getInstance().setLook( (Control) firstRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
  PropsUI.getInstance().setLook( (Control) lastRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
  PropsUI.getInstance().setLook( (Control) offRadio.getManagedObject(), Props.WIDGET_STYLE_TOOLBAR );
 } catch ( Throwable t ) {
  log.logError( toString(), Const.getStackTracker( t ) );
  new ErrorDialog( transPreviewComposite.getShell(),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Title" ),
   BaseMessages.getString( PKG, "Spoon.Exception.ErrorReadingXULFile.Message", XUL_FILE_TRANS_PREVIEW_TOOLBAR ),
   new Exception( t ) );
 }
}

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

public Point computeSize (int wHint, int hHint, boolean changed) {
  checkWidget();
  int width = wHint, height = hHint;
  if (wHint == SWT.DEFAULT) width = 0x7FFFFFFF;
  if (hHint == SWT.DEFAULT) height = 0x7FFFFFFF;
  int [] result = layout (width, height, false);
  Point extent = new Point (result [1], result [2]);
  if (wHint != SWT.DEFAULT) extent.x = wHint;
  if (hHint != SWT.DEFAULT) extent.y = hHint;
  Rectangle trim = computeTrim (0, 0, extent.x, extent.y);
  return new Point (trim.width, trim.height);
}

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

void relayout () {
  if (!getDrawing()) return;
  Rectangle rect = getClientArea ();
  layout (rect.width, rect.height, true);
}

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

/**
 * Returns the number of rows in the receiver. When
 * the receiver has the <code>WRAP</code> style, the
 * number of rows can be greater than one.  Otherwise,
 * the number of rows is always one.
 *
 * @return the number of items
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 */
public int getRowCount () {
  checkWidget();
  Rectangle rect = getClientArea ();
  return layout (rect.width, rect.height, false) [0];
}

代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt

public void drop(MElementContainer<MUIElement> newContainer, int itemIndex) {
  if (dragElement.getParent() != null)
    dragElement.getParent().getChildren().remove(dragElement);
  if (itemIndex >= 0)
    newContainer.getChildren().add(itemIndex, dragElement);
  else
    newContainer.getChildren().add(dragElement);
  newContainer.setSelectedElement(dragElement);
  if (dragElement.getWidget() instanceof ToolItem) {
    ToolItem ti = (ToolItem) dragElement.getWidget();
    ToolBar tb = ti.getParent();
    tb.layout(true);
    tb.getParent()
        .layout(new Control[] { tb }, SWT.CHANGED | SWT.DEFER);
  }
  baseWindow.getChildren().remove(dragWindow);
  newContainer.setSelectedElement(dragElement);
  if (getShell() != null)
    getShell().dispose();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt

public void drop(MElementContainer<MUIElement> newContainer, int itemIndex) {
  if (dragElement.getParent() != null) {
    dragElement.getParent().getChildren().remove(dragElement);
  }
  if (itemIndex >= 0) {
    newContainer.getChildren().add(itemIndex, dragElement);
  } else {
    newContainer.getChildren().add(dragElement);
  }
  newContainer.setSelectedElement(dragElement);
  if (dragElement.getWidget() instanceof ToolItem) {
    ToolItem ti = (ToolItem) dragElement.getWidget();
    ToolBar tb = ti.getParent();
    tb.layout(true);
    tb.getParent()
        .layout(new Control[] { tb }, SWT.CHANGED | SWT.DEFER);
  }
  baseWindow.getWindows().remove(dragWindow);
  newContainer.setSelectedElement(dragElement);
  if (getShell() != null) {
    getShell().dispose();
  }
}

相关文章

ToolBar类方法