List of usage examples for com.vaadin.ui Button setHeight
@Override public void setHeight(String height)
From source file:annis.visualizers.component.rst.RSTPanel.java
License:Apache License
RSTPanel(VisualizerInput visInput) { String btWidth = "30px"; HorizontalLayout grid = new HorizontalLayout(); final int scrollStep = 200; // the calculation of the output json is done here. final RSTImpl rstView = new RSTImpl(visInput); rstView.setId(UUID.randomUUID().toString()); this.setHeight("-1px"); this.setWidth("100%"); grid.setHeight("-1px"); grid.setWidth("100%"); final Button buttonLeft = new Button(); buttonLeft.setWidth(btWidth);//from www. ja v a2 s .c o m buttonLeft.setHeight("100%"); buttonLeft.addStyleName("left-button"); buttonLeft.setEnabled(false); final Button buttonRight = new Button(); buttonRight.setWidth(btWidth); buttonRight.setHeight("100%"); buttonRight.addStyleName("right-button"); buttonLeft.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (rstView.getScrollLeft() < scrollStep) { buttonLeft.setEnabled(false); rstView.setScrollLeft(0); } else { //if the right button was deactivated set it back rstView.setScrollLeft(rstView.getScrollLeft() - scrollStep); } buttonRight.setEnabled(true); } }); buttonRight.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { renderInfo.calculate("#" + rstView.getId() + " canvas"); } }); renderInfo = new CssRenderInfo(new CssRenderInfo.Callback() { @Override public void renderInfoReceived(int width, int height) { if (width - rstView.getScrollLeft() > scrollStep) { buttonLeft.setEnabled(true); rstView.setScrollLeft(rstView.getScrollLeft() + scrollStep); } else { rstView.setScrollLeft(rstView.getScrollLeft() - (width - rstView.getScrollLeft())); buttonLeft.setEnabled(true); buttonRight.setEnabled(false); } } }); rstView.addExtension(renderInfo); grid.addComponent(buttonLeft); grid.addComponent(rstView); grid.addComponent(buttonRight); setContent(grid); grid.setExpandRatio(rstView, 1.0f); }
From source file:at.jku.ce.adaptivetesting.vaadin.ui.core.VaadinUI.java
License:LGPL
public VaadinUI() { // Set up the Navigator navigator = new Navigator(this, this); // Create Welcome Screen MainUI mainScreen = new MainUI(); mainScreen.setMargin(true);// w w w.j a v a2s .c o m Button start = new Button("Start", e -> { navigator.navigateTo(Views.TEST.toString()); }); start.setWidth("40%"); start.setHeight("40%"); //mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Willkommen zur " + productData))); mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h2", "Bitte klicke den <b>" + start.getCaption() + "</b> Button um mit dem Rechnungswesentest zu beginnen!"))); mainScreen.addComponent(start); mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER); navigator.addView(Views.DEFAULT.toString(), mainScreen); // Question view // Change this to the questionManager you like final QuestionManager manager = new AccountingQuestionManager("Rechnungswesentest"); navigator.addView(Views.TEST.toString(), manager); navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName()))); navigator.addView(Views.Admin.toString(), new AdminView(manager)); navigator.addView(Views.Results.toString(), new ResultView(manager)); navigator.setErrorView(mainScreen); LogHelper.logInfo("Startup completed"); }
From source file:at.reisisoft.jku.ce.adaptivelearning.vaadin.ui.core.VaadinUI.java
License:LGPL
public VaadinUI() { // Set up the Navigator navigator = new Navigator(this, this); // Create Welcome Screen MainUI mainScreen = new MainUI(); mainScreen.setMargin(true);//from w w w .j a v a 2s . co m Button start = new Button("Start", e -> { navigator.navigateTo(Views.TEST.toString()); }); start.setWidth("40%"); start.setHeight("40%"); mainScreen.addComponent(new HtmlLabel(HtmlUtils.center("h1", "Welcome to " + productData))); mainScreen.addComponent(new HtmlLabel( HtmlUtils.center("h2", "Click the <b>" + start.getCaption() + "</b> Button to start!"))); mainScreen.addComponent(start); mainScreen.setComponentAlignment(start, Alignment.MIDDLE_CENTER); navigator.addView(Views.DEFAULT.toString(), mainScreen); // Question view // Change this to the questionManager you like final QuestionManager manager = new AccountingQuestionManager("Accounting Quiz"); navigator.addView(Views.TEST.toString(), manager); navigator.addView(Views.Log.toString(), new LogView(new File(Servlet.getLogFileName()))); navigator.setErrorView(mainScreen); LogHelper.logInfo("Startup completed"); }
From source file:com.esofthead.mycollab.mobile.ui.ConfirmDialog.java
License:Open Source License
private void constructUI(final String message, final String okCaption, final String cancelCaption) { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined();/*from w w w . j a v a 2s. com*/ layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); VerticalLayout messageWrapper = new VerticalLayout(); messageWrapper.setStyleName("message-wrapper"); messageWrapper.setWidth("100%"); messageWrapper.setMargin(true); final Label messageDisplay = new Label(message); messageDisplay.setWidth("100%"); messageWrapper.addComponent(messageDisplay); layout.addComponent(messageWrapper); HorizontalLayout controlBtn = new HorizontalLayout(); controlBtn.setWidth("100%"); final Button okBtn = new Button(okCaption); okBtn.setWidth("100%"); okBtn.setHeight("35px"); final Button cancelBtn = new Button(cancelCaption); cancelBtn.setWidth("100%"); cancelBtn.setHeight("35px"); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = -8306231710367659086L; @Override public void buttonClick(ClickEvent event) { ConfirmDialog.this.setConfirmed(event.getButton() == okBtn); if (ConfirmDialog.this.getListener() != null) { ConfirmDialog.this.getListener().onClose(ConfirmDialog.this); } ConfirmDialog.this.close(); } }; okBtn.addClickListener(listener); cancelBtn.addClickListener(listener); controlBtn.addComponent(cancelBtn); controlBtn.addComponent(okBtn); layout.addComponent(controlBtn); this.setContent(layout); }
From source file:com.esofthead.mycollab.module.project.view.user.ProjectListComponent.java
License:Open Source License
public ProjectListComponent() { super();//from w w w . j a v a2s . c o m withSpacing(true).withMargin(false).withWidth("100%").withStyleName("project-list-comp"); MHorizontalLayout headerBar = new MHorizontalLayout(); headerPopupButton = new PopupButton(); headerPopupButton.setStyleName("project-list-comp-hdr"); headerPopupButton.setWidth("100%"); Label componentHeader = new Label(); componentHeader.setStyleName("h2"); headerPopupButton.setIcon(ProjectAssetsManager.getAsset(ProjectTypeConstants.PROJECT)); headerBar.with(headerPopupButton); if (AppContext.canBeYes(RolePermissionCollections.CREATE_NEW_PROJECT)) { final Button createProjectBtn = new Button("+", new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(final Button.ClickEvent event) { final ProjectAddWindow projectNewWindow = new ProjectAddWindow(); UI.getCurrent().addWindow(projectNewWindow); } }); createProjectBtn.setStyleName("add-project-btn"); createProjectBtn.setDescription("New Project"); createProjectBtn.setWidth("20px"); createProjectBtn.setHeight("20px"); headerBar.with(createProjectBtn).withAlign(createProjectBtn, Alignment.MIDDLE_RIGHT); } headerBar.withWidth("100%").withSpacing(true).expand(headerPopupButton); this.addComponent(headerBar); contentLayout = new MVerticalLayout().withStyleName("project-list-comp-content").withWidth("205px"); projectList = new ProjectPagedList(); headerPopupButton.setContent(projectList); projectDesc = new Label("", ContentMode.HTML); projectDesc.setStyleName("project-description"); addComponent(projectDesc); }
From source file:com.foc.vaadin.gui.components.tableAndTree.FVColGen_FocProperty.java
License:Apache License
private Object getDisplayObject_ForProperty_Editable(FocObject focObject, FProperty property, FVTableColumn column, Object columnId) { Object objReturned = null;// w w w. j av a 2 s .c o m FField field = property != null ? property.getFocField() : null; if (field instanceof FImageField) { objReturned = (AbstractComponent) getTableTreeDelegate().newGuiComponent(focObject, column, property); FVImageField imageField = (FVImageField) objReturned; imageField.setWidth("60px"); imageField.setHeight("50px"); } else if (field instanceof FCloudStorageField) { FCloudStorageProperty csProp = (FCloudStorageProperty) property; if (csProp != null) { FVImageField imageField = new FVImageField(csProp, column.getAttributes()); if (imageField.getBufferedImage() == null) { Resource resource = imageField.getResourceAndSetIcon(); if (resource != null) { Button docIcon = new Button(); docIcon.setStyleName(Runo.BUTTON_LINK); docIcon.setWidth("-1px"); docIcon.setHeight("-1px"); docIcon.setIcon(resource); objReturned = docIcon; } } else { Image image = imageField.getEmbedded(); if (image != null) { int maxWidth = 150; int maxHeight = 150; imageField.resizeImage(image, maxWidth, maxHeight); } objReturned = imageField; } } } else { objReturned = ""; if (property != null) { AbstractComponent abstractComponent = (AbstractComponent) getTableTreeDelegate() .newGuiComponent(focObject, column, property); if (abstractComponent != null) { objReturned = abstractComponent; abstractComponent.addStyleName("editableStyle"); if (abstractComponent instanceof FVTextField) { // ((FVTextField) abstractComponent).selectAll(); /* * ((FVTextField) abstractComponent).addFocusListener(new * FocusListener() { private boolean updating = false; public void * focus(FocusEvent event) { if(!updating){ updating = true; * ((FVTextField) abstractComponent).selectAll(); updating = false; * } } }); */ // Adding the focus listener on the component to be used in the // formula layout if (getFormulaFocusListener() != null) { ((FVTextField) abstractComponent).addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { ((FVTextField) abstractComponent).addFocusListener(getReadOnlyFocusListener(true)); ((FVTextField) abstractComponent).addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVCheckBox) { abstractComponent.setCaption(""); } else if (abstractComponent instanceof FVComboBox) { // Adding the focus listener on the component to be used in the // formula layout if (getFormulaFocusListener() != null) { ((FVComboBox) abstractComponent).addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { ((FVComboBox) abstractComponent).addFocusListener(getReadOnlyFocusListener(true)); ((FVComboBox) abstractComponent).addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVObjectPopupView) { // Adding the focus listener on the component to be used in the // formula layout FVObjectPopupView popupView = ((FVObjectPopupView) abstractComponent); if (popupView != null && getFormulaFocusListener() != null) { popupView.addPopupVisibilityListener(new PopupVisibilityListener() { @Override public void popupVisibilityChange(PopupVisibilityEvent event) { if (getTableTreeDelegate() != null && event != null && event.getPopupView() != null && event.getPopupView() instanceof FVObjectPopupView) { FVObjectPopupView popupView = (FVObjectPopupView) event.getPopupView(); getTableTreeDelegate().adjustFormulaLayoutForComponent(popupView); } } }); // popupView.addFocusListener(getFormulaFocusListener()); } // if(isUseReadOnlyFlag()){ // popupView.addFocusListener(getReadOnlyFocusListener(true)); // popupView.addBlurListener(getReadOnlyBlurListener(true)); // } } else if (abstractComponent instanceof FVObjectSelector) { // Adding the focus listener on the component to be used in the // formula layout FVObjectComboBox comboBox = ((FVObjectSelector) abstractComponent).getComboBox(); if (comboBox != null && getFormulaFocusListener() != null) { comboBox.addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { comboBox.addFocusListener(getReadOnlyFocusListener(true)); comboBox.addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVObjectComboBox && getFormulaFocusListener() != null) { FVObjectComboBox comboBox = (FVObjectComboBox) abstractComponent; if (comboBox != null) { comboBox.addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { comboBox.addFocusListener(getReadOnlyFocusListener(true)); comboBox.addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVMultipleChoiceComboBox && getFormulaFocusListener() != null) { FVMultipleChoiceComboBox comboBox = (FVMultipleChoiceComboBox) abstractComponent; if (comboBox != null) { comboBox.addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { comboBox.addFocusListener(getReadOnlyFocusListener(true)); comboBox.addBlurListener(getReadOnlyBlurListener(true)); } } // Setting the column and row Ids of component FocXMLGuiComponent focXMLGuiComponent = (FocXMLGuiComponent) abstractComponent; FocXMLGuiComponentDelegate focXMLGuiComponentDelegate = focXMLGuiComponent.getDelegate(); if (focXMLGuiComponentDelegate != null) { focXMLGuiComponentDelegate.setColumnId(columnId); if (focObject != null && focObject.getReference() != null) { focXMLGuiComponentDelegate.setRowId(focObject.getReference().getLong()); } } abstractComponent.setId(column.getDataPath()); abstractComponent.setWidth("100%");// This was added to get the node // name text field in the BKDN // tree big enough to enter or see // the value // If we put 100% in the xml we get a small width extendable. but with // this solution we have a fixed minimum width in the xml + the 100% // allows us to change the width if (isUseReadOnlyFlag()) { abstractComponent.setReadOnly(true); } } } } if (property != null && property.isInherited()) { FProperty inheritedProp = null; try { inheritedProp = property.getFocField().getInheritedPropertyGetter() .getInheritedProperty(property.getFocObject(), property); } catch (Exception e) { Globals.logException(e); } if (inheritedProp != null) { objReturned = inheritedProp; } } return objReturned; }
From source file:com.foc.vaadin.gui.components.tableAndTree.FVColGen_FocProperty.java
License:Apache License
private Object getDisplayObject_ForProperty_NonEditable(FocObject focObject, FProperty property, FVTableColumn column, Object columnId) { Object objReturned = null;//from w w w . j av a 2s. c om FField field = property != null ? property.getFocField() : null; if (property != null) { // Remove the editable component in case the editing status has changed // -------------------------------------------------------------------- String objRef = focObject != null && focObject.getReference() != null ? focObject.getReference().toString() : null; String compName = TableTreeDelegate.newComponentName(getTableName(), objRef, (String) column.getName()); FocXMLLayout focXMLLayout = getFocXMLLayout(); if (focXMLLayout != null) { FocXMLGuiComponent comp = focXMLLayout.removeComponentByName(compName); if (comp != null) { comp.dispose(); } } // -------------------------------------------------------------------- objReturned = property.vaadin_TableDisplayObject(column.getFormat(), column.getCaptionProp()); if (objReturned instanceof Boolean) { if (((Boolean) objReturned).booleanValue()) { objReturned = new Embedded("", new ThemeResource("../runo/icons/16/ok.png")); } else { // objReturned = new Embedded("", new // ThemeResource("../runo/icons/16/cancel.png")); objReturned = FVIconFactory.getInstance().getFVIcon_Embedded(FVIconFactory.ICON_EMPTY, FVIconFactory.SIZE_SMALL); } } else if (field instanceof FCloudStorageField) { FCloudStorageProperty csProp = (FCloudStorageProperty) property; if (csProp != null) { FVImageField imageField = new FVImageField(csProp, column.getAttributes()); if (imageField.getBufferedImage() == null) { Resource resource = imageField.getResourceAndSetIcon(); if (resource != null) { Button docIcon = new Button(); docIcon.setStyleName(Runo.BUTTON_LINK); docIcon.setWidth("-1px"); docIcon.setHeight("-1px"); docIcon.setIcon(resource); objReturned = docIcon; } } else { Image image = imageField.getEmbedded(); if (image != null) { int maxWidth = 150; int maxHeight = 150; imageField.resizeImage(image, maxWidth, maxHeight); } objReturned = imageField; } } } else if (property instanceof FObject || property instanceof FDate || property instanceof FString || property instanceof FDouble || property instanceof FInt || property instanceof FMultipleChoice) { if (property instanceof FMultipleChoice) { objReturned = property.getString(); } FVLabel lbl = null; String styleAttrib = column.getAttributes() != null ? column.getAttributes().getValue(FXML.ATT_STYLE) : null; int maxCharacters = column.getMaxCharacters(); String ttt = null; if (styleAttrib != null && !styleAttrib.isEmpty()) { lbl = new FVLabel((String) objReturned); lbl.parseStyleAttributeValue(styleAttrib); objReturned = lbl; } else if (property instanceof FDouble || (property instanceof FInt && !(property instanceof FMultipleChoice))) { lbl = new FVLabelInTable(property, focObject, column); lbl.copyMemoryToGui(); lbl.addStyleName("foc-text-right"); objReturned = lbl; } if (property instanceof FMultipleChoice) { Object itemObj = ((FMultipleChoice) property).getValue(); if (itemObj != null && itemObj instanceof FMultipleChoiceItem) { FMultipleChoiceItem item = (FMultipleChoiceItem) itemObj; if (lbl == null) { String iconNameInFontAwesome = item != null ? item.getIconFontAwesomeName() : null; if (iconNameInFontAwesome == null) { lbl = new FVLabel(item.getTitle()); // lbl.setIcon(FVIconFactory.getInstance().getFVIcon_Small(path)); } else { FontAwesome icon = FontAwesome.valueOf(iconNameInFontAwesome); lbl = new FVLabel(""); lbl.setCaption(null); lbl.setContentMode(ContentMode.HTML); lbl.setValue(item.getTitle() + " " + icon.getHtml()); } objReturned = lbl; } } } //If RTL I have t put the String in a label to align right if (lbl == null && getFocXMLLayout().isRTL()) { lbl = new FVLabelInTable(property, focObject, column); lbl.copyMemoryToGui(); lbl.addStyleName("foc-text-right"); objReturned = lbl; } //Setting the TTT is necessary //We have 2 conditions: either the objReturned is String or Label. //---------------------------- if (lbl != null) { String originalValue = lbl.getValue(); if (maxCharacters > 0 && originalValue != null && originalValue.length() > maxCharacters) { ttt = originalValue; // lbl.setLocale(); if (getFocXMLLayout().isRTL()) { lbl.addStyleName("foc-cellComment-left"); // lbl.setLocale(new Locale("ar")); StringBuffer buff = new StringBuffer(ttt.substring(0, maxCharacters)); // buff.append("..."); buff.append("..."); lbl.setValue(buff.toString()); } else { lbl.addStyleName("foc-cellComment-right"); lbl.setValue(ttt.substring(0, maxCharacters) + "..."); } } } else if (objReturned instanceof String) { String originalValue = (String) objReturned; if (maxCharacters > 0 && originalValue != null && originalValue.length() > maxCharacters) { ttt = originalValue; if (getFocXMLLayout().isRTL()) { objReturned = ttt.substring(0, maxCharacters) + "..."; } else { objReturned = ttt.substring(0, maxCharacters) + "..."; } } } if (ttt != null && getTableTreeDelegate() != null) { getTableTreeDelegate().addCellTooltipText(focObject.getReference(), columnId, ttt); } //---------------------------- if (lbl != null) { if (getFocXMLLayout().isRTL()) lbl.addStyleName("foc-text-right"); FocXMLGuiComponent focXMLGuiComponent = lbl; FocXMLGuiComponentDelegate componentDelegate = focXMLGuiComponent.getDelegate(); if (componentDelegate != null) { componentDelegate.setColumnId(columnId); if (focObject != null && focObject.getReference() != null) { componentDelegate.setRowId(focObject.getReference().getLong()); } } } if (lbl != null && getFocXMLLayout() != null) getFocXMLLayout().putComponent(compName, lbl); FocXMLAttributes attributes = column.getAttributes(); if (attributes != null && attributes.getValue(FXML.ATT_LINK) != null && attributes.getValue(FXML.ATT_LINK).equals("true")) { HyperLinkButton button = new HyperLinkButton(focObject, objReturned, compName); button.addClickListener(hyperLinkButtonListener); button.addStyleName("focLinkInTable"); objReturned = button; // if(getTableTreeDelegate().getViewContainer_ForOpen() == ITableTree.VIEW_CONTAINER_NEW_BROWSER_TAB){ // BrowserWindowOpener opener = null; // opener = new BrowserWindowOpener(UI.getCurrent().getClass()); // opener.extend(button); // } } } else { objReturned = property; // if((property instanceof FMultipleChoice)){ // FocXMLAttributes attributes = column.getAttributes(); // if(attributes != null && attributes.getValue(FXML.ATT_LINK) != null && attributes.getValue(FXML.ATT_LINK).equals("true")){ // HyperLinkButton button = new HyperLinkButton(focObject, property.getString()); // button.addClickListener(hyperLinkButtonListener); // button.addStyleName("focLinkInTable"); // objReturned = button; // } // } } } // if(objReturned instanceof String){ // objReturned = new Label(objReturned.toString()); // } return objReturned; }
From source file:com.github.wolfie.detachedtabs.DetachedTabs.java
License:Open Source License
/** * Add a tab//from w w w. j a v a 2 s . c om * * @param content * The {@link Component} that will be shown once its corresponding * tab is selected. * @param caption * The caption for the tab. */ public void addTab(final Component content, final String caption) { if (content == null || caption == null) { throw new NullPointerException("Arguments may not be null"); } final Button button = new NativeButton(caption, tabChangeListener); if (orientation == Orientation.HORIZONTAL) { button.setHeight("100%"); button.setWidth(getWidth(), getWidthUnits()); } else { button.setHeight(getHeight(), getHeightUnits()); button.setWidth("100%"); } layout.addComponent(button); buttonComponentMap.put(button, content); tabs.add(button); adjustTabStyles(); if (shownTab == null) { switchTo(content, button); } }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.HourWidget.java
public HourWidget(int aHourNumber, int aTotalHourNumber) { setWidth("500px"); setHeight("500px"); //setStyleName("backColorGrey"); String[] classes = { "VI", "VII", "VIII", "IX", "X" }; int index1 = new Random().nextInt(classes.length); String selectedClass = (classes[index1]); String[] sections = { "A", "B", "C", "D", "E" }; int index2 = new Random().nextInt(classes.length); String selectedSection = (sections[index2]); String[] content = { "Gravitation", "Lab", "Electricity", "Force", "Motion" }; int index3 = new Random().nextInt(classes.length); String selectedContent = (content[index3]); //Button b= new Button("2"); //addComponent(b); //c.setSizeFull(); Button iMinorText = new Button(selectedContent); double redOrGreen = Math.random(); if (Math.random() > 0.5) { iMinorText.setStyleName("v-button-type1-red"); } else {//w w w .j a v a2 s .c o m iMinorText.setStyleName("v-button-type1-green"); } iMinorText.setHeight("40px"); iMinorText.setWidth("125px"); //c.setCaptionAsHtml(true); kkk addComponent(iMinorText);//,"top:10px;left:10px"); Label iMajorText = new Label(selectedClass + " - " + selectedSection); iMajorText.setStyleName("v-label-type1"); iMajorText.setHeight("15px"); iMajorText.setWidth("50px"); addComponent(iMajorText, "top:2px;left:1px"); double numberOfMemos = Math.floor(Math.random() * 5); //Diplay if any memo present NativeButton memoButton; if (numberOfMemos > 0) { memoButton = new NativeButton();//String.valueOf(numberOfMemos).replace(".0", "")); memoButton.setStyleName("v-button-type2"); //memoButton.setHeight("15px"); //memoButton.setWidth("30px"); memoButton.setIcon(FontAwesome.PENCIL); addComponent(memoButton, "top:2px;left:85px"); } double numberOfNotifications = Math.floor(Math.random() * 5); NativeButton notificationButton; if (numberOfNotifications > 0) { notificationButton = new NativeButton();//String.valueOf(numberOfNotifications).replace(".0", "")); notificationButton.setStyleName("v-button-type2"); //notificationButton.setHeight("15px"); //notificationButton.setWidth("30px"); notificationButton.setIcon(FontAwesome.BELL); addComponent(notificationButton, "top:2px;left:100px"); } }
From source file:com.logicbomb.newschool.MyAppWidgetSet.core.UserDetailsWidget.java
public UserDetailsWidget() { HorizontalLayout h = new HorizontalLayout(); addComponent(h);/* w w w . jav a 2 s .co m*/ h.setSizeFull(); //h.setSpacing(true); Button userPhoto = new Button(); userPhoto.setIcon(FontAwesome.USER); userPhoto.setHeight("100px"); userPhoto.setWidth("100px"); h.addComponent(userPhoto); //h.setComponentAlignment(userPhoto, Alignment.TOP_LEFT); VerticalLayout v = new VerticalLayout(); //v.setStyleName("backColorBlack"); h.addComponent(v); v.setStyleName("v-layout-padding-left"); //h.setComponentAlignment(userPhoto, Alignment.TOP_RIGHT); v.setHeight("106px"); v.setWidth("100px"); // v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); Button editProfile = new Button("Profile"); editProfile.setStyleName("v-button-type3"); editProfile.setIcon(FontAwesome.USER); editProfile.setWidth("100px"); editProfile.setWidth("102px"); v.addComponent(editProfile); //v.setComponentAlignment(editProfile, Alignment.TOP_LEFT); Button settings = new Button("Settings"); settings.setStyleName("v-button-type3"); settings.setIcon(FontAwesome.WRENCH); settings.setWidth("100px"); settings.setWidth("102px"); v.addComponent(settings); //v.setComponentAlignment(editProfile, Alignment.MIDDLE_RIGHT); Button logOut = new Button("Log Out"); logOut.setStyleName("v-button-type3"); logOut.setIcon(FontAwesome.KEY); logOut.setWidth("100px"); logOut.setWidth("102px"); v.addComponent(logOut); //v.setComponentAlignment(editProfile, Alignment.BOTTOM_RIGHT); //v.setComponentAlignment(userStatus, Alignment.MIDDLE_CENTER); }