List of usage examples for com.vaadin.ui AbsoluteLayout addComponent
private void addComponent(Component c, ComponentPosition position) throws IllegalArgumentException
From source file:org.apache.usergrid.chop.webapp.view.user.UserListWindow.java
License:Apache License
private void addCreateButton(AbsoluteLayout mainLayout) { Button createButton = new Button("Create"); createButton.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { close();/*from w ww . ja va2 s . c o m*/ setSelectedUser(null); showUser(null); } }); mainLayout.addComponent(createButton, "left: 10px; top: 425px;"); }
From source file:org.apache.usergrid.chop.webapp.view.util.PopupWindow.java
License:Apache License
private void addCloseButton(AbsoluteLayout mainLayout) { Button closeButton = new Button("Close"); closeButton.addClickListener(new Button.ClickListener() { public void buttonClick(Button.ClickEvent event) { close();//from w w w .ja v a 2s .c om } }); mainLayout.addComponent(closeButton, "left: 220px; top: 425px;"); }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static ComboBox addCombo(AbsoluteLayout layout, String caption, String position, String width, Object values[]) {/*from w w w .j a v a2 s . co m*/ ComboBox combo = new ComboBox(caption); combo.setTextInputAllowed(false); combo.setNullSelectionAllowed(false); combo.setWidth(width); layout.addComponent(combo, position); populateCombo(combo, values); return combo; }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static Button addButton(AbsoluteLayout layout, String caption, String position, String width) { Button button = new Button(caption); button.setWidth(width);/*from w ww. j a v a 2s . c om*/ layout.addComponent(button, position); return button; }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static AbsoluteLayout addLayout(AbsoluteLayout parent, String id, String position, String width, String height) {// w w w . ja v a 2 s . co m AbsoluteLayout layout = new AbsoluteLayout(); layout.setId(id); layout.setWidth(width); layout.setHeight(height); parent.addComponent(layout, position); return layout; }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static Label addLabel(AbsoluteLayout parent, String text, String position, String width) { Label label = new Label(text, ContentMode.HTML); label.setWidth(width);/* w w w . j av a2 s. c o m*/ parent.addComponent(label, position); return label; }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static ListSelect addListSelect(AbsoluteLayout parent, String caption, String position, String width) { ListSelect list = new ListSelect(caption); list.setWidth(width);/*from w w w .j av a 2 s . c o m*/ list.setNullSelectionAllowed(false); list.setImmediate(true); parent.addComponent(list, position); return list; }
From source file:org.apache.usergrid.chop.webapp.view.util.UIUtil.java
License:Apache License
public static TextArea addTextArea(AbsoluteLayout parent, String caption, String position, String width, String height, boolean readOnly) { TextArea textArea = new TextArea(caption); textArea.setWidth(width);// www . ja va2 s . com textArea.setHeight(height); textArea.setWordwrap(false); textArea.setReadOnly(readOnly); parent.addComponent(textArea, position); return textArea; }
From source file:org.lunifera.example.vaadin.osgi.contentprovider.ContentProvider_1.java
License:Apache License
@SuppressWarnings("serial") @Override/* w w w .j av a 2 s.c o m*/ public Component getContent() { main = new AbsoluteLayout(); main.setSizeFull(); AbsoluteLayout buttonPanel = new AbsoluteLayout(); buttonPanel.setWidth("320px"); buttonPanel.setHeight("270px"); final Button left = new Button("left"); final Button top = new Button("top"); final Button right = new Button("right"); final Button bottom = new Button("bottom"); final Button stop = new Button("STOP"); final IntensityBar leftIntensity = new IntensityBar(); final IntensityBar topIntensity = new IntensityBar(); final IntensityBar rightIntensity = new IntensityBar(); final IntensityBar bottomIntensity = new IntensityBar(); speed = new Slider(0, 10); speed.setOrientation(SliderOrientation.VERTICAL); left.addShortcutListener(new ShortcutListener("Left", ShortcutAction.KeyCode.ARROW_LEFT, null) { @Override public void handleAction(Object sender, Object target) { left(); } }); top.addShortcutListener(new ShortcutListener("Top", ShortcutAction.KeyCode.ARROW_UP, null) { @Override public void handleAction(Object sender, Object target) { top(); } }); right.addShortcutListener(new ShortcutListener("Right", ShortcutAction.KeyCode.ARROW_RIGHT, null) { @Override public void handleAction(Object sender, Object target) { right(); } }); left.addShortcutListener(new ShortcutListener("Bottom", ShortcutAction.KeyCode.ARROW_DOWN, null) { @Override public void handleAction(Object sender, Object target) { bottom(); } }); stop.addShortcutListener(new ShortcutListener("STOP", ShortcutAction.KeyCode.ESCAPE, null) { @Override public void handleAction(Object sender, Object target) { stop(); } }); speed.addShortcutListener(new ShortcutListener("Speed up", ShortcutAction.KeyCode.W, null) { @Override public void handleAction(Object sender, Object target) { speed.setValue(speed.getValue().doubleValue() + 1); } }); speed.addShortcutListener(new ShortcutListener("Speed down", ShortcutAction.KeyCode.Y, null) { @Override public void handleAction(Object sender, Object target) { speed.setValue(speed.getValue().doubleValue() - 1); } }); left.setWidth("75px"); leftIntensity.setWidth("75px"); leftIntensity.setValue(0.3f); top.setWidth("75px"); topIntensity.setWidth("75px"); topIntensity.setValue(0.3f); right.setWidth("75px"); rightIntensity.setWidth("75px"); rightIntensity.setValue(0.3f); bottom.setWidth("75px"); bottomIntensity.setWidth("75px"); bottomIntensity.setValue(0.3f); stop.setWidth("60px"); speed.setHeight("180px"); left.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { left(); } }); top.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { top(); } }); right.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { right(); } }); bottom.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { bottom(); } }); stop.addClickListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { stop(); } }); speed.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { foreward(); } }); buttonPanel.addComponent(left, "top:100px;left:0px"); buttonPanel.addComponent(leftIntensity, "top:130px;left:0px"); buttonPanel.addComponent(top, "top:10px;left:100px"); buttonPanel.addComponent(topIntensity, "top:40px;left:100px"); buttonPanel.addComponent(right, "top:100px;left:200px"); buttonPanel.addComponent(rightIntensity, "top:130px;left:200px"); buttonPanel.addComponent(bottom, "top:200px;left:100px"); buttonPanel.addComponent(bottomIntensity, "top:230px;left:100px"); buttonPanel.addComponent(stop, "top:100px;left:107px"); buttonPanel.addComponent(speed, "top:20px;right:10px"); main.addComponent(buttonPanel, "top:100px;left:100px"); return main; }
From source file:org.opennms.features.topology.app.internal.TopologyUI.java
License:Open Source License
private Component createMapLayout() { final Property<Double> scale = m_graphContainer.getScaleProperty(); m_lastUpdatedTimeLabel = new LastUpdatedLabel(); m_lastUpdatedTimeLabel.setImmediate(true); m_zoomLevelLabel.setHeight(20, Unit.PIXELS); m_zoomLevelLabel.setWidth(22, Unit.PIXELS); m_zoomLevelLabel.addStyleName("center-text"); m_zoomLevelLabel.addTextChangeListener(new FieldEvents.TextChangeListener() { @Override//w ww. j a va2 s. c om public void textChange(FieldEvents.TextChangeEvent event) { try { int zoomLevel = Integer.parseInt(event.getText()); setSemanticZoomLevel(zoomLevel); } catch (NumberFormatException e) { setSemanticZoomLevel(m_graphContainer.getSemanticZoomLevel()); } } }); m_topologyComponent = new TopologyComponent(m_graphContainer, m_iconRepositoryManager, this); m_topologyComponent.setSizeFull(); m_topologyComponent.addMenuItemStateListener(this); m_topologyComponent.addVertexUpdateListener(this); final Slider slider = new Slider(0, 1); slider.setPropertyDataSource(scale); slider.setResolution(1); slider.setHeight("200px"); slider.setOrientation(SliderOrientation.VERTICAL); slider.setImmediate(true); final NativeButton showFocusVerticesBtn = new NativeButton(FontAwesomeIcons.Icon.eye_open.variant()); showFocusVerticesBtn.setDescription("Toggle Highlight Focus Nodes"); showFocusVerticesBtn.setHtmlContentAllowed(true); showFocusVerticesBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (showFocusVerticesBtn.getCaption().equals(FontAwesomeIcons.Icon.eye_close.variant())) { showFocusVerticesBtn.setCaption(FontAwesomeIcons.Icon.eye_open.variant()); } else { showFocusVerticesBtn.setCaption(FontAwesomeIcons.Icon.eye_close.variant()); } m_topologyComponent.getState() .setHighlightFocus(!m_topologyComponent.getState().isHighlightFocus()); m_topologyComponent.updateGraph(); } }); final NativeButton magnifyBtn = new NativeButton(); magnifyBtn.setHtmlContentAllowed(true); magnifyBtn.setCaption("<i class=\"" + FontAwesomeIcons.Icon.zoom_in.stylename() + "\" ></i>"); magnifyBtn.setStyleName("icon-button"); magnifyBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (slider.getValue() < 1) { slider.setValue(Math.min(1, slider.getValue() + 0.25)); } } }); final NativeButton demagnifyBtn = new NativeButton(); demagnifyBtn.setHtmlContentAllowed(true); demagnifyBtn.setCaption("<i class=\"" + FontAwesomeIcons.Icon.zoom_out.stylename() + "\" ></i>"); demagnifyBtn.setStyleName("icon-button"); demagnifyBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (slider.getValue() != 0) { slider.setValue(Math.max(0, slider.getValue() - 0.25)); } } }); VerticalLayout sliderLayout = new VerticalLayout(); sliderLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); sliderLayout.addComponent(magnifyBtn); sliderLayout.addComponent(slider); sliderLayout.addComponent(demagnifyBtn); m_szlOutBtn = new Button(); m_szlOutBtn.setHtmlContentAllowed(true); m_szlOutBtn.setCaption(FontAwesomeIcons.Icon.arrow_down.variant()); m_szlOutBtn.setDescription("Collapse Semantic Zoom Level"); m_szlOutBtn.setEnabled(m_graphContainer.getSemanticZoomLevel() > 0); m_szlOutBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { int szl = m_graphContainer.getSemanticZoomLevel(); if (szl > 0) { szl--; setSemanticZoomLevel(szl); saveHistory(); } } }); final Button szlInBtn = new Button(); szlInBtn.setHtmlContentAllowed(true); szlInBtn.setCaption(FontAwesomeIcons.Icon.arrow_up.variant()); szlInBtn.setDescription("Expand Semantic Zoom Level"); szlInBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { int szl = m_graphContainer.getSemanticZoomLevel(); szl++; setSemanticZoomLevel(szl); saveHistory(); } }); m_panBtn = new Button(); m_panBtn.setIcon(FontAwesome.ARROWS); m_panBtn.setDescription("Pan Tool"); m_panBtn.setStyleName("toolbar-button down"); m_selectBtn = new Button(); m_selectBtn.setIcon(new ThemeResource("images/selection.png")); m_selectBtn.setDescription("Selection Tool"); m_selectBtn.setStyleName("toolbar-button"); m_selectBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { m_selectBtn.setStyleName("toolbar-button down"); m_panBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("select"); } }); m_panBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { m_panBtn.setStyleName("toolbar-button down"); m_selectBtn.setStyleName("toolbar-button"); m_topologyComponent.setActiveTool("pan"); } }); final Button historyBackBtn = new Button(FontAwesomeIcons.Icon.arrow_left.variant()); historyBackBtn.setHtmlContentAllowed(true); historyBackBtn.setDescription("Click to go back"); historyBackBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { com.vaadin.ui.JavaScript.getCurrent().execute("window.history.back()"); } }); final Button historyForwardBtn = new Button(FontAwesomeIcons.Icon.arrow_right.variant()); historyForwardBtn.setHtmlContentAllowed(true); historyForwardBtn.setDescription("Click to go forward"); historyForwardBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { com.vaadin.ui.JavaScript.getCurrent().execute("window.history.forward()"); } }); m_searchBox = new SearchBox(m_serviceManager, new CommandManager.DefaultOperationContext(this, m_graphContainer, OperationContext.DisplayLocation.SEARCH)); //History Button Layout HorizontalLayout historyButtonLayout = new HorizontalLayout(); historyButtonLayout.setSpacing(true); historyButtonLayout.addComponent(historyBackBtn); historyButtonLayout.addComponent(historyForwardBtn); //Semantic Controls Layout HorizontalLayout semanticLayout = new HorizontalLayout(); semanticLayout.setSpacing(true); semanticLayout.addComponent(szlInBtn); semanticLayout.addComponent(m_zoomLevelLabel); semanticLayout.addComponent(m_szlOutBtn); semanticLayout.setComponentAlignment(m_zoomLevelLabel, Alignment.MIDDLE_CENTER); VerticalLayout historyCtrlLayout = new VerticalLayout(); historyCtrlLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); historyCtrlLayout.addComponent(historyButtonLayout); HorizontalLayout controlLayout = new HorizontalLayout(); controlLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); controlLayout.addComponent(m_panBtn); controlLayout.addComponent(m_selectBtn); VerticalLayout semanticCtrlLayout = new VerticalLayout(); semanticCtrlLayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); semanticCtrlLayout.addComponent(semanticLayout); HorizontalLayout locationToolLayout = createLocationToolLayout(); //Vertical Layout for all tools on right side VerticalLayout toollayout = new VerticalLayout(); toollayout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); toollayout.setSpacing(true); toollayout.addComponent(historyCtrlLayout); toollayout.addComponent(locationToolLayout); toollayout.addComponent(showFocusVerticesBtn); toollayout.addComponent(sliderLayout); toollayout.addComponent(controlLayout); toollayout.addComponent(semanticCtrlLayout); AbsoluteLayout mapLayout = new AbsoluteLayout(); mapLayout.addComponent(m_topologyComponent, "top:0px; left: 0px; right: 0px; bottom: 0px;"); mapLayout.addComponent(m_lastUpdatedTimeLabel, "top: 5px; right: 10px;"); mapLayout.addComponent(toollayout, "top: 25px; right: 10px;"); mapLayout.setSizeFull(); m_infoPanel = new InfoPanel(m_searchBox, mapLayout); return m_infoPanel; }