コード例 #1
0
  @Override
  public Window getWindow(String name) {
    // See if the window already exists in the application
    Window window = super.getWindow(name);

    // If a dynamically created window is requested, but
    // it does not exist yet, create it.
    if (window == null) {
      // Create the new window object
      window = new Window("Book Examples Window " + ++windowCount);

      // As the window did not exist, the name parameter is
      // an automatically generated name for a new window.
      window.setName(name);

      // Add it to the application as a regular
      // application-level window. This must be done before
      // calling open, which requires that the window
      // is attached to the application.
      addWindow(window);

      // Open it with the proper URL that includes the
      // automatically generated window name
      window.open(new ExternalResource(window.getURL()));

      // Fill the window with stuff
      init(window);
    }

    return window;
  }
コード例 #2
0
ファイル: Launcher.java プロジェクト: slytherator/BlueSmoke
  @Override
  public void init() {
    setMainWindow(mainWindow);
    setTheme("bluesmoke");

    helper = new SpringContextHelper(this);
    feed = (OHLCFeed) helper.getBean("feed");
    correlatorPool = (CorrelatorPool) helper.getBean("correlatorPool");
    correlatorBuilderManager =
        (CorrelatorBuilderManager) helper.getBean("correlatorBuilderManager");
    emulator = (PassageOfTimeEmulationWorker) helper.getBean("emulator");

    buildMainLayout();
    mainWindow.setContent(mainLayout);
    mainLayout.setSizeFull();
    mainWindow.addListener(
        new Window.CloseListener() {
          public void windowClose(Window.CloseEvent e) {
            analytics.terminate();
          }
        });
    mainWindow.addListener(
        new Window.ResizeListener() {
          public void windowResized(Window.ResizeEvent e) {
            analytics.resize();
          }
        });
    mainWindow.addComponent(pusher);
  }
コード例 #3
0
 private void closeDialog() {
   // dismiss the dialog
   Window applicationWindow = (Window) this.dialog.getParent();
   applicationWindow.removeWindow(this.dialog);
   this.dialog = null;
   this.userForm = null;
 }
コード例 #4
0
  public ConfirmDialog(
      String caption, String message, String okButtonText, String cancelButtonText) {
    super(caption);
    super.setModal(true);
    super.setClosable(false);
    super.setResizable(false);

    VerticalLayout windowLayout = new VerticalLayout();
    windowLayout.setMargin(true);

    // confirmation message
    windowLayout.addComponent(new Label(message, ContentMode.HTML));
    windowLayout.setSpacing(true);

    // buttons
    HorizontalLayout buttonsLayout = new HorizontalLayout();
    buttonsLayout.setWidth(100.0f, Unit.PERCENTAGE);
    windowLayout.addComponent(buttonsLayout);

    okButton = new Button(okButtonText);
    buttonsLayout.addComponent(okButton);
    okButton.setTabIndex(1);
    okButton.addClickListener(this);
    buttonsLayout.setComponentAlignment(okButton, Alignment.MIDDLE_CENTER);

    cancelButton = new Button(cancelButtonText);
    buttonsLayout.addComponent(cancelButton);
    cancelButton.setTabIndex(0);
    cancelButton.setClickShortcut(KeyCode.ESCAPE, null);
    cancelButton.addClickListener(this);
    buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_CENTER);

    super.setContent(windowLayout);
  }
コード例 #5
0
  @Override
  protected void setup(VaadinRequest request) {
    Window window = new Window("Non-draggable window", new Label());
    window.setDraggable(false);

    addWindow(window);
  }
コード例 #6
0
  void confirmDelete() {

    // Create the window...
    subwindow = new Window("Xoa ??");
    // ...and make it modal
    subwindow.setModal(true);

    // Configure the windws layout; by default a VerticalLayout
    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);
    layout.setSpacing(true);

    // Add some content; a label and a close-button
    Label message = new Label("Ban co chac chan muon xoa ?");
    subwindow.addComponent(message);

    Button close =
        new Button(
            "Co",
            new Button.ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {

                (subwindow.getParent()).removeWindow(subwindow);
              }
            });
    // The components added to the window are actually added to the window's
    // layout; you can use either. Alignments are set using the layout
    layout.addComponent(close);
    layout.setComponentAlignment(close, Alignment.TOP_RIGHT);
  } // end of confirmDelete
