Java 类com.vaadin.ui.Window 实例源码

项目:holon-vaadin7    文件:NavigatorActuator.java   
/**
 * Close all opened Windows displaying Views
 */
protected void closeAllViewWindows() {
    for (Entry<String, WeakReference<Window>> entry : viewWindows.entrySet()) {

        // remove Window
        WeakReference<Window> windowRef = viewWindows.get(entry.getKey());
        if (windowRef != null && windowRef.get() != null && windowRef.get().getParent() != null) {
            // if was displayed in Window, close the Window
            try {
                navigateBackOnWindowClose = false;
                windowRef.get().close();
            } finally {
                navigateBackOnWindowClose = true;
            }
        }
        viewWindows.remove(entry.getKey());

        // remove from history
        if (!getNavigationHistory().isEmpty()) {
            getNavigationHistory().remove(entry.getKey());
        }

    }
}
项目:holon-vaadin7    文件:NavigatorActuator.java   
/**
 * If current View is displayed in a Window, close the Window and removes navigation state from history
 * @return <code>true</code> if current View was displayed in a Window and it was closed
 */
protected boolean closeCurrentViewWindow() {
    // check current View is displayed in Window
    if (!getNavigationHistory().isEmpty() && viewWindows.containsKey(getNavigationHistory().peek())) {

        // remove from history
        String navigationState = getNavigationHistory().pop();

        WeakReference<Window> windowRef = viewWindows.get(navigationState);
        if (windowRef != null && windowRef.get() != null && windowRef.get().getParent() != null) {
            // if was displayed in Window, close the Window
            try {
                navigateBackOnWindowClose = false;
                windowRef.get().close();
            } finally {
                navigateBackOnWindowClose = true;
            }
        }
        viewWindows.remove(navigationState);

        // closed and removed from history
        return true;

    }
    return false;
}
项目:holon-vaadin    文件:NavigatorActuator.java   
/**
 * If current View is displayed in a Window, close the Window
 */
protected void closeCurrentViewWindow() {
    final String currentState = navigator.getState();
    if (currentState != null && viewWindows.containsKey(currentState)) {
        synchronized (viewWindows) {
            final WeakReference<Window> windowRef = viewWindows.get(currentState);
            if (windowRef != null && windowRef.get() != null && windowRef.get().getParent() != null) {
                // if was displayed in Window, close the Window
                try {
                    navigateBackOnWindowClose = false;
                    windowRef.get().close();
                } finally {
                    navigateBackOnWindowClose = true;
                }
            }
            viewWindows.remove(currentState);
        }
    }
}
项目:kumoreg    文件:AttendeeSearchPresenter.java   
public void saveAttendeeAndPrePrintBadge(Window window, Attendee attendee) {
    try {
        if (view.currentUserHasRight("attendee_edit")) {
            attendeeValidator.validate(attendee);        // Only validate fields if the user actually has the ability to edit them
        }
        attendee.addHistoryEntry(view.getCurrentUser(), "Pre-printed badge");
        attendee.setBadgePrePrinted(true);
        attendee = attendeeRepository.save(attendee);
        log.info("{} saved {}", view.getCurrentUsername(), attendee);
        view.refresh();
    } catch (ValidationException e) {
        view.notifyError(e.getMessage());
        log.error("{} tried to save {} and got error {}", view.getCurrentUsername(), attendee, e.getMessage());
        return;
    }

    window.close();
    List<Attendee> attendeeList = new ArrayList<>();
    attendeeList.add(attendee);

    if (view.currentUserHasRight("pre_print_badges")) {
            log.info("{} pre-printing badge(s) for {}", view.getCurrentUsername(), attendee);
            showAttendeeBadgeWindow(view, attendeeList, true);
    }
}
项目:kumoreg    文件:PrintBadgeWindow.java   
public void showBadgesInBrowser(List<Attendee> attendeeList) {
    if (attendeeList.size() > 0) {
        StreamResource.StreamSource source = handler.getBadgeFormatter(this, attendeeList);
        String filename = "testbadge" + System.currentTimeMillis() + ".pdf";
        StreamResource resource = new StreamResource(source, filename);

        resource.setMIMEType("application/pdf");
        resource.getStream().setParameter("Content-Disposition", "attachment; filename="+filename);

        Window window = new Window();
        window.setWidth(800, Sizeable.Unit.PIXELS);
        window.setHeight(600, Sizeable.Unit.PIXELS);
        window.setModal(true);
        window.center();
        BrowserFrame pdf = new BrowserFrame("test", resource);
        pdf.setSizeFull();

        window.setContent(pdf);
        getUI().addWindow(window);
    } else {
        Notification.show("No attendees selected");
    }
}
项目:dungeonstory-java    文件:SpellChoiceForm.java   
private void getSpellWindow(Spell spell) {
    Messages messages = Messages.getInstance();
    Window window = new Window(spell.getName());
    window.setModal(true);
    window.setWidth("60%");

    CollectionToStringConverter converter = new CollectionToStringConverter();

    FormLayout layout = new FormLayout();
    DSLabel componentType = new DSLabel(messages.getMessage("spellStep.component.label"),
            converter.convertToPresentation(spell.getComponentTypes(), new ValueContext()));
    DSLabel text = new DSLabel(messages.getMessage("spellStep.description.label"), spell.getDescription());
    layout.addComponents(componentType, text);

    //TODO : other useful info

    window.setContent(layout);
    UI.getCurrent().addWindow(window);
}
项目:dungeonstory-java    文件:SubSetSelector.java   
protected void addEntity(String input) {

        ET newInstance = instantiator.apply(input);

        if (newInstanceForm != null) {
            String caption = "Add new " + elementType.getSimpleName();
            newInstanceForm.setEntity(newInstance);
            newInstanceForm.setSavedHandler(this);
            newInstanceForm.setResetHandler(this);
            Window w = newInstanceForm.openInModalPopup();
            w.setWidth("70%");
            w.setCaption(caption);
        } else {
            onSave(newInstance);
        }
    }
