com.vaadin.ui.Window类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(9.9k)|赞(0)|评价(0)|浏览(112)

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

Window介绍

[英]A component that represents a floating popup window that can be added to a UI. A window is added to a UI using UI#addWindow(Window).

The contents of a window is set using #setContent(Component) or by using the #Window(String,Component) constructor.

A window can be positioned on the screen using absolute coordinates (pixels) or set to be centered using #center()

The caption is displayed in the window header.

In Vaadin versions prior to 7.0.0, Window was also used as application level windows. This function is now covered by the UI class.
[中]一个组件,表示可以添加到UI的浮动弹出窗口。使用UI#addWindow(窗口)将窗口添加到UI。
使用#setContent(组件)或#window(字符串、组件)构造函数设置窗口的内容。
可以使用绝对坐标(像素)在屏幕上定位窗口,也可以使用#center()将窗口设置为居中
标题显示在窗口标题中。
在7.0.0之前的Vaadin版本中,windows还用作应用程序级窗口。这个函数现在由UI类覆盖。

代码示例

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

/**
   * Build window based on type.
   *
   * @return Window
   */
  public Window buildWindow() {
    final Window window = new Window(caption);
    window.setContent(content);
    window.setSizeUndefined();
    window.setModal(true);
    window.setResizable(false);

    decorateWindow(window);

    if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
      window.setClosable(false);
    }

    return window;
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Closes the principal select dialog window if present.<p>
 */
protected void closeWindow() {
  if (m_window != null) {
    m_window.close();
    m_window = null;
  }
}

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

private void createNotificationWindow() {
  notificationsWindow = new Window();
  notificationsWindow.setWidth(300.0F, Unit.PIXELS);
  notificationsWindow.addStyleName(STYLE_POPUP);
  notificationsWindow.addStyleName(STYLE_NO_CLOSEBOX);
  notificationsWindow.setClosable(true);
  notificationsWindow.setResizable(false);
  notificationsWindow.setDraggable(false);
  notificationsWindow.setId(UIComponentIdProvider.NOTIFICATION_UNREAD_POPUP_ID);
  notificationsWindow.addCloseListener(event -> refreshCaption());
  notificationsWindow.addBlurListener(this::closeWindow);
}

代码示例来源:origin: com.vaadin/vaadin-server

@Override
public void handleAction(Object sender, Object target) {
  if (window.isClosable()) {
    window.close();
  }
}

代码示例来源:origin: com.vaadin/vaadin-server

