List of usage examples for com.vaadin.ui Component removeStyleName
public void removeStyleName(String style);
From source file:com.esofthead.mycollab.module.user.accountsettings.customize.view.GeneralSettingViewImpl.java
License:Open Source License
private void buildLogoPanel() { FormContainer formContainer = new FormContainer(); MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(true); MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false); Label logoDesc = new Label(AppContext.getMessage(AdminI18nEnum.OPT_LOGO_FORMAT_DESCRIPTION)); leftPanel.with(logoDesc).withWidth("250px"); MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false); CustomLayout previewLayout = CustomLayoutExt.createLayout("topNavigation"); previewLayout.setStyleName("example-block"); previewLayout.setHeight("40px"); previewLayout.setWidth("520px"); Button currentLogo = AccountAssetsResolver.createAccountLogoImageComponent(billingAccount.getLogopath(), 150);/*from w w w. j av a2 s. c om*/ previewLayout.addComponent(currentLogo, "mainLogo"); final ServiceMenu serviceMenu = new ServiceMenu(); Button.ClickListener clickListener = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { Iterator<Component> iterator = serviceMenu.iterator(); while (iterator.hasNext()) { Component comp = iterator.next(); if (comp != event.getButton()) { comp.removeStyleName("selected"); } } event.getButton().addStyleName("selected"); } }; serviceMenu.addService(AppContext.getMessage(GenericI18Enum.MODULE_CRM), VaadinIcons.MONEY, clickListener); serviceMenu.addService(AppContext.getMessage(GenericI18Enum.MODULE_PROJECT), VaadinIcons.TASKS, clickListener); serviceMenu.addService(AppContext.getMessage(GenericI18Enum.MODULE_DOCUMENT), VaadinIcons.SUITCASE, clickListener); serviceMenu.selectService(0); previewLayout.addComponent(serviceMenu, "serviceMenu"); MHorizontalLayout buttonControls = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, false, false)); buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT); final UploadField logoUploadField = new UploadField() { private static final long serialVersionUID = 1L; @Override protected void updateDisplay() { byte[] imageData = (byte[]) this.getValue(); String mimeType = this.getLastMimeType(); if (mimeType.equals("image/jpeg")) { imageData = ImageUtil.convertJpgToPngFormat(imageData); if (imageData == null) { throw new UserInvalidInputException( AppContext.getMessage(FileI18nEnum.ERROR_INVALID_SUPPORTED_IMAGE_FORMAT)); } else { mimeType = "image/png"; } } if (mimeType.equals("image/png")) { UI.getCurrent().addWindow(new LogoEditWindow(imageData)); } else { throw new UserInvalidInputException( AppContext.getMessage(FileI18nEnum.ERROR_UPLOAD_INVALID_SUPPORTED_IMAGE_FORMAT)); } } }; logoUploadField.setButtonCaption(AppContext.getMessage(GenericI18Enum.ACTION_CHANGE)); logoUploadField.addStyleName("upload-field"); logoUploadField.setSizeUndefined(); logoUploadField.setFieldType(UploadField.FieldType.BYTE_ARRAY); logoUploadField.setEnabled(AppContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME)); Button resetButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_RESET), new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent clickEvent) { BillingAccountService billingAccountService = AppContextUtil .getSpringBean(BillingAccountService.class); billingAccount.setLogopath(null); billingAccountService.updateWithSession(billingAccount, AppContext.getUsername()); Page.getCurrent().getJavaScript().execute("window.location.reload();"); } }); resetButton.setEnabled(AppContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME)); resetButton.setStyleName(UIConstants.BUTTON_OPTION); buttonControls.with(logoUploadField, resetButton); rightPanel.with(previewLayout, buttonControls); layout.with(leftPanel, rightPanel).expand(rightPanel); formContainer.addSection("Logo", layout); this.with(formContainer); }
From source file:com.esofthead.mycollab.vaadin.ui.ServiceMenu.java
License:Open Source License
public void selectService(int index) { Iterator<Component> iterator = this.iterator(); int i = 0;//from w w w . java 2 s . c o m while (iterator.hasNext()) { Component comp = iterator.next(); if (i == index) { comp.addStyleName(SELECTED_STYLENAME); } else { comp.removeStyleName(SELECTED_STYLENAME); } i++; } }
From source file:com.esofthead.mycollab.vaadin.ui.VerticalTabsheet.java
License:Open Source License
private void clearTabSelection(boolean setDefaultIcon) { Iterator<Component> iterator = navigatorContainer.iterator(); if (setDefaultIcon) { while (iterator.hasNext()) { Component btn = iterator.next(); if (btn.getStyleName().contains(TAB_SELECTED_STYLENAME)) { btn.removeStyleName(TAB_SELECTED_STYLENAME); setDefaulButtonIcon(btn, false); }//ww w .j av a2s. co m } } else { while (iterator.hasNext()) { Component btn = iterator.next(); if (btn.getStyleName().contains(TAB_SELECTED_STYLENAME)) { btn.removeStyleName(TAB_SELECTED_STYLENAME); } } } }
From source file:com.esofthead.mycollab.vaadin.web.ui.ServiceMenu.java
License:Open Source License
public void selectService(int index) { Iterator<Component> iterator = this.iterator(); int i = 0;/*from w ww . j a v a 2 s . co m*/ while (iterator.hasNext()) { Component comp = iterator.next(); if (i == index) { comp.addStyleName(SELECTED_STYLENAME); } else { comp.removeStyleName(SELECTED_STYLENAME); } i++; } }
From source file:com.esofthead.mycollab.vaadin.web.ui.VerticalTabsheet.java
License:Open Source License
private void clearTabSelection(boolean setDefaultIcon) { Iterator<Component> iterator = navigatorContainer.iterator(); if (setDefaultIcon) { while (iterator.hasNext()) { Component btn = iterator.next(); if (btn.getStyleName().contains(TAB_SELECTED_STYLENAME)) { btn.removeStyleName(TAB_SELECTED_STYLENAME); setDefaultButtonIcon(btn, false); }//from w ww . ja va2 s . c o m } } else { while (iterator.hasNext()) { Component btn = iterator.next(); if (btn.getStyleName().contains(TAB_SELECTED_STYLENAME)) { btn.removeStyleName(TAB_SELECTED_STYLENAME); } } } }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaManagedTabSheet.java
License:Apache License
protected void hideTabContent(Component component) { component.removeStyleName(VISIBLE_TAB); component.addStyleName(HIDDEN_TAB); }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaManagedTabSheet.java
License:Apache License
protected void showTabContent(Component component) { component.removeStyleName(HIDDEN_TAB); component.addStyleName(VISIBLE_TAB); }
From source file:com.m4gik.views.component.LibraryScreen.java
/** * This method builds library screen. This method overrides an existing * method.//from w w w . j a va 2 s . co m * * @see com.m4gik.views.component.ViewScreen#build() */ @Override public Layout build() { HorizontalLayout root = new HorizontalLayout(); root.setSizeFull(); root.setCaption("Media Library"); root.setHeight("200%"); root.setWidth("100%"); this.content = new VerticalLayout(); content.setSizeFull(); root.addComponent(content); final GridLayout grid = new GridLayout(4, 1); Panel top = new Panel("Music Collection", grid); top.setSizeFull(); top.addStyleName(Runo.PANEL_LIGHT); grid.setWidth("100%"); grid.setMargin(true); grid.addStyleName(Runo.LAYOUT_DARKER); content.addComponent(top); content.setExpandRatio(top, 1); grid.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = -1864555729437118182L; @Override public void layoutClick(LayoutClickEvent event) { for (Iterator<Component> it = grid.iterator(); it.hasNext();) { Component c = it.next(); c.removeStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED); } if (event.getChildComponent() != null) { event.getChildComponent().addStyleName(Runo.CSSLAYOUT_SELECTABLE_SELECTED); } } }); buildAudioLibrary(grid, null); return root; }
From source file:com.mycollab.module.user.accountsettings.customize.view.GeneralSettingViewImpl.java
License:Open Source License
private void buildLogoPanel() { FormContainer formContainer = new FormContainer(); MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(true); MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false); Label logoDesc = new Label(UserUIContext.getMessage(AdminI18nEnum.OPT_LOGO_FORMAT_DESCRIPTION)); leftPanel.with(logoDesc).withWidth("250px"); MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false); CustomLayout previewLayout = CustomLayoutExt.createLayout("topNavigation"); previewLayout.setStyleName("example-block"); previewLayout.setHeight("40px"); previewLayout.setWidth("520px"); Button currentLogo = AccountAssetsResolver.createAccountLogoImageComponent(billingAccount.getLogopath(), 150);// w w w. ja va 2 s .c o m previewLayout.addComponent(currentLogo, "mainLogo"); final ServiceMenu serviceMenu = new ServiceMenu(); Button.ClickListener clickListener = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { for (Component comp : serviceMenu) { if (comp != event.getButton()) { comp.removeStyleName("selected"); } } event.getButton().addStyleName("selected"); } }; serviceMenu.addService(UserUIContext.getMessage(GenericI18Enum.MODULE_CRM), VaadinIcons.MONEY, clickListener); serviceMenu.addService(UserUIContext.getMessage(GenericI18Enum.MODULE_PROJECT), VaadinIcons.TASKS, clickListener); serviceMenu.addService(UserUIContext.getMessage(GenericI18Enum.MODULE_DOCUMENT), VaadinIcons.SUITCASE, clickListener); serviceMenu.selectService(0); previewLayout.addComponent(serviceMenu, "serviceMenu"); MHorizontalLayout buttonControls = new MHorizontalLayout() .withMargin(new MarginInfo(true, false, false, false)); buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT); final UploadField logoUploadField = new UploadField() { private static final long serialVersionUID = 1L; @Override protected void updateDisplay() { byte[] imageData = (byte[]) this.getValue(); String mimeType = this.getLastMimeType(); if (mimeType.equals("image/jpeg")) { imageData = ImageUtil.convertJpgToPngFormat(imageData); if (imageData == null) { throw new UserInvalidInputException( UserUIContext.getMessage(FileI18nEnum.ERROR_INVALID_SUPPORTED_IMAGE_FORMAT)); } else { mimeType = "image/png"; } } if (mimeType.equals("image/png")) { UI.getCurrent().addWindow(new LogoEditWindow(imageData)); } else { throw new UserInvalidInputException( UserUIContext.getMessage(FileI18nEnum.ERROR_UPLOAD_INVALID_SUPPORTED_IMAGE_FORMAT)); } } }; logoUploadField.setButtonCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE)); logoUploadField.addStyleName("upload-field"); logoUploadField.setSizeUndefined(); logoUploadField.setFieldType(UploadField.FieldType.BYTE_ARRAY); logoUploadField.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME)); MButton resetButton = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> { BillingAccountService billingAccountService = AppContextUtil.getSpringBean(BillingAccountService.class); billingAccount.setLogopath(null); billingAccountService.updateWithSession(billingAccount, UserUIContext.getUsername()); Page.getCurrent().getJavaScript().execute("window.location.reload();"); }).withStyleName(WebThemes.BUTTON_OPTION); resetButton.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME)); buttonControls.with(resetButton, logoUploadField); rightPanel.with(previewLayout, buttonControls); layout.with(leftPanel, rightPanel).expand(rightPanel); formContainer.addSection("Logo", layout); this.with(formContainer); }
From source file:com.mycollab.vaadin.web.ui.VerticalTabsheet.java
License:Open Source License
private void clearTabSelection(boolean setDefaultIcon) { Iterator<Component> iterator = navigatorContainer.iterator(); if (setDefaultIcon) { while (iterator.hasNext()) { Component btn = iterator.next(); if (btn.getStyleName().contains(TAB_SELECTED_STYLENAME)) { btn.removeStyleName(TAB_SELECTED_STYLENAME); }//from w ww. ja v a2s .com } } else { while (iterator.hasNext()) { Component btn = iterator.next(); if (btn.getStyleName().contains(TAB_SELECTED_STYLENAME)) { btn.removeStyleName(TAB_SELECTED_STYLENAME); } } } }