项目:cuba    文件:DefaultExceptionHandler.java   
protected void showDialog(App app, Throwable exception) {
    Throwable rootCause = ExceptionUtils.getRootCause(exception);
    if (rootCause == null) {
        rootCause = exception;
    }
    ExceptionDialog dialog = new ExceptionDialog(rootCause);
    AppUI ui = app.getAppUI();
    for (Window window : ui.getWindows()) {
        if (window.isModal()) {
            dialog.setModal(true);
            break;
        }
    }
    ui.addWindow(dialog);
    dialog.focus();
}
项目:hybridbpm    文件:DevelopmentView.java   
public static void openModule(Module Module, Window.CloseListener closeListener) {
    final ModuleLayout moduleLayout = new ModuleLayout(Module);
    final ConfigureWindow configureWindow = new ConfigureWindow(moduleLayout, "New Module");
    Button.ClickListener clickListener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            try {
            if (event.getButton().equals(configureWindow.btnClose)) {

            } else if (event.getButton().equals(configureWindow.btnOk)) {
                moduleLayout.save();
            }
            configureWindow.close();
            } catch (RuntimeException re){
                logger.log(Level.SEVERE, re.getMessage(), re);
                Notification.show("Error", re.getMessage(), Notification.Type.ERROR_MESSAGE);
            }
        }
    };
    configureWindow.setClickListener(clickListener);
    configureWindow.addCloseListener(closeListener);
    HybridbpmUI.getCurrent().addWindow(configureWindow);
}
项目:hybridbpm    文件:ProcessEditor.java   
@Override
public void buttonClick(Button.ClickEvent event) {
    try {
        if (event.getButton().equals(btnSave)) {
            processModel.setName(Module.getName());
            Module.setModel(HybridbpmCoreUtil.objectToJson(processModel));
            Module = HybridbpmUI.getDevelopmentAPI().saveModule(Module);
            binder.setItemDataSource(Module);
        } else if (event.getButton().equals(btnData)) {
            ProcessConfigureWindow pcw = new ProcessConfigureWindow();
            pcw.initUI(processModelLayout);
            pcw.addCloseListener(new Window.CloseListener() {

                @Override
                public void windowClose(Window.CloseEvent e) {
                    setProcessModel(processModelLayout.getProcessModel());
                }
            });
            HybridbpmUI.getCurrent().addWindow(pcw);
        }
    } catch (IllegalArgumentException | NullPointerException ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
    }
}
项目:hybridbpm    文件:UsersLayout.java   
public static void openUserEditor(User user, Window.CloseListener closeListener) {
    final UserLayout userLayout = new UserLayout(user);
    final ConfigureWindow configureWindow = new ConfigureWindow(userLayout, "User");
    Button.ClickListener clickListener = new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            if (event.getButton().equals(configureWindow.btnClose)) {
                configureWindow.close();
            } else if (event.getButton().equals(configureWindow.btnOk)) {
                userLayout.save();
            }
        }
    };
    configureWindow.setClickListener(clickListener);
    configureWindow.addCloseListener(closeListener);
    configureWindow.setSizeUndefined();
    HybridbpmUI.getCurrent().addWindow(configureWindow);
}
项目:kumoreg    文件:AttendeeSearchPresenter.java   
public void saveAttendeeAndPrePrintBadge(Window window, Attendee attendee) {
    try {
        if (view.currentUserHasRight("attendee_edit")) {
            attendeeValidator.validate(attendee);        // Only validate fields if the user actually has the ability to edit them
        }
        attendee.addHistoryEntry(view.getCurrentUser(), "Pre-printed badge");
        attendee.setBadgePrePrinted(true);
        attendee = attendeeRepository.save(attendee);
        log.info("{} saved {}", view.getCurrentUsername(), attendee);
        view.refresh();
    } catch (ValidationException e) {
        view.notifyError(e.getMessage());
        log.error("{} tried to save {} and got error {}", view.getCurrentUsername(), attendee, e.getMessage());
        return;
    }

    window.close();
    List<Attendee> attendeeList = new ArrayList<>();
    attendeeList.add(attendee);

    if (view.currentUserHasRight("pre_print_badges")) {
            log.info("{} pre-printing badge(s) for {}", view.getCurrentUsername(), attendee);
            showAttendeeBadgeWindow(view, attendeeList, true);
    }
}
项目:kumoreg    文件:PrintBadgeWindow.java   
public void showBadgesInBrowser(List<Attendee> attendeeList) {
    if (attendeeList.size() > 0) {
        StreamResource.StreamSource source = handler.getBadgeFormatter(this, attendeeList);
        String filename = "testbadge" + System.currentTimeMillis() + ".pdf";
        StreamResource resource = new StreamResource(source, filename);

        resource.setMIMEType("application/pdf");
        resource.getStream().setParameter("Content-Disposition", "attachment; filename="+filename);

        Window window = new Window();
        window.setWidth(800, Sizeable.Unit.PIXELS);
        window.setHeight(600, Sizeable.Unit.PIXELS);
        window.setModal(true);
        window.center();
        BrowserFrame pdf = new BrowserFrame("test", resource);
        pdf.setSizeFull();

        window.setContent(pdf);
        getUI().addWindow(window);
    } else {
        Notification.show("No attendees selected");
    }
}
项目:hawkbit    文件:UploadResultWindow.java   
private void createLayout() {
    final HorizontalLayout footer = new HorizontalLayout();
    footer.setSizeUndefined();
    footer.addStyleName("confirmation-window-footer");
    footer.setSpacing(true);
    footer.setMargin(false);
    footer.addComponents(closeBtn);
    footer.setComponentAlignment(closeBtn, Alignment.TOP_CENTER);

    final VerticalLayout uploadResultDetails = new VerticalLayout();
    uploadResultDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
    uploadResultDetails.addStyleName("confirmation-popup");
    uploadResultDetails.addComponent(uploadResultTable);
    uploadResultDetails.setComponentAlignment(uploadResultTable, Alignment.MIDDLE_CENTER);
    uploadResultDetails.addComponent(footer);
    uploadResultDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);

    uploadResultsWindow = new Window();
    uploadResultsWindow.setContent(uploadResultDetails);
    uploadResultsWindow.setResizable(Boolean.FALSE);
    uploadResultsWindow.setClosable(Boolean.FALSE);
    uploadResultsWindow.setDraggable(Boolean.TRUE);
    uploadResultsWindow.setModal(true);
    uploadResultsWindow.setCaption(SPUILabelDefinitions.UPLOAD_RESULT);
    uploadResultsWindow.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}