コード例 #7
0
ファイル: WebkitScrollbarTest.java プロジェクト: horun/vaadin
  @Override
  protected void setup(VaadinRequest request) {
    final VerticalLayout uiLayout = new VerticalLayout();
    uiLayout.setMargin(true);
    setContent(uiLayout);

    final VerticalLayout windowLayout = new VerticalLayout();

    final Window testWindow = new Window("WebKitFail", windowLayout);
    testWindow.setWidth(300, Unit.PIXELS);

    GridLayout gl = new GridLayout();
    gl.setHeight(null);
    gl.setWidth(100, Unit.PERCENTAGE);
    windowLayout.addComponent(gl);

    ListSelect listSelect = new ListSelect();
    listSelect.setWidth(100, Unit.PERCENTAGE);
    gl.addComponent(listSelect);
    gl.setMargin(true);

    final Button testButton =
        new Button(
            "Open Window",
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                UI.getCurrent().addWindow(testWindow);
              }
            });
    uiLayout.addComponent(testButton);
  }
コード例 #8
0
 private void showComponent(final Component component, final String name) {
   final VerticalLayout layout = new VerticalLayout();
   layout.setSizeUndefined();
   layout.setMargin(true);
   final Window window = new Window(name, layout);
   window.setSizeUndefined();
   component.setSizeUndefined();
   window.addComponent(component);
   getWindow().addWindow(window);
 }
コード例 #9
0
  @Override
  public void init() {
    window = new Window("Vaadin DB Tester");
    window.setSizeFull();
    setMainWindow(window);
    setTheme("runo");

    Panel panel = new MainPanel();
    window.addComponent(panel);
  }
コード例 #10
0
 @Override
 public Window getWindow(String name) {
   Window window = super.getWindow(name);
   if (window == null) {
     window = new MainDifferWindow();
     window.setSizeUndefined();
     window.setName(name);
     addWindow(window);
     window.open(new ExternalResource(window.getURL()));
   }
   return window;
 }
コード例 #11
0
 private void tambahUserYayasanbaru(UserOprYayasan i) {
   final Window win = new Window("Tambah User Baru");
   Component c = new TambahUserYayasan(i, win);
   VerticalLayout vl = new VerticalLayout();
   vl.setMargin(true);
   vl.addComponent(c);
   win.setContent(vl);
   win.setModal(true);
   win.setWidth("600px");
   win.center();
   UI.getCurrent().addWindow(win);
 }
コード例 #12
0
ファイル: TipiDialog.java プロジェクト: rolfdeboer/navajo
 public void setComponentValue(final String name, final Object object) {
   super.setComponentValue(name, object);
   if (name.equals("title")) {
     dialog.setCaption((String) object);
   }
   if ("icon".equals(name)) {
     dialog.setIcon(getResource(object));
   }
   if ("h".equals(name)) {
     dialog.setHeight("" + object + "px");
   }
   if ("w".equals(name)) {
     dialog.setWidth("" + object + "px");
   }
   if ("x".equals(name)) {
     dialog.setPositionX((Integer) object);
   }
   if ("y".equals(name)) {
     dialog.setPositionY((Integer) object);
   }
   if ("closable".equals(name)) {
     dialog.setClosable((Boolean) object);
   }
   if ("resizable".equals(name)) {
     dialog.setResizable((Boolean) object);
   }
 }
コード例 #13
0
  private void updateCalendarEventPopup(boolean newEvent) {
    if (scheduleEventPopup == null) {
      createCalendarEventPopup();
    }

    if (newEvent) {
      scheduleEventPopup.setCaption("New event");
    } else {
      scheduleEventPopup.setCaption("Edit event");
    }

    deleteEventButton.setVisible(!newEvent);
    deleteEventButton.setEnabled(!calendarComponent.isReadOnly());
    applyEventButton.setEnabled(!calendarComponent.isReadOnly());
  }
