List of usage examples for com.vaadin.ui Label setHeight
@Override public void setHeight(String height)
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
@Override public void initGui() { super.initGui(); VerticalLayout leftLayout = getLeftLayout(); leftLayout.setSpacing(true);//from w w w. java2 s.c o m getLeftLabel().setValue(""); //"Click on the links below to display lists of cards in play."); int i = leftLayout.getComponentIndex(getLeftLabel()) + 1; // start adding from here Label sp; String possessive = "my"; String capPossessive = "My"; if (!userIsMe) possessive = capPossessive = userName + "'s"; leftLayout.addComponent(allRow = makeCheckRow(allButt = makeButt("All " + possessive + " ideas")), i++); setCheck(allRow, true); leftLayout.setComponentAlignment(allRow, Alignment.MIDDLE_LEFT); leftLayout.addComponent( buildsRow = makeCheckRow(buildsButt = makeButt("Builds on " + possessive + " ideas")), i++); setCheck(buildsRow, false); leftLayout.addComponent(favsRow = makeCheckRow(favsButt = makeButt(capPossessive + " favorite ideas")), i++); setCheck(favsRow, false); leftLayout.addComponent(profileRow = makeCheckRow(profileButt = makeButt(capPossessive + " idea profile")), i++); setCheck(profileRow, false); getRightLayout().addComponent(sp = new Label()); sp.setHeight("20px"); showAllMyIdeas(); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyIdeasPanel2.java
License:Open Source License
@SuppressWarnings("unchecked") private Component createProfileTL() { VerticalLayout lay = new VerticalLayout(); lay.setWidth("670px"); Label lab; lay.addComponent(lab = new Label()); lab.setHeight("10px"); VerticalLayout innerVL = new VerticalLayout(); innerVL.setSpacing(true);//w w w. j a v a 2 s . com innerVL.setMargin(true); innerVL.setWidth("100%"); //"90%"); innerVL.addStyleName("m-myideaprofile-table"); lay.addComponent(innerVL); GridLayout gridL = new GridLayout(); gridL.setColumns(2); gridL.addStyleName("m-userprofile-text"); gridL.setSpacing(true); CardType ct; int count = 0; int largest = -1; List<Card> lisPos = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType .getCurrentPositiveIdeaCardTypeTL()/*CardTypeManager.getPositiveIdeaCardTypeTL()*/)) .list(); count += lisPos.size(); largest = Math.max(largest, lisPos.size()); List<Card> lisNeg = commonCriteria() .add(Restrictions.eq("cardType", ct = CardType.getCurrentNegativeIdeaCardTypeTL())).list(); //CardTypeManager.getNegativeIdeaCardTypeTL())).list(); count += lisNeg.size(); largest = Math.max(largest, lisNeg.size()); List<Card> lisExpand = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExpandTypeTL())) .list();//CardTypeManager.getExpandTypeTL())).list(); count += lisExpand.size(); largest = Math.max(largest, lisExpand.size()); List<Card> lisAdapt = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getAdaptTypeTL())) .list();//CardTypeManager.getAdaptTypeTL())).list(); count += lisAdapt.size(); largest = Math.max(largest, lisAdapt.size()); List<Card> lisCounter = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getCounterTypeTL())) .list();//CardTypeManager.getCounterTypeTL())).list(); count += lisCounter.size(); largest = Math.max(largest, lisCounter.size()); List<Card> lisExplore = commonCriteria().add(Restrictions.eq("cardType", ct = CardType.getExploreTypeTL())) .list();//CardTypeManager.getExploreTypeTL())).list(); count += lisExplore.size(); largest = Math.max(largest, lisExplore.size()); ct = CardType.getCurrentPositiveIdeaCardTypeTL(); //CardTypeManager.getPositiveIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisPos.size(), ct, gridL); ct = CardType.getCurrentNegativeIdeaCardTypeTL(); //CardTypeManager.getNegativeIdeaCardTypeTL(); row(ct.getSummaryHeader(), largest, lisNeg.size(), ct, gridL); ct = CardType.getExpandTypeTL(); //CardTypeManager.getExpandTypeTL(); row(ct.getSummaryHeader(), largest, lisExpand.size(), ct, gridL); ct = CardType.getAdaptTypeTL(); //CardTypeManager.getAdaptTypeTL(); row(ct.getSummaryHeader(), largest, lisAdapt.size(), ct, gridL); ct = CardType.getCounterTypeTL(); //CardTypeManager.getCounterTypeTL(); row(ct.getSummaryHeader(), largest, lisCounter.size(), ct, gridL); ct = CardType.getExploreTypeTL(); //CardTypeManager.getExploreTypeTL(); row(ct.getSummaryHeader(), largest, lisExplore.size(), ct, gridL); gridL.addComponent(new Label("")); gridL.addComponent(new Label("")); gridL.addComponent(new Label("TOTAL")); gridL.addComponent(new Label("" + count)); innerVL.addComponent(gridL); lay.addComponent(lab = new Label()); lab.setHeight("1px"); lay.setExpandRatio(lab, 1.0f); return lay; }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileMyMailPanel.java
License:Open Source License
@Override public void initGui() { super.initGui(); String left = "Players can choose to receive messages in-game or externally (or both or neither).<br/><br/>Player messages are private and" + " actual email identities are hidden.<br/><br/>You can find another player's profile by clicking on their name or using the search" + " feature. Then you may send a message to that player by clicking on the " + "<i>Send player private email</i> link.<br/><br/>If this link is not present or is disabled, then the player has opted " + "to receive neither email nor in-game messages.<br/><br/>"; getLeftLabel().setValue(left);//from w w w.j av a 2 s . c o m if (!userIsMe) { User u = User.getTL(uid); if (u.isOkEmail() || u.isOkGameMessages()) { final NativeButton sendEmailButt = new NativeButton("Send private mail to this user"); sendEmailButt.addStyleName(BaseTheme.BUTTON_LINK); sendEmailButt.addStyleName("m-userProfile3-sendmail-button"); Label sp; VerticalLayout vl = getRightLayout(); vl.setSizeUndefined(); vl.setWidth("100%"); vl.addComponent(sp = new Label()); sp.setHeight("50px"); vl.addComponent(sendEmailButt); vl.setComponentAlignment(sendEmailButt, Alignment.MIDDLE_CENTER); vl.addComponent(sp = new Label()); sp.setHeight("1px"); vl.setExpandRatio(sp, 1.0f); sendEmailButt.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); User u = User.getTL(uid); if (u.isOkEmail() || u.isOkGameMessages()) // redundant here new SendMessageWindow(u, imAdminOrGameMaster); else Notification.show("Sorry", "Player " + u.getUserName() + " does not receive mail.", Notification.Type.WARNING_MESSAGE); HSess.close(); } }); } return; } VerticalLayout rightVL = getRightLayout(); rightVL.setSizeUndefined(); rightVL.setWidth("100%"); getLeftAddedVerticalLayout() .addComponent(showButt = new ToggleLinkButton("View all", "View unhidden only", null)); //,ttArray)); showButt.addOnListener(new ViewAllListener()); showButt.addOffListener(new ViewUnhiddenOnlyListener()); showButt.setToolTips("Temporarily show all messages, including those marked \"hidden\"", "Temporarily hide messages marked \"hidden\""); Label sp; rightVL.addComponent(sp = new Label()); sp.setHeight("10px"); rightVL.addComponent(mailPanel); User me = Mmowgli2UI.getGlobals().getUserTL(); Set<Message> msgs = me.getGameMessages(); if (msgs.size() > 0) { Message[] msgsAr = new Message[msgs.size()]; msgsAr = msgs.toArray(msgsAr); // avoid concurrent mod int num = msgsAr.length;// .size(); int n = num; for (Message m : msgsAr) { addOneMessage(m, n--, num, null); } } }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfilePage3.java
License:Open Source License
public void initGuiTL() { setWidth(APPLICATION_SCREEN_WIDTH);// www .j a v a 2 s . co m setHeight("1215px"); //"1000px"); Label sp; this.addComponent(sp = new Label()); sp.setHeight("25px"); addComponent(topPan, "top:5px;left:22px"); //33px"); topPan.initGui(); AbsoluteLayout bottomPan = new AbsoluteLayout(); addComponent(bottomPan, "top:375;left:23px"); bottomPan.setWidth("969px"); bottomPan.setHeight("841px"); NewTabClickHandler tabHndlr = new NewTabClickHandler(); // Set different art if it's "me" we're looking at or anyother if (!itsSomebodyElse) { //tabs.setStyleName("m-userProfile2BlackTabs"); //978w 831h has names bottomPan.addStyleName("m-userprofile3bottom"); myIdeasButt.setStyleName("m-userProfile3MyIdeasTab"); myActionPlansButt.setStyleName("m-userProfile3MyActionPlansTab"); myBuddiesButt.setStyleName("m-userProfile3MyBuddiesTab"); myMailButt.setStyleName("m-userProfile3MyMailTab"); } else { //tabs.setStyleName("m-userProfile2BlackTabs_other"); bottomPan.addStyleName("m-userprofile3HisBottom"); myIdeasButt.setStyleName("m-userProfile3HisIdeasTab"); myActionPlansButt.setStyleName("m-userProfile3HisActionPlansTab"); myBuddiesButt.setStyleName("m-userProfile3HisBuddiesTab"); } HorizontalLayout buttons = new HorizontalLayout(); buttons.setSpacing(false); myIdeasButt.addClickListener(tabHndlr); buttons.addComponent(myIdeasButt); myActionPlansButt.addClickListener(tabHndlr); buttons.addComponent(myActionPlansButt); myActionPlansButt.addStyleName("m-transparent-background"); // un selected myBuddiesButt.addClickListener(tabHndlr); buttons.addComponent(myBuddiesButt); myBuddiesButt.addStyleName("m-transparent-background"); // un selected if (!itsSomebodyElse) { myMailButt.addClickListener(tabHndlr); buttons.addComponent(myMailButt); myMailButt.addStyleName("m-transparent-background"); // un selected } bottomPan.addComponent(buttons, "top:0px;left:0px"); // stack the pages String panPosition = "top:70px;left:0px"; bottomPan.addComponent(myIdeasPanel, panPosition); myIdeasPanel.initGui(); bottomPan.addComponent(myActionsPanel, panPosition); myActionsPanel.initGui(); myActionsPanel.setVisible(false); bottomPan.addComponent(myBuddiesPanel, panPosition); myBuddiesPanel.initGui(); myBuddiesPanel.setVisible(false); bottomPan.addComponent(myMailPanel, panPosition); myMailPanel.initGui(); myMailPanel.setVisible(false); }
From source file:edu.nps.moves.mmowgli.modules.userprofile.UserProfileTabPanel.java
License:Open Source License
@Override public void initGui() { setWidth("960px"); setHeight("750px"); // must fill the background setSpacing(false);/*from www . j a va 2s . c om*/ leftLay = new VerticalLayout(); leftLay.addStyleName("m-userprofiletabpanel-left"); leftLay.setWidth("245px");// plus 45 padding leftLay.setMargin(false); Label sp; leftLay.addComponent(sp = new Label()); sp.setHeight("45px"); leftLabel = new HtmlLabel("placeholder"); leftLay.addComponent(leftLabel); leftAddedVL = new VerticalLayout(); leftLay.addComponent(leftAddedVL); leftAddedVL.setWidth("100%"); leftLay.addComponent(sp = new Label()); sp.setHeight("1px"); leftLay.setExpandRatio(sp, 1.0f); // bottom filler rightLay = new VerticalLayout(); rightLay.setSizeUndefined(); // will expand with content rightLay.addStyleName("m-tabpanel-right"); rightLay.addStyleName("m-userprofile-tabpanel-font"); addComponent(leftLay); addComponent(sp = new Label()); sp.setWidth("15px"); addComponent(rightLay); setComponentAlignment(rightLay, Alignment.TOP_CENTER); //del if no help this.setExpandRatio(rightLay, 1.0f); }
From source file:edu.nps.moves.mmowgliMobile.ui.SigninPopover.java
License:Open Source License
public SigninPopover() { setWidth("300px"); setHeight("350px"); setClosable(false); // else it can be closed by clicking anywhere outside it VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);/* w w w. j a v a2s . com*/ layout.setMargin(true); layout.addComponent(nameTF = new TextField("Player name")); nameTF.setWidth("100%"); layout.addComponent(pwTF = new PasswordField("Password")); pwTF.setWidth("100%"); Label lab; layout.addComponent(lab = new Label()); lab.setHeight("25px"); layout.addComponent(submitButt = new Button("Sign in", new SubmitListener())); submitButt.setSizeUndefined(); layout.addComponent(errorLab = new HtmlLabel("")); layout.setComponentAlignment(errorLab, Alignment.TOP_CENTER); // Decorate with navigation view NavigationView content = new NavigationView(layout); content.setCaption("Sign in"); setContent(content); // Have a close button /* Button close = new Button(null, this); close.setIcon(new ThemeResource("../runo/icons/64/cancel.png")); content.setRightComponent(close); */ }
From source file:edu.nps.moves.security.PasswordResetUI.java
License:Open Source License
private void handleChangeTL(User user) { this.user = user; Game g = Game.getTL();//from ww w. j a v a 2s .c o m String brand = g.getCurrentMove().getTitle(); Page.getCurrent().setTitle("Password reset for " + brand + " mmowgli"); HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(true); hLay.setWidth("100%"); setContent(hLay); GameLinks gl = GameLinks.getTL(); String blog = gl.getBlogLink(); Label lab; hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); VerticalLayout vl = new VerticalLayout(); hLay.addComponent(vl); vl.setWidth(bannerWidthPx); hLay.addComponent(lab = new Label()); hLay.setExpandRatio(lab, 0.5f); vl.addStyleName("m-greyborder"); vl.setMargin(true); vl.setSpacing(true); vl.addComponent(lab = new HtmlLabel("")); lab.addStyleName("m-font-21-bold"); lab.setSizeUndefined(); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); StringBuilder sb = new StringBuilder(); sb.append(thanksHdr1); sb.append(blog); sb.append(thanksHdr2); sb.append(brand); sb.append(thanksHdr3); lab.setValue(sb.toString()); vl.addComponent(lab = new HtmlLabel("")); lab.setHeight("15px"); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); FormLayout fLay = new FormLayout(); fLay.setSizeUndefined(); fLay.addStyleName("m-login-form"); // to allow styling contents (v-textfield) vl.addComponent(fLay); vl.setComponentAlignment(fLay, Alignment.MIDDLE_CENTER); newPw = new PasswordField("New Password"); newPw.setWidth("99%"); fLay.addComponent(newPw); newPw2 = new PasswordField("Again, please"); newPw2.setWidth("99%"); fLay.addComponent(newPw2); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.setSpacing(true); vl.addComponent(buttLay); vl.setComponentAlignment(buttLay, Alignment.TOP_CENTER); NativeButton cancelButt = new NativeButton(); cancelButt.setStyleName("m-cancelButton"); buttLay.addComponent(cancelButt); buttLay.setComponentAlignment(cancelButt, Alignment.BOTTOM_RIGHT); saveButt = new NativeButton(); saveButt.setClickShortcut(ShortcutAction.KeyCode.ENTER); saveButt.setStyleName("m-continueButton"); //m-saveChangesButton"); buttLay.addComponent(saveButt); buttLay.setComponentAlignment(saveButt, Alignment.BOTTOM_RIGHT); cancelButt.addClickListener(this); saveButt.addClickListener(this); }
From source file:fi.semantum.strategia.Utils.java
License:Open Source License
public static void updateYears(final Database database, final VerticalLayout vl) { vl.removeAllComponents();//from w w w. ja va2 s.c o m final TimeConfiguration tc = TimeConfiguration.getInstance(database); TimeInterval ti = TimeInterval.parse(tc.getRange()); for (int i = ti.startYear; i <= ti.endYear; i++) { final int year = i; HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); String caption = Integer.toString(i) + (tc.isFrozen(i) ? " Muutokset estetty" : " Muokattavissa"); Label l = new Label(caption); l.setWidth("250px"); l.setHeight("100%"); hl.addComponent(l); Button b = new Button(tc.isFrozen(i) ? "Avaa muokattavaksi" : "Est muutokset"); b.addStyleName(ValoTheme.BUTTON_SMALL); b.addClickListener(new ClickListener() { private static final long serialVersionUID = 556680407448842136L; @Override public void buttonClick(ClickEvent event) { if (tc.isFrozen(year)) { tc.unfreeze(year); } else { tc.freeze(year); } updateYears(database, vl); } }); b.setWidth("200px"); hl.addComponent(b); //hl.setWidth("100%"); vl.addComponent(hl); } }
From source file:fi.semantum.strategia.widget.Indicator.java
License:Open Source License
public static Label makeHistory(Database database, Indicator indicator, boolean forecast) { Label ta2 = new Label("Historia"); ta2.setContentMode(ContentMode.HTML); ta2.setWidth("100%"); ta2.setHeight("100%"); StringBuilder sb = new StringBuilder(); sb.append("<b>Historia</b><br><br>"); for (Map.Entry<Date, TimeSeriesEntry> entry : indicator.values.list()) { TimeSeriesEntry tse = entry.getValue(); Account account = tse.getAccount(); Date date = entry.getKey(); String user = account != null ? account.getId(database) : "Jrjestelm"; sb.append("<b>"); sb.append(user);//from ww w . j a va2s. c om sb.append("</b> pivitti "); sb.append(forecast ? " ennustetta" : " toteumaa"); sb.append(" <b>"); sb.append(Utils.describeDate(date)); sb.append("</b><br><hr>"); sb.append(" Uusi arvo on <b>"); sb.append(forecast ? tse.getForecast() : tse.getValue() + " " + indicator.getUnitAndComment()); sb.append("</b><br>"); String comment = tse.getComment(); if (comment != null) sb.append("<p>" + tse.getComment() + "</p>"); sb.append("<br>"); } ta2.setValue(sb.toString()); return ta2; }
From source file:fi.semantum.strategia.widget.Indicator.java
License:Open Source License
public static void updateIndicators(final Main main, final Base base, boolean canWrite) { final Database database = main.getDatabase(); List<IndicatorDescription> descs = new ArrayList<IndicatorDescription>(); fillIndicatorDescriptions(main, base, "", descs); boolean isMap = base instanceof Strategiakartta; if (isMap && (!descs.isEmpty() || canWrite)) { HorizontalLayout indiHeader = new HorizontalLayout(); indiHeader.setSpacing(true);/*from w w w . j av a 2s .com*/ Label header = new Label("Indikaattorit (ennuste)"); main.propertyCells.add(Utils.excelRow(header.getValue())); header.setHeight("32px"); header.addStyleName(ValoTheme.LABEL_HUGE); header.addStyleName(ValoTheme.LABEL_BOLD); indiHeader.addComponent(header); indiHeader.setComponentAlignment(header, Alignment.BOTTOM_CENTER); if (canWrite) { final Image editIndicators = new Image(null, new ThemeResource("chart_line_edit.png")); editIndicators.setHeight("24px"); editIndicators.setWidth("24px"); editIndicators.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 2661060702097338722L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Utils.loseFocus(editIndicators); manageIndicators(main, main.getUIState().currentItem); } }); indiHeader.addComponent(editIndicators); indiHeader.setComponentAlignment(editIndicators, Alignment.BOTTOM_CENTER); } main.properties.addComponent(indiHeader); main.properties.setComponentAlignment(indiHeader, Alignment.MIDDLE_CENTER); VerticalLayout indicators = new VerticalLayout(); boolean showYears = main.getUIState().time.equals(Property.AIKAVALI_KAIKKI); Property time = Property.find(database, Property.AIKAVALI); int index = 0; for (final IndicatorDescription desc : descs) { ArrayList<String> excelRow = new ArrayList<String>(); Indicator indicator = desc.indicator; final HorizontalLayout hl = new HorizontalLayout(); hl.addStyleName((((index++) & 1) == 0) ? "evenProperty" : "oddProperty"); hl.setSpacing(true); Label l = new Label(desc.caption); excelRow.add(l.getValue().replace("%nbsp", "")); l.setContentMode(ContentMode.HTML); l.setWidth("450px"); l.addStyleName("propertyName"); l.setData(desc); hl.addComponent(l); hl.setComponentAlignment(l, Alignment.MIDDLE_LEFT); String value = updateIndicatorValue(main, hl, base, indicator, canWrite); excelRow.add(value); Label unit = new Label(indicator.getUnit()); unit.setWidth("100px"); hl.addComponent(unit); hl.setComponentAlignment(unit, Alignment.MIDDLE_LEFT); excelRow.add(unit.getValue()); Label comment = new Label(indicator.getValueShortComment()); comment.setWidth("150px"); hl.addComponent(comment); hl.setComponentAlignment(comment, Alignment.MIDDLE_LEFT); excelRow.add(comment.getValue()); if (showYears) { HorizontalLayout hl2 = new HorizontalLayout(); hl2.setWidth("70px"); hl2.setHeight("100%"); hl.addComponent(hl2); hl.setComponentAlignment(hl2, Alignment.MIDDLE_LEFT); String years = time.getPropertyValue(indicator); if (years == null) years = Property.AIKAVALI_KAIKKI; final Label region = new Label(years); region.setWidthUndefined(); excelRow.add(region.getValue()); hl2.addComponent(region); hl2.setComponentAlignment(region, Alignment.MIDDLE_CENTER); } final Image wiki = new Image(); wiki.setSource(new ThemeResource("table_edit.png")); wiki.setHeight("24px"); wiki.setWidth("24px"); wiki.addClickListener(new MouseEvents.ClickListener() { private static final long serialVersionUID = 2661060702097338722L; @Override public void click(com.vaadin.event.MouseEvents.ClickEvent event) { Wiki.openWiki(main, desc.indicator); } }); hl.addComponent(wiki); hl.setComponentAlignment(wiki, Alignment.MIDDLE_CENTER); indicators.addComponent(hl); indicators.setComponentAlignment(hl, Alignment.MIDDLE_CENTER); main.propertyCells.add(excelRow); } indicators.addLayoutClickListener(new LayoutClickListener() { private static final long serialVersionUID = 3295743025581923380L; private String extractData(Component c) { if (c instanceof AbstractComponent) { Object data = ((AbstractComponent) c).getData(); if (data instanceof IndicatorDescription) { IndicatorDescription desc = (IndicatorDescription) data; return desc.indicator.getDescription(database); } } return null; } @Override public void layoutClick(LayoutClickEvent event) { String desc = extractData(event.getClickedComponent()); if (desc == null) return; String content = "<div style=\"width: 700px; border: 2px solid; padding: 5px\">"; content += "<div style=\"text-align: center; white-space:normal; font-size: 36px; padding: 10px\">" + desc + "</div>"; content += "</div>"; Notification n = new Notification(content, Notification.Type.HUMANIZED_MESSAGE); n.setHtmlContentAllowed(true); n.show(Page.getCurrent()); } }); main.properties.addComponent(indicators); main.properties.setComponentAlignment(indicators, Alignment.MIDDLE_CENTER); } }