项目:hawkbit    文件:UploadConfirmationWindow.java   
private void buildLayout() {
    final HorizontalLayout footer = getFooterLayout();

    uploadArtifactDetails = new VerticalLayout();
    uploadArtifactDetails.setWidth(SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH + "px");
    uploadArtifactDetails.addStyleName("confirmation-popup");
    uploadArtifactDetails.addComponent(uploadDetailsTable);
    uploadArtifactDetails.setComponentAlignment(uploadDetailsTable, Alignment.MIDDLE_CENTER);
    uploadArtifactDetails.addComponent(footer);
    uploadArtifactDetails.setComponentAlignment(footer, Alignment.MIDDLE_CENTER);

    window = new Window();
    window.setContent(uploadArtifactDetails);
    window.setResizable(Boolean.FALSE);
    window.setClosable(Boolean.TRUE);
    window.setDraggable(Boolean.TRUE);
    window.setModal(true);
    window.addCloseListener(event -> onPopupClose());
    window.setCaption(i18n.getMessage("header.caption.upload.details"));
    window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
}
项目:hawkbit    文件:WindowBuilder.java   
/**
 * 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;
}
项目:vaadin-jsclipboard-addon    文件:DeprecatedWayView.java   
private Window createOldWaySourceWindow() {
    Window sourceWindow = new Window("Example");
    VerticalLayout content = new VerticalLayout();
    content.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    Label sourceCode = new Label("<pre><code>" + "        final TextArea anotherArea = new TextArea();\n"
            + "        anotherArea.setId(\"clipboardTarget\");\n"
            + "        anotherArea.setValue(\"Another example to copy to clipboard\");\n" + "\n"
            + "        ClipboardButton clipboardButton = new ClipboardButton(\"clipboardTarget\");\n"
            + "        clipboardButton.addSuccessListener(new ClipboardButton.SuccessListener() {\n" + "\n"
            + "            @Override\n" + "            public void onSuccess() {\n"
            + "                Notification.show(\"Copy to clipboard successful\");\n" + "            }\n"
            + "        });\n" + "        clipboardButton.addErrorListener(new ClipboardButton.ErrorListener() {\n"
            + "\n" + "            @Override\n" + "            public void onError() {\n"
            + "                Notification.show(\"Copy to clipboard unsuccessful\", Notification.Type.ERROR_MESSAGE);\n"
            + "            }\n" + "        });</code></pre>", ContentMode.HTML);

    content.addComponent(new HorizontalLayout(sourceCode));
    sourceWindow.setContent(content);
    sourceWindow.setHeight("400px");
    return sourceWindow;
}
项目:primecloud-controller    文件:WinServerAdd.java   
@SuppressWarnings("unchecked")
private void attachButtonClick(ClickEvent event) {
    if (cloudTable.getValue() == null || imageTable.getValue() == null) {
        return;
    }

    ImageDto image = findImage(cloudTable.getValue(), imageTable.getValue());

    WinServerAttachService winServerAttachService = new WinServerAttachService(null, image,
            selectedComponentNos);
    winServerAttachService.addListener(new Window.CloseListener() {
        @Override
        public void windowClose(Window.CloseEvent e) {
            List<Long> componentNos = (List<Long>) ContextUtils.getAttribute("componentNos");
            if (componentNos != null) {
                ContextUtils.removeAttribute("componentNos");
                selectedComponentNos = componentNos;
            }
        }
    });

    getWindow().getApplication().getMainWindow().addWindow(winServerAttachService);
}
项目:primecloud-controller    文件:LoadBalancerButtonsBottom.java   
private void editButtonClick(ClickEvent event) {
    LoadBalancerDto loadBalancer = (LoadBalancerDto) sender.loadBalancerPanel.loadBalancerTable.getValue();

    Window winLoadBalancerEdit;
    if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(loadBalancer.getLoadBalancer().getType())) {
        winLoadBalancerEdit = new WinCloudStackLoadBalancerEdit(loadBalancer.getLoadBalancer().getLoadBalancerNo());
    } else {
        winLoadBalancerEdit = new WinLoadBalancerEdit(loadBalancer.getLoadBalancer().getLoadBalancerNo());
    }

    winLoadBalancerEdit.addListener(new Window.CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            refreshTable();
        }
    });

    getWindow().addWindow(winLoadBalancerEdit);
}
项目:primecloud-controller    文件:AutoApplication.java   
@Override
public void init() {
    // エラーハンドリング
    setErrorHandler(new ErrorHandler(this));

    // ログアウト後の画面設定
    String logoutUrl;
    try {
        logoutUrl = new URL(getURL(), "..").toExternalForm();
    } catch (MalformedURLException e) {
        logoutUrl = "../../../";
    }
    setLogoutURL(logoutUrl);

    Window mainWindow = new Window(ViewProperties.getCaption("window.main"));
    mainWindow.setWidth("960px");
    mainWindow.setHeight("100%");
    setTheme("classy");
    setMainWindow(mainWindow);

    MainView mainView = new MainView();
    mainWindow.setContent(mainView);
}
项目:opennmszh    文件:HistoryOperation.java   
@Override
public Undoer execute(List<VertexRef> targets,
        OperationContext operationContext) {
    Window mainWindow = operationContext.getMainWindow();
    CommandManager commandManager = m_commandManager;

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

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

    mainWindow.addWindow(window);
    return null;
}
项目:opennmszh    文件:CommandManager.java   
/**
 * Gets the ContextMenu addon for the app based on OSGi Operations
 * @param graphContainer
 * @param mainWindow
 * @return
 */
