List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:org.escidoc.browser.ui.maincontent.ParentsView.java
License:Open Source License
@SuppressWarnings("serial") private Component buildParentsList() { // ViewConstants.PARENTS final Panel panel = new Panel(); panel.setSizeFull();//from www . j av a2s.co m panel.setStyleName(Runo.PANEL_LIGHT); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); cssLayout.setHeight("20px"); buildPanelHeader(cssLayout, ViewConstants.PARENTS); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); Button btnAdd = new Button(); btnAdd.setStyleName(BaseTheme.BUTTON_LINK); btnAdd.addStyleName("floatright paddingtop3"); btnAdd.setWidth("20px"); btnAdd.setIcon(ICON); btnAdd.addListener(new Button.ClickListener() { @Override public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { final Window subwindow = new Window("Manage Organizational Unit Parents"); subwindow.setModal(true); subwindow.setWidth("650px"); VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); try { subwindow.addComponent(new OrgUnitParentEditView(orgUnitProxy, orgUnitProxy.getParentList(), router, orgUnitController)); } catch (EscidocClientException e) { orgUnitController.showError(e); } Button close = new Button("Close", new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") com.vaadin.ui.Button.ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); layout.addComponent(close); layout.setComponentAlignment(close, Alignment.TOP_RIGHT); mainWindow.addWindow(subwindow); } }); cssLayout.addComponent(btnAdd); vl.addComponent(cssLayout); List<ResourceModel> l = orgUnitProxy.getParentList(); OUParentTableVH parentTable = new OUParentTableVH(orgUnitProxy, router, orgUnitController); parentTable.buildTable(); vl.addComponent(parentTable); vl.setExpandRatio(parentTable, 9f); // TODO here comes table panel.setContent(vl); return panel; }
From source file:org.escidoc.browser.ui.mainpage.HeaderContainer.java
License:Open Source License
private static void configureButton(final Button button) { button.setStyleName(BaseTheme.BUTTON_LINK); button.setWidth("60px"); button.setHeight("15px"); button.setImmediate(true);/*from w ww . ja v a2 s . c o m*/ button.addStyleName("paddingright10"); }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Form buildCreateUserAccountForm() { final Form form = new Form(); form.setImmediate(true);// w ww. ja va 2 s. c o m // loginName final TextField loginNameField = new TextField("Login Name"); loginNameField.setImmediate(false); loginNameField.setWidth("-1px"); loginNameField.setHeight("-1px"); form.addField("loginName", loginNameField); // Name final TextField realNameField = new TextField(); realNameField.setCaption("Real Name"); realNameField.setImmediate(false); realNameField.setWidth("-1px"); realNameField.setHeight("-1px"); realNameField.setInvalidAllowed(false); realNameField.setRequired(true); form.addField("realName", realNameField); // Password final PasswordField txtPassword = new PasswordField("Password"); txtPassword.setImmediate(false); txtPassword.setNullSettingAllowed(false); txtPassword.setWidth("-1px"); txtPassword.setHeight("-1px"); form.addField("txtPassword", txtPassword); // Verify Password final PasswordField txtPassword2 = new PasswordField("Verify Password"); txtPassword2.setImmediate(false); txtPassword2.setWidth("-1px"); txtPassword2.setHeight("-1px"); form.addField("txtPassword2", txtPassword2); // btnAddContext final Button addButton = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -1373866726572059290L; @Override public void buttonClick(final ClickEvent event) { try { form.commit(); if (!txtPassword.getValue().equals(txtPassword2.getValue())) { router.getMainWindow().showNotification( "Password verification failed, please try again and make sure you are typing the same password twice ", Window.Notification.TYPE_WARNING_MESSAGE); return; } controller.createResourceAddUserAccount(realNameField.getValue().toString(), loginNameField.getValue().toString(), txtPassword.getValue().toString()); router.getMainWindow().showNotification( "User Account" + realNameField.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); form.getField("loginName").setValue(""); form.getField("realName").setValue(""); form.getField("txtPassword").setValue(""); form.getField("txtPassword2").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); addButton.setWidth("-1px"); addButton.setHeight("-1px"); form.getLayout().addComponent(addButton); form.getField("loginName").setRequired(true); form.getField("loginName").setRequiredError("Login Name is missing"); form.getField("realName").setRequired(true); form.getField("realName").setRequiredError("Real Name is missing"); return form; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private Form buildCreateOrgUnitForm() { final Form form = new Form(); form.setImmediate(true);/* w w w .j av a 2s .co m*/ // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); form.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); form.addField("txtDescContext", txtDescContext); final CheckBox checkStatusOpened = new CheckBox("Create OrgUnit in Status opened?", true); checkStatusOpened.setImmediate(true); form.addField("checkStatusOpened", checkStatusOpened); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -1373866726572059290L; @Override public void buttonClick(final ClickEvent event) { try { form.commit(); controller.createResourceAddOrgUnit(txtNameContext.getValue().toString(), txtDescContext.getValue().toString(), (Boolean) checkStatusOpened.getValue(), router, router.getServiceLocation()); router.getMainWindow().showNotification("Organizational Unit " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); form.getField("txtNameContext").setValue(""); form.getField("txtDescContext").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final Exception e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); form.getLayout().addComponent(btnAddContext); form.getField("txtNameContext").setRequired(true); form.getField("txtNameContext").setRequiredError("Name is missing"); form.getField("txtDescContext").setRequired(true); form.getField("txtDescContext").setRequiredError("Description is missing"); return form; }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private void formAddContentModel(final VerticalLayout vlAccCreateContentModel) { final Form frm = new Form(); frm.setImmediate(true);/* w w w .j a va2s . co m*/ // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); frm.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); frm.addField("txtDescContext", txtDescContext); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -6461338505705399082L; @Override public void buttonClick(final ClickEvent event) { try { frm.commit(); controller.createResourceAddContentModel(txtNameContext.getValue().toString(), txtDescContext.getValue().toString(), router, router.getServiceLocation()); router.getMainWindow().showNotification( "ContentModel " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); frm.getField("txtNameContext").setValue(""); frm.getField("txtDescContext").setValue(""); } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final EscidocClientException e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); frm.getLayout().addComponent(btnAddContext); frm.getField("txtNameContext").setRequired(true); frm.getField("txtNameContext").setRequiredError("Name is missing"); frm.getField("txtDescContext").setRequired(true); frm.getField("txtDescContext").setRequiredError("Description is missing"); vlAccCreateContentModel.addComponent(frm); }
From source file:org.escidoc.browser.ui.tools.CreateResourcesView.java
License:Open Source License
private void formAddContext(final VerticalLayout vlAccCreateContext) throws EscidocClientException { final Form frm = new Form(); frm.setImmediate(true);//from www .ja v a 2s . c o m // Name final TextField txtNameContext = new TextField(); txtNameContext.setCaption("Name"); txtNameContext.setImmediate(false); txtNameContext.setWidth("-1px"); txtNameContext.setHeight("-1px"); txtNameContext.setInvalidAllowed(false); txtNameContext.setRequired(true); frm.addField("txtNameContext", txtNameContext); // Description final TextField txtDescContext = new TextField("Description"); txtDescContext.setImmediate(false); txtDescContext.setWidth("-1px"); txtDescContext.setHeight("-1px"); frm.addField("txtDescContext", txtDescContext); // Description final TextField txtType = new TextField("Type"); txtType.setImmediate(false); txtType.setWidth("-1px"); txtType.setHeight("-1px"); frm.addField("txtType", txtType); // OrgUnit final NativeSelect slOrgUnit = new NativeSelect("Organizational Unit"); slOrgUnit.setImmediate(true); slOrgUnit.setWidth("-1px"); slOrgUnit.setHeight("-1px"); slOrgUnit.setRequired(true); slOrgUnit.setNullSelectionAllowed(false); frm.addField("slOrgUnit", slOrgUnit); final OrgUnitService orgUnitService = new OrgUnitService(router.getServiceLocation().getEscidocUri(), router.getApp().getCurrentUser().getToken()); final Collection<OrganizationalUnit> orgUnits = orgUnitService.findAll(); for (final OrganizationalUnit organizationalUnit : orgUnits) { slOrgUnit.addItem(organizationalUnit.getObjid()); slOrgUnit.setItemCaption(organizationalUnit.getObjid(), organizationalUnit.getXLinkTitle()); } frm.getLayout().addComponent(slOrgUnit); final CheckBox checkStatusOpened = new CheckBox("Create Context in Status opened?", true); checkStatusOpened.setImmediate(true); frm.addField("checkStatusOpened", checkStatusOpened); // btnAddContext final Button btnAddContext = new Button("Submit", new Button.ClickListener() { private static final long serialVersionUID = -4696167135894721166L; @Override public void buttonClick(final ClickEvent event) { try { frm.commit(); controller.createResourceAddContext(txtNameContext.getValue().toString(), txtDescContext.getValue().toString(), txtType.getValue().toString(), slOrgUnit.getValue().toString(), (Boolean) checkStatusOpened.getValue(), repositories, router.getServiceLocation()); router.getMainWindow().showNotification( "Context " + txtNameContext.getValue().toString() + " created successfully ", Window.Notification.TYPE_TRAY_NOTIFICATION); frm.getField("txtNameContext").setValue(""); frm.getField("txtDescContext").setValue(""); frm.getField("txtType").setValue(""); frm.getField("slOrgUnit").setValue(null); // Ideally here should be a sync method to sync the tree } catch (final EmptyValueException e) { router.getMainWindow().showNotification("Please fill in all the required elements in the form", Window.Notification.TYPE_TRAY_NOTIFICATION); } catch (final EscidocClientException e) { router.getMainWindow().showNotification( ViewConstants.ERROR_CREATING_RESOURCE + e.getLocalizedMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); btnAddContext.setWidth("-1px"); btnAddContext.setHeight("-1px"); frm.getLayout().addComponent(btnAddContext); frm.getField("txtNameContext").setRequired(true); frm.getField("txtNameContext").setRequiredError("Name is missing"); frm.getField("txtDescContext").setRequired(true); frm.getField("txtDescContext").setRequiredError("Description is missing"); frm.getField("txtType").setRequired(true); frm.getField("txtType").setRequiredError("Context Type is missing"); // frm.getField("slOrgUnit").setRequired(true); frm.getField("slOrgUnit").setRequiredError("Organizazional Unit is required"); vlAccCreateContext.addComponent(frm); }
From source file:org.escidoc.browser.ui.view.helpers.DirectMember.java
License:Open Source License
@SuppressWarnings("serial") private CssLayout headerButton() throws EscidocClientException { CssLayout cssLayout = new CssLayout(); cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext"); cssLayout.setWidth("100%"); cssLayout.setMargin(false);/*from w w w . ja v a 2 s . c o m*/ final Label nameofPanel = new Label(ViewConstants.DIRECT_MEMBERS, Label.CONTENT_RAW); nameofPanel.setStyleName("accordion v-captiontext"); nameofPanel.setWidth("70%"); cssLayout.addComponent(nameofPanel); ThemeResource plusIcon = new ThemeResource("images/assets/plus.png"); if (resourceType == ResourceType.CONTAINER.toString()) { resourceProxy = new ContainerProxyImpl( router.getRepositories().container().findContainerById(parentId)); contextId = resourceProxy.getContext().getObjid(); } else { // It has to be a context resourceProxy = router.getRepositories().context().findById(parentId); } final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(plusIcon); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) { try { new ResourceAddViewImpl(resourceProxy, contextId, router).openSubWindow(); } catch (final EscidocClientException e) { mainWindow.showNotification(e.getMessage(), Window.Notification.TYPE_ERROR_MESSAGE); } } }); cssLayout.addComponent(nameofPanel); cssLayout.addComponent(addResourceButton); return cssLayout; }
From source file:org.lunifera.example.vaadin.osgi.contentprovider.ContentProvider_1.java
License:Apache License
@SuppressWarnings("serial") @Override//from w w w . j a v a2 s . com 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.lunifera.vaaclipse.ui.preferences.addon.internal.ListEditorRenderer.java
License:Open Source License
private Button addButton(String name, String style, ClickListener listener) { Button button = new Button(name); button.addStyleName(style);//from w ww. ja v a2 s . co m button.setWidth("80px"); buttonPanel.addComponent(button); button.addClickListener(listener); return button; }
From source file:org.opencms.ui.dialogs.history.CmsHistoryDialog.java
License:Open Source License
/** * Creates a close button for child dialogs.<p> * * @return the close button/*from www .j ava2 s . c o m*/ */ public Button createCloseButton() { Button button = new Button( CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_BUTTON_CLOSE_DIALOG_0)); button.setWidth("150px"); button.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { m_context.finish(Lists.newArrayList(m_context.getResources().get(0).getStructureId())); } }); return button; }