List of usage examples for com.vaadin.ui Component removeStyleName
public void removeStyleName(String style);
From source file:de.metas.procurement.webui.model.Trend.java
License:Open Source License
public static void applyStyleName(final Component comp, final Trend trend) { if (comp == null) { return;/*from w w w.j av a2 s . c o m*/ } for (final Trend t : values()) { comp.removeStyleName(t.getCssStyleName()); } // if (trend != null) { comp.addStyleName(trend.getCssStyleName()); } }
From source file:de.symeda.sormas.ui.utils.CssStyles.java
License:Open Source License
public static void removeStyles(Component component, String... styles) { for (String style : styles) { component.removeStyleName(style); }/*w ww . j a v a 2 s . co m*/ }
From source file:fr.amapj.view.samples.test003.Segment.java
License:Open Source License
private void updateButtonStyles() { int i = 0;//from www .j a v a2 s .c o m Component c = null; for (Iterator<Component> iterator = getComponentIterator(); iterator.hasNext();) { c = iterator.next(); c.removeStyleName("first"); c.removeStyleName("last"); if (i == 0) { c.addStyleName("first"); } i++; } if (c != null) { c.addStyleName("last"); } }
From source file:fr.amapj.view.samples.test003.SidebarMenu.java
License:Open Source License
private void updateButtonStyles() { for (Iterator<Component> iterator = getComponentIterator(); iterator.hasNext();) { Component c = iterator.next(); c.removeStyleName("selected"); }//from w ww.j a v a2s. c o m }
From source file:info.magnolia.ui.mediaeditor.field.image.ImageMediaField.java
License:Open Source License
private void doScaleToActual(HasComponents hc) { Iterator<Component> it = hc.iterator(); while (it.hasNext()) { Component c = it.next(); if (c instanceof Image) { c.removeStyleName("scale-to-fit"); } else if (c instanceof HasComponents) { doScaleToActual((HasComponents) c); }/* ww w.java2 s.c om*/ } }
From source file:module.pandabox.presentation.StyleController.java
License:Open Source License
public StyleController(final Component component, String... styles) { super();/*from w w w .j a v a 2 s . co m*/ setCaption("Style"); setSpacing(true); OptionGroup options = new OptionGroup(); addComponent(options); options.setImmediate(true); options.setMultiSelect(true); for (String style : styles) { options.addItem(style); } options.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { Set<String> value = (Set<String>) event.getProperty().getValue(); List<String> current = Arrays.asList(component.getStyleName().split(" ")); for (String style : value) { if (!current.contains(style)) { component.addStyleName(style); } } for (String style : current) { if (!value.contains(style)) { component.removeStyleName(style); } } } }); HorizontalLayout custom = new HorizontalLayout(); addComponent(custom); custom.setSpacing(true); final TextField txtStyle = new TextField(); custom.addComponent(txtStyle); Button btApplyStyle = new Button("Apply Style", new ClickListener() { @Override public void buttonClick(ClickEvent event) { final String value = (String) txtStyle.getValue(); if (value != null) { component.addStyleName(value); } } }); custom.addComponent(btApplyStyle); }
From source file:org.ikasan.dashboard.ui.framework.panel.LandingViewPanel.java
License:BSD License
private void toggleMaximized(final Component panel, final boolean maximized) { if (maximized) { panel.setVisible(true);//from w w w . ja v a 2 s. c om panel.addStyleName("max"); } else { panel.removeStyleName("max"); } }
From source file:org.ikasan.dashboard.ui.monitor.component.MonitorPanel.java
License:BSD License
protected void toggleMaximized(final Component panel, final boolean maximized) { if (maximized) { panel.setVisible(true);//from ww w .jav a 2s .c om panel.addStyleName("max"); } else { panel.removeStyleName("max"); } }
From source file:org.vaadin.alump.fancylayouts.demo.CssLayoutDemo.java
License:Apache License
public CssLayoutDemo() { setMargin(true);//from www.j a va 2 s .c o m setSpacing(true); setSizeFull(); final FancyCssLayout cssLayout = new FancyCssLayout(); Label todo = new Label("FancyCssLayout adds transitions when you add or remove components from it."); addComponent(todo); HorizontalLayout hLayout = new HorizontalLayout(); hLayout.setWidth("100%"); addComponent(hLayout); Button addContent = new Button("Add new content item"); hLayout.addComponent(addContent); CheckBox middleCbox = new CheckBox("add middle"); middleCbox.setImmediate(true); middleCbox.setValue(addCssMiddle); hLayout.addComponent(middleCbox); CheckBox marginCbox = new CheckBox("slide"); marginCbox.setImmediate(true); marginCbox.setValue(cssLayout.isTransitionEnabled(FancyTransition.SLIDE)); hLayout.addComponent(marginCbox); CheckBox styleCbox = new CheckBox("cards"); styleCbox.setImmediate(true); styleCbox.setValue(boxMode); hLayout.addComponent(styleCbox); final Label counterLabel = new Label(getClickCounterCaption()); hLayout.addComponent(counterLabel); cssLayout.setSizeFull(); addComponent(cssLayout); setExpandRatio(cssLayout, 1.0f); for (int i = 0; i < 10; ++i) { addCssLayoutContent(cssLayout); } addContent.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { addCssLayoutContent(cssLayout); } }); middleCbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { addCssMiddle = (Boolean) event.getProperty().getValue(); } }); marginCbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { cssLayout.setSlideEnabled((Boolean) event.getProperty().getValue()); } }); styleCbox.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(ValueChangeEvent event) { boolean value = (Boolean) event.getProperty().getValue(); Iterator<Component> iter = cssLayout.iterator(); while (iter.hasNext()) { Component component = iter.next(); if (value) { component.addStyleName("demo-removable-two"); } else { component.removeStyleName("demo-removable-two"); } } boxMode = value; } }); cssLayout.addLayoutClickListener(new LayoutClickListener() { @Override public void layoutClick(LayoutClickEvent event) { ++clickCounter; if (event.getChildComponent() == null) { ++layoutClickCounter; } counterLabel.setValue(getClickCounterCaption()); } }); }
From source file:rs.pupin.jpo.esta_ld.EstaLdComponent.java
private void refresh() { contentLayout.removeAllComponents(); // create left part where the map goes // first create a vertical layout for components geoLayout = new VerticalLayout(); geoLayout.setDebugId("l-geo"); geoLayout.setSizeUndefined();//from w ww . j ava2s.c o m // geoLayout.setWidth(GEO_PART_WIDTH); // geoLayout.setHeight("100%"); geoLayout.setSizeFull(); geoLayout.setSpacing(true); contentLayout.addComponent(geoLayout); getWindow().executeJavaScript("$('div#l-geo').append('<div id=\"esta-map-popup\"><p></p></div>')"); // contentLayout.setExpandRatio(geoLayout, 0.0f); // create Level and +- controls HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); final Label levelLabel = new Label(LEVEL_LABEL_CONTENT, Label.CONTENT_XHTML); hl.addComponent(levelLabel); hl.setComponentAlignment(levelLabel, Alignment.MIDDLE_LEFT); btnAggregColor = new Button("Aggregated Coloring"); btnAggregColor.addStyleName("dim-name"); btnAggregColor.addStyleName("btn-aggreg-coloring"); btnAggregColor.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleAggregatedColoring()"); } }); hl.addComponent(btnAggregColor); geoLayout.addComponent(hl); geoLayout.setExpandRatio(hl, 0.0f); // create a layout for the map // mapLayout = new VerticalLayout(); mapLayout = new VerticalLayout() { @Override public void attach() { getWindow().executeJavaScript("console.log('Attached the map')"); } }; mapLayout.addListener(new ComponentAttachListener() { public void componentAttachedToContainer(ComponentAttachEvent event) { getWindow().executeJavaScript("console.log('ComponentAttachedListener triggered')"); } }); mapLayout.setSizeUndefined(); mapLayout.setWidth("100%"); // mapLayout.setHeight("620px"); mapLayout.setHeight("100%"); mapLayout.setDebugId("map"); mapLayout.addStyleName("leaflet-container"); mapLayout.addStyleName("leaflet-fade-anim"); geoLayout.addComponent(mapLayout); geoLayout.setExpandRatio(mapLayout, 2.0f); rightLayout = new VerticalLayout(); rightLayout.setSizeUndefined(); rightLayout.setWidth("100%"); rightLayout.setSizeFull(); rightLayout.setSpacing(true); contentLayout.addComponent(rightLayout); // contentLayout.setExpandRatio(rightLayout, 2.0f); dimLayout = new GridLayout(6, 1); dimLayout.setColumnExpandRatio(0, 0.0f); dimLayout.setColumnExpandRatio(1, 0.0f); dimLayout.setColumnExpandRatio(2, 2.0f); dimLayout.setColumnExpandRatio(3, 0.0f); dimLayout.setColumnExpandRatio(4, 0.0f); dimLayout.setColumnExpandRatio(5, 2.0f); dimLayout.setDebugId("dim-layout"); // dimLayout.setSizeFull(); dimLayout.setWidth("100%"); dimLayout.setSpacing(true); // rightLayout.addComponent(dimLayout); settingsLayout.addComponent(dimLayout); dimLayout.addListener(new LayoutEvents.LayoutClickListener() { public void layoutClick(LayoutEvents.LayoutClickEvent event) { Component btnAggreg = event.getClickedComponent(); if (!(btnAggreg instanceof Label)) return; if (btnAggreg.getStyleName().contains("selected")) { btnAggreg.removeStyleName("selected"); } else { btnAggreg.addStyleName("selected"); } aggregDimensionsChanged(); } }); refreshDimensions(); HorizontalLayout chartControlsLayout = new HorizontalLayout(); chartControlsLayout.setDebugId("l-chart-controls"); chartControlsLayout.setWidth("100%"); chartControlsLayout.setSpacing(true); rightLayout.addComponent(chartControlsLayout); rightLayout.setExpandRatio(chartControlsLayout, 0.0f); btnCompare = new Button("Compare"); btnCompare.setDebugId("btn-compare"); btnCompare.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleCompare()"); } }); chartControlsLayout.addComponent(btnCompare); btnSwap = new Button("Swap"); btnSwap.setDebugId("btn-swap"); btnSwap.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleSwap()"); } }); chartControlsLayout.addComponent(btnSwap); btnInvert = new Button("Switch Axes"); btnInvert.setDebugId("btn-invert"); btnInvert.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleInvert()"); } }); chartControlsLayout.addComponent(btnInvert); btnStack = new Button("Stack"); btnStack.setDebugId("btn-stack"); btnStack.addListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { getWindow().executeJavaScript("toggleStacking()"); } }); chartControlsLayout.addComponent(btnStack); Label lblEmpty = new Label(" "); chartControlsLayout.addComponentAsFirst(lblEmpty); chartControlsLayout.setExpandRatio(lblEmpty, 2.0f); chartLayout = new VerticalLayout(); chartLayout.setSizeFull(); chartLayout.setDebugId("highchartsbarsingle"); // rightLayout.addComponent(chartLayout); VerticalLayout chartLayout2 = new VerticalLayout(); chartLayout2.setSizeFull(); chartLayout2.setDebugId("highchartsbarmultiple"); rightLayout.addComponent(chartLayout2); rightLayout.setExpandRatio(chartLayout2, 2.0f); inspectLayout = new VerticalLayout(); inspectLayout.setVisible(false); inspectLayout.setWidth("100%"); inspectLayout.setDebugId("l-inspect"); // mainLayout.addComponent(inspectLayout); // mainLayout.setExpandRatio(inspectLayout, 2.0f); }