public TopoContextMenu getContextMenu(GraphContainer graphContainer, Window mainWindow) {
    OperationContext opContext = new DefaultOperationContext(mainWindow, graphContainer, DisplayLocation.CONTEXTMENU);
    ContextMenuBuilder contextMenuBuilder = new ContextMenuBuilder();
    Map<String, Operation> operationMap = new HashMap<String, Operation>(); 
    for (Command command : m_commandList) {
        if (command.isAction()) {
            String contextPosition = command.getContextMenuPosition();
            contextMenuBuilder.addMenuCommand(command, contextPosition);
            operationMap.put(command.toString(), command.getOperation());
        }
    }
    TopoContextMenu contextMenu = contextMenuBuilder.get();
    contextMenu.addListener(new ContextMenuListener(opContext));

    updateContextCommandToOperationMap(contextMenu.getItems());
    return contextMenu;
}
项目:opennmszh    文件:CommandManager.java   
public MenuBar.Command menuCommand(final Command command,
        final GraphContainer graphContainer, final Window mainWindow,
        final OperationContext operationContext, final SelectionManager selectionManager) {

    return new MenuBar.Command() {

        public void menuSelected(MenuItem selectedItem) {
            List<VertexRef> targets = new ArrayList<VertexRef>(selectionManager.getSelectedVertexRefs());

            DefaultOperationContext context = (DefaultOperationContext) operationContext;
            context.setChecked(selectedItem.isChecked());

            command.doCommand(targets, operationContext);
            m_commandHistoryList.add(command);
            updateMenuItemListeners();
        }
    };
}
项目:opennmszh    文件:CommandManager.java   
public void updateMenuItem(MenuItem menuItem, GraphContainer graphContainer, Window mainWindow, SelectionManager selectionManager) {
    DefaultOperationContext operationContext = new DefaultOperationContext(mainWindow, graphContainer, DisplayLocation.MENUBAR);
    Operation operation = getOperationByMenuItemCommand(menuItem.getCommand());

    //Check for null because separators have no Operation
    if(operation != null) {
        List<VertexRef> selectedVertices = new ArrayList<VertexRef>(selectionManager.getSelectedVertexRefs());
        boolean visibility = operation.display(selectedVertices, operationContext);
        menuItem.setVisible(visibility);
        boolean enabled = operation.enabled(selectedVertices, operationContext);
        menuItem.setEnabled(enabled);

        if (operation instanceof CheckedOperation) {
            if (!menuItem.isCheckable()) {
                menuItem.setCheckable(true);
            }

            menuItem.setChecked(((CheckedOperation) operation).isChecked(selectedVertices, operationContext));
        }
    }
}
项目:opennmszh    文件:TracerouteWindowTest.java   
@Before
public void setUp() throws Exception {
    Node testNode1 = new Node(9,"172.20.1.10","Cartman");
    traceWindow = new TracerouteWindow(testNode1, "http://localhost:8080/");
    traceWindow2 = new TracerouteWindow(null, "http://localhost:8080/");
    traceWindow3 = new TracerouteWindow(testNode1, "");
    mainWindow = new Window();
    app = new Application() { //Empty Application
        @Override
        public void init() {}
    };
    app.setMainWindow(mainWindow);
    app.getMainWindow().addWindow(traceWindow);
    app.getMainWindow().addWindow(traceWindow2);
    app.getMainWindow().addWindow(traceWindow3);
}
项目:opennmszh    文件:PingWindowTest.java   
@Before
public void setUp() throws Exception {
    Node testNode1 = new Node(9,"172.20.1.10","Cartman");

    pingWindow = new PingWindow(testNode1, "http://Localhost:8080/");
    pingWindow2 = new PingWindow(null, "http://localhost:8080/");
    pingWindow3 = new PingWindow(testNode1, "");

    mainWindow = new Window();
    app = new Application() { //Empty Application
        @Override
        public void init() {}
    };
    app.setMainWindow(mainWindow);
    app.getMainWindow().addWindow(pingWindow);
    app.getMainWindow().addWindow(pingWindow2);
    app.getMainWindow().addWindow(pingWindow3);
}
项目:opennmszh    文件:SSHTerminalTest.java   
@SuppressWarnings("serial")
@Before
public void setUp() throws Exception {

    app = new Application() {
        @Override
        public void init() {}
    };
    mainWindow = new Window();
    app.setMainWindow(mainWindow);

    SSHWindow sshWindow = new SSHWindow(null, 200, 200);
    app.getMainWindow().addWindow(sshWindow);

    SshClient client = SshClient.setUpDefaultClient();
    client.start();
    ClientSession session = null;
    try {
        session = client.connect(testHost, testPort).await().getSession();
    } catch (Exception e) {
        fail("Could not connect to host");
    }
    sshTerm = new SSHTerminal(sshWindow, session, 200, 200);
    sshWindow.addComponent(sshTerm);
}
项目:opennmszh    文件:SSHWindowTest.java   
@SuppressWarnings("serial")
@Before
   public void setup () {
       app = new Application() {
           @Override
           public void init() {}
       };
       sshWindow = new SSHWindow(null, 200, 200);
       client = SshClient.setUpDefaultClient();
       client.start();
       try {
        session = client.connect(testHost, testPort).await().getSession();
    } catch (Exception e) {
        fail("Could not connect to host");
    }
       sshWindow2 = new SSHWindow(session, 200, 200);
       mainWindow = new Window();
       app.setMainWindow(mainWindow);
       app.getMainWindow().addWindow(sshWindow);
       app.getMainWindow().addWindow(sshWindow2);

   }
