/** * Sets window modality. When a modal window is open, components outside * that window cannot be accessed. * <p> * Keyboard navigation is restricted by blocking the tab key at the top and * bottom of the window by activating the tab stop function internally. * * @param modal * true if modality is to be turned on */ public void setModal(boolean modal) { getState().modal = modal; center(); }
@Override public void readDesign(Element design, DesignContext context) { super.readDesign(design, context); if (design.hasAttr("center")) { center(); } if (design.hasAttr("position")) { String[] position = design.attr("position").split(","); setPositionX(Integer.parseInt(position[0])); setPositionY(Integer.parseInt(position[1])); } // Parse shortcuts if defined, otherwise rely on default behavior if (design.hasAttr("close-shortcut")) { // Parse shortcuts String[] shortcutStrings = DesignAttributeHandler .readAttribute("close-shortcut", design.attributes(), String.class) .split("\\s+"); removeAllCloseShortcuts(); for (String part : shortcutStrings) { if (!part.isEmpty()) { ShortcutAction shortcut = DesignAttributeHandler .getFormatter() .parse(part.trim(), ShortcutAction.class); addCloseShortcut(shortcut.getKeyCode(), shortcut.getModifiers()); } } } }
/** * @see org.opencms.ui.I_CmsDialogContext#onViewChange() */ public void onViewChange() { if (m_window != null) { m_window.center(); } }
/** * @see org.opencms.ui.I_CmsDialogContext#onViewChange() */ public void onViewChange() { if (m_window != null) { m_window.center(); } }
public void run() { Window wnd = CmsVaadinUtils.getWindow(CmsBasicDialog.this); if (wnd != null) { wnd.center(); } } });
public class MyUI extends UI { @Override protected void init(VaadinRequest request) { // You need to have some content on the UI, even if it's empty - otherwise it looks odd // Here, I'm just adding an empty layout VerticalLayout content = new VerticalLayout(); content.setSizeFull(); setContent(content); // Adding a child window, and centering it for kicks Window window = new Window("Help me SO", new SOComplicatedComponent()); window.center(); addWindow(window); } }
/** * Toggles the details visibility.<p> */ void toggleDetails() { m_details.setVisible(!m_details.isVisible()); if (m_window != null) { m_window.center(); } }
public void buttonClick(ClickEvent event) { window.setContent(oldContent); window.setCaption(oldCaption); window.center(); }
public void buttonClick(ClickEvent event) { Window w = new Window(); w.center(); w.setContent(createPopupButton()); addWindow(w); } });
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; } }
/** * 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(); }
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; }
break; window.center(); return window;
@Override public void itemClick(ItemClickEvent event) { Window subWindow = new Window("Sub-window"); VerticalLayout subContent = new VerticalLayout(); subContent.setMargin(true); subWindow.setContent(subContent); Item item = event.getItem(); final Property<String> moduleProperty = item.getItemProperty("Module"); // Put some components in it subContent.addComponent(new Label(moduleProperty.getValue())); subContent.addComponent(new Button("Awlright")); // Center it in the browser window subWindow.center(); // Open it in the UI UI.getCurrent().addWindow(subWindow); } }
/** * Replaces the ui content with a single dialog.<p> * * TODO: In the future this should only handle window creation, refactor dialog contents to CmsBasicDialog * * @param caption the caption * @param component the dialog content */ public void setContentToDialog(String caption, Component component) { setContent(new Label()); Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow); CmsBasicDialog dialog = new CmsBasicDialog(); VerticalLayout result = new VerticalLayout(); dialog.setContent(result); window.setContent(dialog); window.setCaption(caption); window.setClosable(false); addWindow(window); window.center(); if (component instanceof I_CmsHasButtons) { I_CmsHasButtons hasButtons = (I_CmsHasButtons)component; for (Button button : hasButtons.getButtons()) { dialog.addButton(button); } } result.addComponent(component); }
/** * 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); } }
/** * Shows the password reset dialog.<p> */ public void showPasswordResetDialog() { String caption = CmsVaadinUtils.getMessageText(Messages.GUI_PWCHANGE_FORGOT_PASSWORD_0); A_CmsUI r = A_CmsUI.get(); r.setContent(new Label()); Window window = CmsBasicDialog.prepareWindow(DialogWidth.narrow); CmsBasicDialog dialog = new CmsBasicDialog(); VerticalLayout result = new VerticalLayout(); dialog.setContent(result); window.setContent(dialog); window.setCaption(caption); window.setClosable(true); final CmsForgotPasswordDialog forgotPassword = new CmsForgotPasswordDialog(); window.addCloseListener(new CloseListener() { /** Serial version id. */ private static final long serialVersionUID = 1L; public void windowClose(CloseEvent e) { forgotPassword.cancel(); } }); for (Button button : forgotPassword.getButtons()) { dialog.addButton(button); } r.addWindow(window); window.center(); VerticalLayout vl = result; vl.addComponent(forgotPassword); }
window.setContent(dialog); window.setCaption(newCaption); window.center();
super.setModal(true); super.setResizable(false); super.center();
dialog.center();