コード例 #14
0
  /** {@inheritdoc} */
  @Override
  public void init() {
    // Add a horizontal SplitPanel to the lower area
    final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSplitPosition(150, Sizeable.UNITS_PIXELS);
    horizontalSplitPanel.setSizeFull();

    final Window mainWindow = new Window("NodeGraph Widget Application");

    final Button openWindow = new Button("Open diagram");
    openWindow.addListener(
        new Button.ClickListener() {

          /** */
          private static final long serialVersionUID = -1522261898787739587L;

          /** {@inheritdoc} */
          @Override
          public void buttonClick(ClickEvent event) {
            final Window subwindow = new Window("Node Graph Widget");
            subwindow.setWidth("850px");
            subwindow.setHeight("500px");
            subwindow.setModal(true);

            final VerticalLayout layout = (VerticalLayout) subwindow.getContent();
            layout.setMargin(true);
            layout.setSpacing(true);
            layout.setSizeFull();

            final GraphComponent nodeGraphWidget = getNodeGraph();
            layout.addComponent(nodeGraphWidget);

            mainWindow.addWindow(subwindow);
          }
        });

    final HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeFull();

    horizontalSplitPanel.setFirstComponent(openWindow);
    horizontalSplitPanel.setSecondComponent(hl);

    mainWindow.setContent(horizontalSplitPanel);
    mainWindow.setSizeFull();

    this.setMainWindow(mainWindow);
  }
コード例 #15
0
  @Override
  protected void setup(VaadinRequest request) {
    htmlWindow = new Window("", new Label("HTML caption"));
    htmlWindow.setId("htmlWindow");
    htmlWindow.setCaptionAsHtml(true);
    htmlWindow.setPositionX(300);
    htmlWindow.setPositionY(200);

    textWindow = new Window("", new Label("Text caption"));
    textWindow.setId("textWindow");
    textWindow.setCaptionAsHtml(false);
    textWindow.setPositionX(300);
    textWindow.setPositionY(400);

    addWindow(htmlWindow);
    addWindow(textWindow);

    Button red =
        new Button(
            "Red",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption("<font style='color: red;'>This may or may not be red</font>");
              }
            });
    Button plainText =
        new Button(
            "Plain text",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption("This is just text");
              }
            });
    Button nullCaption =
        new Button(
            "Null",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption(null);
              }
            });
    Button empty =
        new Button(
            "Empty",
            new ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                setWindowCaption("");
              }
            });

    addComponents(red, plainText, nullCaption, empty);
    red.click();
  }
コード例 #16
0
  @Override
  public void init() {
    final Window main = new Window("Book Examples");
    main.setImmediate(true);
    setMainWindow(main);

    setTheme("book-examples");

    // Set session timeout to 10 seconds
    // ((WebApplicationContext)getContext()).getHttpSession().setMaxInactiveInterval(10);
    System.out.println(
        "Session timeout: "
            + ((WebApplicationContext) getContext()).getHttpSession().getMaxInactiveInterval()
            + " seconds");

    init(main);
  }
コード例 #17
0
  @Override
  public Undoer execute(List<VertexRef> targets, OperationContext operationContext) {
    UI mainWindow = operationContext.getMainWindow();
    CommandManager commandManager = m_commandManager;

    Window window = new Window();
    window.setModal(true);

    VerticalLayout layout = new VerticalLayout();
    for (Command command : commandManager.getHistoryList()) {
      layout.addComponent(new Label(command.toString()));
    }
    window.setContent(layout);

    mainWindow.addWindow(window);
    return null;
  }
コード例 #18
0
 @Override
 public void close() {
   super.close();
   orginalValues.clear();
   removeListeners();
   allComponents.clear();
   this.saveButton.setEnabled(false);
 }
コード例 #19
0
  public void showWindowForm() {

    itemDetilModel = new PerubahanHargaItemModel();
    itemDetilView = new PerubahanHargaItemView(itemDetilModel);
    itemDetilPresenter = new PerubahanHargaItemPresenter(itemDetilModel, itemDetilView);

    itemDetilView.setSizeFull();
    panelFormDetil.setContent(itemDetilView);

    windowForm = new Window();
    windowForm.setModal(true);

    windowForm.center();

    windowForm.setWidth("650px");
    windowForm.setHeight("300px");
    windowForm.setClosable(true);
    windowForm.setResizable(false);

    VerticalLayout content = new VerticalLayout();
    content.setMargin(true);
    content.setSizeFull();
    content.addComponent(panelFormDetil);
    windowForm.setContent(content);

    getUI().addWindow(windowForm);
  }