项目:opennmszh    文件:AuthWindowTest.java   
@SuppressWarnings("serial")
@Before
public void setup (){     
    normalWindow = new AuthWindow(testHost, testPort);
    noPortWindow = new AuthWindow(testHost, emptyPort);
    noHostWindow = new AuthWindow(emptyHost, testPort);
    emptyWindow = new AuthWindow(emptyHost, emptyPort);
    invalidHostWindow = new AuthWindow(invalidHost, testPort);

    mainWindow = new Window();
    app = new Application() { //Empty Application
        @Override
        public void init() {}
    };
    app.setMainWindow(mainWindow);
    app.getMainWindow().addWindow(normalWindow);
    app.getMainWindow().addWindow(noHostWindow);
    app.getMainWindow().addWindow(noPortWindow);
    app.getMainWindow().addWindow(emptyWindow);
    app.getMainWindow().addWindow(invalidHostWindow);

}
项目:opennmszh    文件:MibCompilerApplication.java   
@Override
public void init() {
    if (eventProxy == null)
        throw new RuntimeException("eventProxy cannot be null.");
    if (eventConfDao == null)
        throw new RuntimeException("eventConfDao cannot be null.");
    if (dataCollectionDao == null)
        throw new RuntimeException("dataCollectionDao cannot be null.");

    setTheme(Runo.THEME_NAME);

    final HorizontalSplitPanel mainPanel = new HorizontalSplitPanel();
    final MibConsolePanel mibConsole = new MibConsolePanel();
    final MibCompilerPanel mibPanel = new MibCompilerPanel(dataCollectionDao, eventConfDao, eventProxy, mibParser, mibConsole);

    mainPanel.setSizeFull();
    mainPanel.setSplitPosition(25, Sizeable.UNITS_PERCENTAGE);
    mainPanel.addComponent(mibPanel);
    mainPanel.addComponent(mibConsole);

    final Window mainWindow = new Window("MIB Compiler Application", mainPanel);
    setMainWindow(mainWindow);
}
项目:opennmszh    文件:SnmpCollectionAdminApplication.java   
@Override
public void init() {
    if (dataCollectionDao == null)
        throw new RuntimeException("dataCollectionDao cannot be null.");

    setTheme(Runo.THEME_NAME);

    Logger logger = new SimpleLogger();
    SnmpCollectionPanel scAdmin = new SnmpCollectionPanel(dataCollectionDao, logger);
    DataCollectionGroupAdminPanel dcgAdmin = new DataCollectionGroupAdminPanel(dataCollectionDao);

    TabSheet tabs = new TabSheet();
    tabs.setStyleName(Runo.TABSHEET_SMALL);
    tabs.setSizeFull();
    tabs.addTab(scAdmin);
    tabs.addTab(dcgAdmin);

    final Window mainWindow = new Window("SNMP Collection Administration", tabs);
    setMainWindow(mainWindow);
}
项目:gantt    文件:DemoUI.java   
private void commit(final Window win, final Binder<? extends AbstractStep> binder,
        final NativeSelect<Step> parentStepSelect) {
    AbstractStep step = binder.getBean();
    gantt.markStepDirty(step);
    if (parentStepSelect.isEnabled() && parentStepSelect.getValue() != null) {
        SubStep subStep = addSubStep(parentStepSelect, step);
        step = subStep;
    }
    if (step instanceof Step && !gantt.getSteps().contains(step)) {
        gantt.addStep((Step) step);
    }
    if (ganttListener != null && step instanceof Step) {
        ganttListener.stepModified((Step) step);
    }
    win.close();
}
项目:ExpressZip    文件:MapToolbarViewComponent.java   
@Override
public void buttonClick(ClickEvent event) {
    Button b = event.getButton();
    if (b == btnJobQueueStatus) {
        Window subWindow = new Window("Job Manager");
        subWindow.setWidth("500px");
        subWindow.center();
        getApplication().getMainWindow().addWindow(subWindow);

        Panel p = new Panel(new JobsStatusViewComponent(getApplication().getURL()));
        p.getContent().setWidth("100%");
        p.setWidth("100%");
        subWindow.addComponent(p);
        subWindow.setModal(true);
    } else if (b == help) {
        String HelpURL = getApplication().getURL().toExternalForm() + "doc";
        getApplication().getMainWindow().open(new ExternalResource(HelpURL), "_blank");
    } else if (b == restart) {
        ((ExpressZipWindow) getApplication().getMainWindow()).getApplication().close();
    }
}
项目:enterprise-app    文件:MDIWindow.java   
protected void placeWindow(Window window) {
    window.setPositionX(xCurrent);
    window.setPositionY(yCurrent);

    xCurrent += 30;
    yCurrent += 30;

    if(xCurrent >= 400) {
        xCurrent = xStart;
    }

    if(yCurrent >= 300) {
        yCurrent = yStart;
    }

}
项目:extacrm    文件:FormUtils.java   
public static void showModalWin(final ExtaEditForm<?> editWin) {

        final Window window = new Window(editWin.getCaption(), editWin);
        window.setClosable(true);
        window.setModal(true);

        if (editWin.getWinHeight() != Sizeable.SIZE_UNDEFINED)
            window.setHeight(editWin.getWinHeight(), editWin.getWinHeightUnit());
        if (editWin.getWinWidth() != Sizeable.SIZE_UNDEFINED)
            window.setWidth(editWin.getWinWidth(), editWin.getWinWidthUnit());

        window.addCloseListener(event -> editWin.fireCloseForm());
        editWin.addCloseFormListener(event -> window.close());

        if (editWin.getWinHeight() != Sizeable.SIZE_UNDEFINED && editWin.getWinWidth() != Sizeable.SIZE_UNDEFINED)
            editWin.addAttachListener(e -> editWin.adjustSize());
        else
            new WinSizeAdjuster(editWin, window);

        UI.getCurrent().addWindow(window);
    }