if (variables.containsKey("height") && (getHeightUnits() != Unit.PIXELS
    || (Integer) variables.get("height") != getHeight())) {
  sizeHasChanged = true;
if (variables.containsKey("width") && (getWidthUnits() != Unit.PIXELS
    || (Integer) variables.get("width") != getWidth())) {
  sizeHasChanged = true;
  setPositionX(x < 0 ? -1 : x);
  setPositionY(y < 0 ? -1 : y);
if (isClosable()) {
    close();
  fireResize();
  fireEvent(new FocusEvent(this));
} else if (variables.containsKey(BlurEvent.EVENT_ID)) {
  fireEvent(new BlurEvent(this));

代码示例来源:origin: org.aperteworkflow/gui-commons

public static Window modalWindow(String title, ComponentContainer content) {
  Window window = new Window(title, content);
  window.setClosable(false);
  window.setModal(true);
  window.setSizeUndefined();
  return window;
}

代码示例来源:origin: jreznot/electron-java-app

private void onMenuAbout() {
  Window helpWindow = new Window();
  helpWindow.setCaption("About");
  helpWindow.setModal(true);
  helpWindow.setResizable(false);
  helpWindow.setSizeUndefined();
  VerticalLayout content = new VerticalLayout();
  content.setSizeUndefined();
  content.setMargin(true);
  content.setSpacing(true);
  Label aboutLabel = new Label("Electron+Vaadin Demo\nAuthor: Yuriy Artamonov");
  aboutLabel.setContentMode(ContentMode.PREFORMATTED);
  aboutLabel.setSizeUndefined();
  content.addComponent(aboutLabel);
  Button okBtn = new Button("Ok", VaadinIcons.CHECK);
  okBtn.focus();
  okBtn.addClickListener(event -> helpWindow.close());
  content.addComponent(okBtn);
  content.setComponentAlignment(okBtn, Alignment.MIDDLE_CENTER);
  helpWindow.setContent(content);
  getUI().addWindow(helpWindow);
}

代码示例来源:origin: OpenNMS/opennms

final Window window = new Window("Preview");
window.setModal(true);
window.setClosable(true);
window.setResizable(false);
window.setWidth("80%");
window.setHeight("90%");
window.setContent(new VerticalLayout() {

代码示例来源:origin: org.ikasan/ikasan-dashboard-jar

public void buttonClick(Button.ClickEvent event)
  {
    ReplayStatusPanel panel = new ReplayStatusPanel(getReplayEvents(), (ReplayService) replayService, platformConfigurationService, topologyService);
    Window window = new Window("Replay Events");
    window.setHeight("80%");
    window.setWidth("80%");
    window.setModal(true);
    window.setContent(panel);
    UI.getCurrent().addWindow(window);
  }
});

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

private void showArtifactDetailsWindow(final SoftwareModule softwareModule) {
  final Window artifactDtlsWindow = new Window();
  artifactDtlsWindow.setCaption(HawkbitCommonUtil
      .getArtifactoryDetailsLabelId(softwareModule.getName() + "." + softwareModule.getVersion(), getI18n()));
  artifactDtlsWindow.setCaptionAsHtml(true);
  artifactDtlsWindow.setClosable(true);
  artifactDtlsWindow.setResizable(true);
  artifactDtlsWindow.setImmediate(true);
  artifactDtlsWindow.setWindowMode(WindowMode.NORMAL);
  artifactDtlsWindow.setModal(true);
  artifactDtlsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
  artifactDetailsLayout.getArtifactDetailsTable().setWidth(700, Unit.PIXELS);
  artifactDetailsLayout.getArtifactDetailsTable().setHeight(500, Unit.PIXELS);
  artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());
  artifactDtlsWindow.addWindowModeChangeListener(event -> {
    if (event.getWindowMode() == WindowMode.MAXIMIZED) {
      artifactDtlsWindow.setSizeFull();
      artifactDetailsLayout.setFullWindowMode(true);
      artifactDetailsLayout.createMaxArtifactDetailsTable();
      artifactDetailsLayout.getMaxArtifactDetailsTable().setWidth(100, Unit.PERCENTAGE);
      artifactDetailsLayout.getMaxArtifactDetailsTable().setHeight(100, Unit.PERCENTAGE);
      artifactDtlsWindow.setContent(artifactDetailsLayout.getMaxArtifactDetailsTable());
    } else {
      artifactDtlsWindow.setSizeUndefined();
      artifactDtlsWindow.setContent(artifactDetailsLayout.getArtifactDetailsTable());

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

public Window build() {
  Window dialog = new Window();
  dialog.addStyleName("light-box");
  dialog.setDraggable(false);
  dialog.setResizable(false);
  dialog.setModal(true);
  dialog.setWidth(95, Sizeable.Unit.PERCENTAGE);
  CssLayout contentWrapper = new CssLayout(content);
  contentWrapper.setSizeFull();
  contentWrapper.setStyleName("light-box-content");
  dialog.setContent(contentWrapper);
  dialog.center();
  return dialog;
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * @see org.opencms.ui.actions.I_CmsWorkplaceAction#executeAction(org.opencms.ui.I_CmsDialogContext)
 */
public void executeAction(final I_CmsDialogContext context) {
  CmsUserInfo dialog = new CmsUserInfo(new I_UploadListener() {
    public void onUploadFinished(List<String> uploadedFiles) {
      handleUpload(uploadedFiles, context);
    }
  }, context);
  Multimap<String, String> params = A_CmsUI.get().getParameters();
  int top = 55;
  int left = 0;
  if (params.containsKey("left")) {
    String buttonLeft = params.get("left").iterator().next();
    left = Integer.parseInt(buttonLeft) - 290;
  }
  final Window window = new Window();
  window.setModal(false);
  window.setClosable(true);
  window.setResizable(false);
  window.setContent(dialog);
  context.setWindow(window);
  window.addStyleName(OpenCmsTheme.DROPDOWN);
  UI.getCurrent().addWindow(window);
  window.setPosition(left, top);
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework

public Window buildAndOpen() {
    Window window = new Window();
    window.setCaption(this.title);
    window.setContent(this.build());
    window.center();
    window.setModal(this.modal);
    UI.getCurrent().addWindow(window);
    return window;
  }
}

代码示例来源:origin: org.ikasan/ikasan-dashboard-jar

/**
   * Helper method to initialise this object.
   * 
   * @param message
   */
  protected void init(String text)
  {
    super.setWidth("50%");
    super.setHeight("50%");
    super.setModal(true);
    super.setResizable(true);
    super.center();
    
    TextArea ta = new TextArea();
    ta.setSizeFull();
    ta.setValue(text);
    ta.setWordwrap(false);
        HorizontalLayout layout = new HorizontalLayout();
    layout.setMargin(true);
    layout.addComponent(ta);
    layout.setSizeFull();
        Panel p = new Panel();
    p.setSizeFull();
    p.setContent(layout);
    
    super.setContent(p);
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * Replaces the ui content with a single dialog.<p>
 *
 * @param caption the caption
 * @param dialog the dialog content
 */
public void setContentToDialog(String caption, CmsBasicDialog dialog) {
  setContent(new Label());
  Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow);
  window.setContent(dialog);
  window.setCaption(caption);
  window.setClosable(false);
  addWindow(window);
  window.center();
}

代码示例来源:origin: viritin/viritin

public Window openInModalPopup() {
  popup = new Window(getModalWindowTitle(), this);
  popup.setModal(true);
  UI.getCurrent().addWindow(popup);
  focusFirst();
  return popup;
}

代码示例来源:origin: com.haulmont.thirdparty/popupbutton

public void buttonClick(ClickEvent event) {
    Window w = new Window();
    w.center();
    w.setContent(createPopupButton());
    addWindow(w);
  }
});

代码示例来源:origin: stackoverflow.com

pan[beNumber].addClickListener(new MouseEvents.ClickListener() {

  private static final long serialVersionUID = 1L;

  @Override
  public void click(MouseEvents.ClickEvent event) {

    // Create a sub-window and set the content
    Window subWindow = new PatientTranfserWindow("Patient Transfer", new WardMovementView());
    subWindow.setCaptionAsHtml(true);
    subWindow.setModal(true);
    subWindow.setWidth("1200px");
    subWindow.setHeight("800px");
    subWindow.setBENumber(beNumber);
    UI.getCurrent().addWindow(subWindow);

  }
});

代码示例来源:origin: org.aperteworkflow/editor

@Override
public void init() {
  Window mainWindow = new Window("");
  setMainWindow(mainWindow);
  mainWindow.removeAllComponents();
  HorizontalLayout main = new HorizontalLayout();
  main.setSpacing(true);
  main.setMargin(true);
  main.setWidth(100, Sizeable.UNITS_PERCENTAGE);
  mainWindow.setContent(main);
}

代码示例来源:origin: org.aperteworkflow/editor

@Override
public void init() {
  super.init();
  mainWindow = new Window(I18NSource.ThreadUtil.getThreadI18nSource().getMessage("application.title"));
  jsHelper = new JavaScriptHelper(mainWindow);
  jsHelper.preventWindowClosing();
  mainWindow.addParameterHandler(this);
  setMainWindow(mainWindow);
}

相关文章

微信公众号

最新文章

更多