List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER
Alignment MIDDLE_CENTER
To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.
Click Source Link
From source file:com.foc.vaadin.gui.windows.CreateLayoutWindow.java
License:Apache License
public CreateLayoutWindow(final FVLayout layout) { setModal(true);//w w w .j a va 2 s.co m setWidth("250px"); setHeight("250px"); mainLayout = new VerticalLayout(); buttonsLayout = new HorizontalLayout(); width = new TextField("Width:"); height = new TextField("Height:"); border = new CheckBox("Border:"); if (layout instanceof FVGridLayout) { rows = new TextField("Rows:"); cols = new TextField("Columns:"); } create = new Button("Create"); cancel = new Button("Cancel"); cancel.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); create.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { layout.setHeight(height.getValue().toString()); layout.setWidth(width.getValue().toString()); AttributesImpl attributesImpl = new AttributesImpl(layout.getAttributes()); attributesImpl.addAttribute("", "name", "name", "CDATA", "null"); attributesImpl.addAttribute("", "width", "width", "CDATA", width.getValue() + "px"); attributesImpl.addAttribute("", "height", "height", "CDATA", height.getValue() + "px"); if (rows != null) { ((FVGridLayout) layout).setRows(Integer.parseInt(rows.getValue().toString())); ((FVGridLayout) layout).setColumns(Integer.parseInt(cols.getValue().toString())); attributesImpl.addAttribute("", "cols", "cols", "CDATA", cols.getValue() + ""); attributesImpl.addAttribute("", "rows", "rows", "CDATA", rows.getValue() + ""); } layout.setAttributes(attributesImpl); if (border.booleanValue()) { layout.addStyleName("border"); } close(); } }); buttonsLayout.setMargin(true); buttonsLayout.setSpacing(true); buttonsLayout.addComponent(create); buttonsLayout.addComponent(cancel); mainLayout.addComponent(width); mainLayout.addComponent(height); if (rows != null) { mainLayout.addComponent(rows); mainLayout.addComponent(cols); mainLayout.setComponentAlignment(rows, Alignment.MIDDLE_CENTER); mainLayout.setComponentAlignment(cols, Alignment.MIDDLE_CENTER); } mainLayout.addComponent(border); mainLayout.addComponent(buttonsLayout); mainLayout.setComponentAlignment(width, Alignment.MIDDLE_CENTER); mainLayout.setComponentAlignment(height, Alignment.MIDDLE_CENTER); mainLayout.setComponentAlignment(border, Alignment.MIDDLE_CENTER); mainLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER); setContent(mainLayout); }
From source file:com.foc.vaadin.gui.windows.EditFieldsLayoutInTab.java
License:Apache License
public EditFieldsLayoutInTab(FocXMLLayout xmlLayout, Component componentEdited, FVLayout layout, String name, Attributes attributes, boolean isPalette) { this.xmlLayout = xmlLayout; this.layout = layout; this.componentEdited = componentEdited; this.attributes = attributes; this.attributesList = new ArrayList<XMLAttributesModel>(); this.name = name; this.isPalette = isPalette; try {/*from w w w . j a va2 s. c o m*/ container = new XMLAttributesContainer(); } catch (InstantiationException e) { Globals.logException(e); } catch (IllegalAccessException e) { Globals.logException(e); } if (componentEdited == null) { if (isPalette) { if (name.equals(FXML.TAG_LABEL)) { loadLabelAttributes(); } else { loadLayoutAttributes(); } } else { loadGuiFieldAttributes(); } } else { loadAttributes(); } attrTable = new Table(); //attrTable.addStyleName(Reindeer.TABLE_BORDERLESS); initTable(); attrTable.setSizeFull(); setSpacing(true); addComponent(attrTable); setComponentAlignment(attrTable, Alignment.MIDDLE_CENTER); }
From source file:com.foc.vaadin.gui.windows.EditFieldsWindow.java
License:Apache License
public EditFieldsWindow() { setModal(true);/*from w w w . ja va 2s . c o m*/ setWidth("400px"); setCaption("Component Editor"); mainLayout = new VerticalLayout(); buttonsLayout = new HorizontalLayout(); tabLayout = new FVTabbedLayout(null); tabLayout.setSizeFull(); add = new Button("Add Field"); save = new Button("Save Changes"); cancel = new Button("Cancel"); initButtons(); mainLayout.setSpacing(true); buttonsLayout.setMargin(true); buttonsLayout.setSpacing(true); buttonsLayout.addComponent(add); buttonsLayout.addComponent(save); buttonsLayout.addComponent(cancel); mainLayout.addComponent(tabLayout); mainLayout.addComponent(buttonsLayout); mainLayout.setComponentAlignment(tabLayout, Alignment.MIDDLE_CENTER); mainLayout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER); setContent(mainLayout); }
From source file:com.foc.vaadin.gui.windows.LineLabelCreator.java
License:Apache License
public LineLabelCreator(final FVLabel label) { setModal(true);//from w ww. ja va 2 s.co m setWidth("250px"); setHeight("200px"); layout = new VerticalLayout(); buttonsLayout = new HorizontalLayout(); lineHeight = new TextField("Line Height:"); lineWidth = new TextField("Line Width:"); create = new Button("Create"); cancel = new Button("Cancel"); cancel.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { close(); } }); create.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute("", "name", "name", "CDATA", "null"); attributes.addAttribute("", "value", "value", "CDATA", " "); attributes.addAttribute("", "bgColor", "bgColor", "CDATA", "#CCCCCC"); if (!lineHeight.getValue().toString().isEmpty()) { attributes.addAttribute("", "height", "height", "CDATA", lineHeight.getValue() + "px"); } if (!lineWidth.getValue().toString().isEmpty()) { attributes.addAttribute("", "width", "width", "CDATA", lineWidth.getValue() + "px"); } label.setAttributes(attributes); label.initLabel(); label.requestRepaint(); close(); } }); buttonsLayout.setMargin(true); buttonsLayout.setSpacing(true); buttonsLayout.addComponent(create); buttonsLayout.addComponent(cancel); layout.addComponent(lineHeight); layout.addComponent(lineWidth); layout.addComponent(buttonsLayout); layout.setComponentAlignment(lineHeight, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(lineWidth, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(buttonsLayout, Alignment.MIDDLE_CENTER); setContent(layout); }
From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java
License:Apache License
public void re_parseXMLAndBuildGui() { removeAllComponents();/*from w ww . ja v a 2s .c o m*/ dispose_ChildLayout(); dispose_ComponentsMap(); parseXMLAndBuildGui(); if (validationLayout != null) { if (Globals.isValo()) { FocWebApplication focWebApplication = findAncestor(FocWebApplication.class); if (focWebApplication != null) { focWebApplication.replaceFooterLayout(validationLayout); } else { addComponent(validationLayout); setComponentAlignment(validationLayout, Alignment.MIDDLE_CENTER); } } else { addComponentAsFirst(validationLayout); setComponentAlignment(validationLayout, Alignment.MIDDLE_CENTER); } } /* if(getCentralPanel() != null){ ICentralPanel centralPanel = XMLViewDictionary.getInstance().newCentralPanel(getMainWindow(), getXMLView().getXmlViewKey(), getFocData()); getCentralPanel().changeCentralPanelContent(centralPanel, false); }else{ Globals.logString("Could not FocXMLLayout.re_parseXMLAndBuildGui() because no entral Panel!!!!!!!"); } */ }
From source file:com.foc.vaadin.gui.xmlForm.FocXMLLayout.java
License:Apache License
public void showValidationLayout(boolean showBackButton, int position) { if (validationSettings != null && getValidationLayoutVisible()) { XMLView xmlView = getXMLView();/*from w ww . j a v a 2 s . c om*/ if (xmlView != null && xmlView.isHelpFileExist()) { validationSettings.setWithTips(true); } validationLayout = new FVValidationLayout((INavigationWindow) getNavigationWindow(), this, validationSettings, showBackButton); // if(!FocWebApplication.getInstanceForThread().isMobile()){ if (Globals.isValo()) { INavigationWindow navigationindow = getParentNavigationWindow(); if (navigationindow instanceof FocWebApplication) { ((FocWebApplication) navigationindow).replaceFooterLayout(validationLayout); // FocWebApplication focWebApplication = findAncestor(FocWebApplication.class); // if(focWebApplication != null){ // focWebApplication.replaceFooterLayout(validationLayout); } else { if (position == POSITION_UP) { addComponentAsFirst(validationLayout); } else { addComponent(validationLayout); } setComponentAlignment(validationLayout, Alignment.BOTTOM_CENTER); } } else { addComponentAsFirst(validationLayout); setComponentAlignment(validationLayout, Alignment.MIDDLE_CENTER); } // }else{ // validationLayout.setStyleName("transparent"); // FVValidationLayout bottomValidationLayout = new FVValidationLayout((INavigationWindow) getNavigationWindow(), this, validationSettings, showBackButton); // addComponent(bottomValidationLayout); // setComponentAlignment(bottomValidationLayout, Alignment.BOTTOM_RIGHT); // if(bottomValidationLayout.getDeleteButton(false) != null){ // bottomValidationLayout.getDeleteButton(false).setIcon(FVIconFactory.getInstance().getFVIcon_Big(FVIconFactory.ICON_TRASH_BLACK)); // } // } // setExpandRatio(validationLayout, 1); validationLayout.addValidationListener(this); //Adding a default tip for tables /* if(getXMLView() != null && getXMLView().getXmlViewKey() != null && (getXMLView().getXmlViewKey().getType() == IXMLViewConst.TYPE_TABLE || getXMLView().getXmlViewKey().getType() == IXMLViewConst.TYPE_TREE)){ if(getValidationLayout().getTipsButton(false) != null){ getValidationLayout().setTipMessage("Double click any row for more details."); } } */ } }
From source file:com.foc.vaadin.xmleditor.XMLEditor.java
License:Apache License
public XMLEditor(XMLView xmlView, String title, String xml) { setXMLView(xmlView);//from ww w .j av a 2s. co m layout = new FVVerticalLayout(); buttonLayout = new FVHorizontalLayout(null); // buttonLayout.setMargin(true, false, false, false); buttonLayout.setSpacing(true); setCaption(title); editor = new FVTextArea(null, null); // editor.setRows(40); // editor.setColumns(80); editor.setWidth("100%"); editor.setHeight("100%"); Globals.logString("XML before editor.setValue()=" + xml); editor.setValue(xml); editor.addStyleName("focXMLEditor"); save = new Button("save"); cancel = new Button("cancel"); addListenersToButtons(); layout.setWidth("100%"); layout.setHeight("100%"); layout.setSpacing(false); layout.addComponent(editor); layout.setComponentAlignment(editor, Alignment.TOP_CENTER); layout.setExpandRatio(editor, 1); buttonLayout.addComponent(save); buttonLayout.setComponentAlignment(save, Alignment.MIDDLE_CENTER); buttonLayout.addComponent(cancel); buttonLayout.setComponentAlignment(cancel, Alignment.MIDDLE_CENTER); layout.addComponent(buttonLayout); layout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER); setWidth("100%"); setHeight("100%"); setModal(true); setContent(layout); }
From source file:com.freebox.engeneering.application.web.common.ApplicationLayout.java
License:Apache License
@Override public void onPutControllerView(ComponentContainer container, Component content) { container.removeAllComponents();/*from www . j a va 2 s . c om*/ if (content != null) { container.addComponent(content); ((VerticalLayout) container).setComponentAlignment(content, Alignment.MIDDLE_CENTER); } }
From source file:com.freebox.engeneering.application.web.layout.FooterController.java
License:Apache License
/** * Loads data into the form while entering 'loadData' state. * * @param stateEvent the state event.//from w ww .j a va2 s . co m */ @OnEnterState(EventConstants.LOAD_DATA) public void buildFooterView(StateEvent stateEvent) { clearView(stateEvent); final Label htmlLabel = new Label( "© " + Calendar.getInstance().get(Calendar.YEAR) + " Lexaden.com All rights reserved", ContentMode.HTML); htmlLabel.setStyleName(Reindeer.LABEL_SMALL); htmlLabel.setSizeUndefined(); final VerticalLayout view = getView(); view.addComponent(htmlLabel); view.setComponentAlignment(htmlLabel, Alignment.MIDDLE_CENTER); view.setMargin(new MarginInfo(false, false, true, false)); }
From source file:com.github.peholmst.springsecuritydemo.ui.LoginView.java
License:Apache License
@SuppressWarnings("serial") protected void init() { final Panel loginPanel = new Panel(); loginPanel.setCaption(getApplication().getMessage("login.title")); ((VerticalLayout) loginPanel.getContent()).setSpacing(true); final TextField username = new TextField(getApplication().getMessage("login.username")); username.setWidth("100%"); loginPanel.addComponent(username);/*w ww. j a v a 2 s . c om*/ final TextField password = new TextField(getApplication().getMessage("login.password")); password.setSecret(true); password.setWidth("100%"); loginPanel.addComponent(password); final Button loginButton = new Button(getApplication().getMessage("login.button")); loginButton.setStyleName("primary"); // TODO Make it possible to submit the form by pressing <Enter> in any // of the text fields loginPanel.addComponent(loginButton); ((VerticalLayout) loginPanel.getContent()).setComponentAlignment(loginButton, Alignment.MIDDLE_RIGHT); loginButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { final Authentication auth = new UsernamePasswordAuthenticationToken(username.getValue(), password.getValue()); try { if (logger.isDebugEnabled()) { logger.debug("Attempting authentication for user '" + auth.getName() + "'"); } Authentication returned = getAuthenticationManager().authenticate(auth); if (logger.isDebugEnabled()) { logger.debug("Authentication for user '" + auth.getName() + "' succeeded"); } fireEvent(new LoginEvent(LoginView.this, returned)); } catch (BadCredentialsException e) { if (logger.isDebugEnabled()) { logger.debug("Bad credentials for user '" + auth.getName() + "'", e); } getWindow().showNotification(getApplication().getMessage("login.badCredentials.title"), getApplication().getMessage("login.badCredentials.descr"), Notification.TYPE_WARNING_MESSAGE); } catch (DisabledException e) { if (logger.isDebugEnabled()) { logger.debug("Account disabled for user '" + auth.getName() + "'", e); } getWindow().showNotification(getApplication().getMessage("login.disabled.title"), getApplication().getMessage("login.disabled.descr"), Notification.TYPE_WARNING_MESSAGE); } catch (LockedException e) { if (logger.isDebugEnabled()) { logger.debug("Account locked for user '" + auth.getName() + "'", e); } getWindow().showNotification(getApplication().getMessage("login.locked.title"), getApplication().getMessage("login.locked.descr"), Notification.TYPE_WARNING_MESSAGE); } catch (Exception e) { if (logger.isErrorEnabled()) { logger.error("Error while attempting authentication for user '" + auth.getName() + "'"); } ExceptionUtils.handleException(getWindow(), e); } } }); HorizontalLayout languages = new HorizontalLayout(); languages.setSpacing(true); final Button.ClickListener languageListener = new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { Locale locale = (Locale) event.getButton().getData(); if (logger.isDebugEnabled()) { logger.debug("Changing locale to [" + locale + "] and restarting the application"); } getApplication().setLocale(locale); getApplication().close(); } }; for (Locale locale : getApplication().getSupportedLocales()) { if (!getLocale().equals(locale)) { final Button languageButton = new Button(getApplication().getLocaleDisplayName(locale)); languageButton.setStyleName(Button.STYLE_LINK); languageButton.setData(locale); languageButton.addListener(languageListener); languages.addComponent(languageButton); } } loginPanel.addComponent(languages); loginPanel.setWidth("300px"); final HorizontalLayout viewLayout = new HorizontalLayout(); viewLayout.addComponent(loginPanel); viewLayout.setComponentAlignment(loginPanel, Alignment.MIDDLE_CENTER); viewLayout.setSizeFull(); viewLayout.setMargin(true); setCompositionRoot(viewLayout); setSizeFull(); }