项目:konekti    文件:SecurityAccessView.java   
@Override
public void attach() {

    super.attach();

    loginWindow = new Window();

    // create view bound form
    VerticalLayout content = buildMainLayout();
    content.setMargin(false);
    loginWindow.setContent(content);
    loginWindow.center();
    loginWindow.setCaption(getI18N().getMessage("com.thingtrack.konekti.view.web.workbench.SecurityAccessView.loginWindow.caption"));       
    loginWindow.setModal(true);
    loginWindow.setResizable(false);
    loginWindow.setClosable(false);

    User loginUser = new User();
    BeanItem<User> userBean = new BeanItem<User>(loginUser);
    viewBoundForm.setItemDataSource(userBean);

    getWindow().addWindow(loginWindow);
}
项目:scoutmaster    文件:EventForm.java   
/**
 *
 * @param newButtonListener
 * @param sender
 *            the user who is sending this email.
 */
public EventForm(final Window owner, final au.org.scoutmaster.domain.Event event,
        final SaveEventListener newEventListener)
{
    this.owner = owner;
    this.event = event;
    this.newEventListener = newEventListener;

    final EventDao daoEvent = new DaoFactory().getEventDao();
    // we are going to manipulate the event on a different thread.
    EntityManagerProvider.detach(event);

    this.container = daoEvent.createVaadinContainer();
    this.entityItem = this.container.createEntityItem(event);
    this.fieldGroup = new ValidatingFieldGroup<au.org.scoutmaster.domain.Event>(
            au.org.scoutmaster.domain.Event.class);
    this.fieldGroup.setItemDataSource(this.entityItem);

    buildForm();
}
项目:vaadin-oauthpopup    文件:DemoUI.java   
@Override
public void authSuccessful(final String accessToken,
        final String accessTokenSecret, String oauthRawResponse) {
    hola.addComponent(new Label("Authorized."));
    Button testButton = new Button("Test " + service.name + " API");
    testButton.addStyleName(BaseTheme.BUTTON_LINK);
    hola.addComponent(testButton);
    testButton.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            GetTestComponent get = new GetTestComponent(service,
                    accessToken, accessTokenSecret);
            Window w = new Window(service.name, get);
            w.center();
            w.setWidth("75%");
            w.setHeight("75%");
            addWindow(w);
        }
    });
}
项目:mideaas    文件:ZipPlugin.java   
/**
 * Zips project.
 *
 * @param projectName the name of the project to be zipped
 */