コード例 #20
0
  public Window getWindow() {
    if (!isFloatingWindow) {
      return null;
    }

    if (keyboardWindow == null) {
      keyboardWindow = new Window();
      keyboardWindow.setCaption("Virtual Keyboard");
      // keyboardWindow.setPositionX(200);
      // keyboardWindow.setPositionY(100);
      // keyboardWindow.setWidth("600");
      // keyboardWindow.setHeight("300");
      keyboardWindow.setVisible(false);
      keyboardWindow.setContent(this);
      keyboardWindow.setResizable(false);
    }
    return keyboardWindow;
  }
コード例 #21
0
 @Override
 public void showThreadMovePopup(
     final long threadId, final Long threadCategoryId, final List<Category> allCategories) {
   final Window window =
       new ThreadMoveComponent(
           threadId,
           threadCategoryId,
           allCategories,
           new ThreadMoveComponentListener() {
             @Override
             public void commit(final long threadId, final Long newCategoryId) {
               threadListing.removeThreadRow(threadId);
               getPresenter().move(threadId, newCategoryId);
             }
           });
   window.center();
   getUI().addWindow(window);
 }
コード例 #22
0
  private void buildMainWindow() {
    root = new FormLayout();
    root.addComponent(buildTopMenu());
    super.setContent(root);

    content = new LoginPanel();
    root.addComponent(content);

    root.addComponent(buildBottomMenu());
  }
コード例 #23
0
ファイル: Login.java プロジェクト: MunicipalOrg/AdminCDO
  public Login() {
    // TODO Auto-generated constructor stub
    VaadinSession.getCurrent().setAttribute("municipaldata", null);
    VaadinSession.getCurrent().setAttribute("barangaydata", null);
    VaadinSession.getCurrent().setAttribute("id", null);
    setSizeFull();
    dialog = new Window("Login");
    dialog.setClosable(false);
    dialog.setResizable(false);
    dialog.center();

    //		new CreateAccount();

    VerticalLayout content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(new MarginInfo(false, true, true, true));
    dialog.setContent(content);

    Label title = new Label("Login");
    title.addStyleName(ValoTheme.LABEL_H2);
    title.addStyleName(ValoTheme.LABEL_COLORED);

    HorizontalLayout form = new HorizontalLayout();
    form.setSpacing(true);
    form.addStyleName("wrapping");
    content.addComponent(form);

    username.setIcon(FontAwesome.USER);
    username.focus();
    form.addComponent(username);

    password.setIcon(FontAwesome.LOCK);
    form.addComponent(password);

    Button submit = new Button("Login");
    submit.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_RIGHT);
    submit.addStyleName(ValoTheme.BUTTON_PRIMARY);
    submit.setIcon(FontAwesome.ARROW_RIGHT);
    submit.setWidth("100%");
    submit.addListener(ClickEvent.class, this, "gotoMain");
    content.addComponent(submit);
  }
コード例 #24
0
  public void showWindow() {

    subwindow = new Window("Change Category Type");
    subwindow.setModal(true);

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    final TextField txtField = new TextField("Change Category Type");
    txtField.setValue(categoryType);
    subwindow.addComponent(txtField);

    Button close =
        new Button(
            "Close",
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                (subwindow.getParent()).removeWindow(subwindow);
              }
            });
    Button save =
        new Button(
            "Save",
            new Button.ClickListener() {
              @Override
              public void buttonClick(ClickEvent event) {
                String newCatType = txtField.getValue().toString();
                controller.updateComponentCategory(componentId, newCatType, itemId);
                (subwindow.getParent()).removeWindow(subwindow);
              }
            });
    HorizontalLayout hl = new HorizontalLayout();
    hl.addComponent(save);
    hl.addComponent(close);

    layout.addComponent(hl);
    subwindow.setWidth("350px");
    subwindow.addComponent(layout);
    router.getMainWindow().addWindow(subwindow);
  }