protected void zipProject() {
    try {
        File zipFile = File.createTempFile("mideaas-"+project.getName(), ".zip");

        zipProjectToFile(zipFile, settings);
        FileResource zip = new FileResource(zipFile);
        FileDownloader fd = new FileDownloader(zip);
        Button downloadButton = new Button("Download project");
        fd.extend(downloadButton);

        //filedonwnloader can not be connected to menuitem :( So I connected it to popupwindow :)
        Window zipButtonWindow = new Window();
        zipButtonWindow.setCaption("Zip and download project");
        zipButtonWindow.setWidth(200, Unit.PIXELS);
        zipButtonWindow.setContent(downloadButton);
        UI.getCurrent().addWindow(zipButtonWindow);
    } catch (IOException e) {
        e.printStackTrace();
        Notification.show("Error: " + e.getMessage(), Notification.Type.ERROR_MESSAGE);
    }

}
项目:mideaas    文件:ShowLogButton.java   
private void openLogWindow() {
    Window w = new Window("Log");
    w.center();
    w.setWidth("80%");
    w.setHeight("80%");
    w.setContent(logView);
    logView.setSizeFull();
    UI.getCurrent().addWindow(w);
    setEnabled(false);
    w.addCloseListener(new CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            ShowLogButton.this.setEnabled(true);
        }
    });
}