コード例 #25
0
  public void init() {
    Window window = new Window();

    setMainWindow(window);
    final HorizontalLayout hp = new HorizontalLayout();
    final Label label1 = new Label("Avec une tempature de ");
    label1.setWidth("150px");
    hp.addComponent(label1);
    final TextField temp = new TextField();
    temp.setWidth("20px");
    hp.addComponent(temp);
    final Label label2 = new Label("¡ et un vent ˆ ");
    label2.setWidth("100px");
    hp.addComponent(label2);
    final TextField wind = new TextField();
    wind.setWidth("20px");
    hp.addComponent(wind);
    final Label label3 = new Label(" km/h  produit une tempŽrateure ressentie ");
    label3.setWidth("200px");
    hp.addComponent(label3);
    final Label resultLabel = new Label();

    final Button submit =
        new Button(
            "de",
            new ClickListener() {

              @Override
              public void buttonClick(ClickEvent event) {
                Double result =
                    getTemperatureRessentie(
                        Double.valueOf((String) temp.getValue()),
                        Double.valueOf((String) wind.getValue()));
                resultLabel.setValue(result);

                hp.addComponent(resultLabel);
              }
            });
    hp.addComponent(submit);
    window.addComponent(hp);
  }
コード例 #26
0
  /* second version, using popup */
  public void onCreateUser() throws ViewFactoryException {
    // create view
    UserView view = this.createView(UserView.class);

    // configure the form with bean item
    this.userForm = view.getUserForm();
    User u = new User();
    u.setUserName("newuser");
    u.setFirstName("First name");
    u.setLastName("Last name");
    BeanItem<User> beanItem = new BeanItem<User>(u);
    this.userForm.setItemDataSource(beanItem);

    // create a window using caption from view
    this.dialog = new Window(view.getCaption());
    view.setCaption(null);
    this.dialog.setModal(true);
    dialog.addComponent(view);
    dialog.setWidth("300px");
    this.eventBus.showDialog(this.dialog);
  }
コード例 #27
0
  @Override
  public void init() {
    this.setTheme("wmhd");

    this.getContext().addTransactionListener(this);

    this.mainWindow = new Window("My Vaadin Application");

    this.setMainWindow(mainWindow);

    mainWindow.setContent(new LoginScreen(this));
  }
コード例 #28
0
ファイル: MochaApplication.java プロジェクト: vancezhao/mocha
 @Override
 public void init() {
   setTheme("mocha");
   Window window = new Window();
   window.setCaption(applicationTitle());
   window.setSizeFull();
   window.addStyleName("mocha-window");
   setMainWindow(window);
   boolean needLogin = true;
   // check user
   if (getUser() != null) {
     needLogin = false;
   } else {
     if (isDevelopMode()) {
       setUser(loadTestUser());
       needLogin = false;
     }
   }
   if (!needLogin) {
     AbstractMainPage homepage = SpringContextUtils.getBean("homepage", AbstractMainPage.class);
     homepage.setResponse(response);
     window.setContent(homepage);
   } else {
     LoginScreen loginScreen = new LoginScreen(cookieUsername);
     loginScreen.setResponse(response);
     window.setContent(loginScreen);
   }
 }
コード例 #29
0
ファイル: WindowsCssTest.java プロジェクト: Legioth/vaadin
  /**
   * @param caption
   * @param primaryStyleName - the style defined styleName
   * @param styleName - the user defined styleName
   * @return
   */
  private void createWindowWith(String caption, String primaryStyleName, String styleName) {

    Window window = new Window();
    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    window.setContent(layout);
    layout.addComponent(new Label("Some content"));

    if (caption != null) {
      window.setCaption(caption);
    }

    if (primaryStyleName != null) {
      window.addStyleName(primaryStyleName);
    }

    if (styleName != null) {
      window.addStyleName(styleName);
    }

    parent.getUI().addWindow(window);
  }
コード例 #30
0
 @Override
 public void init() {
   window = new Window("My Vaadin Application");
   setMainWindow(window);
   Button button = new Button("Click M e");
   button.addListener(
       new Button.ClickListener() {
         public void buttonClick(ClickEvent event) {
           window.addComponent(new Label("Thank you for clicking"));
         }
       });
   window.addComponent(button);
 }