List of usage examples for com.vaadin.ui Label setWidth
@Override public void setWidth(String width)
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainTreeTablePopup.java
License:Open Source License
@HibernateSessionThreadLocalConstructor public CardChainTreeTablePopup(Object rootId, boolean modal, boolean wantSaveButton) { super(null);/*from w w w . j ava 2s . co m*/ setWidth("600px"); setHeight("400px"); addStyleName("m-noborder"); // V7 difference super.initGui(); selectedId = tempSelectedId = rootId; setModal(modal); setListener(this); setResizable(true); setTitleString("Card chain"); saveClicked = false; contentVLayout.setSpacing(true); treeT = new CardChainTree(rootId, false, !modal); if (rootId == null) { setTitleString("Card chains"); // instead, do some creative backgrounding to pseudo select children of a card, treeT.setMultiSelect(true); } //treeT.setSizeFull(); treeT.setWidth("99%"); treeT.setHeight("99%"); treeT.addItemClickListener((ItemClickListener) this); treeT.addStyleName("m-greyborder"); contentVLayout.addComponent(treeT); contentVLayout.setComponentAlignment(treeT, Alignment.MIDDLE_CENTER); contentVLayout.setExpandRatio(treeT, 1.0f); /* todo...the saved data was never being retrieved, should pass it back to create action plan panel */ if (wantSaveButton) { // need a save button HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); contentVLayout.addComponent(hl); Label lab; hl.addComponent(lab = new Label()); hl.setExpandRatio(lab, 1.0f); NativeButton saveButt = new NativeButton(); hl.addComponent(saveButt); saveButt.setIcon(Mmowgli2UI.getGlobals().getMediaLocator().getSaveButtonIcon()); saveButt.setWidth("45px"); //38px"); saveButt.setHeight("16px"); saveButt.addStyleName("borderless"); saveButt.addClickListener(saveListener = new SaveListener()); saveButt.setClickShortcut(KeyCode.ENTER); hl.addComponent(lab = new Label()); lab.setWidth("30px"); contentVLayout.addComponent(hl); } }
From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboard.java
License:Open Source License
public void initGuiTL() { setWidth(APPLICATION_SCREEN_WIDTH);/* w ww . j a va2 s .com*/ setHeight(IDEADASHBOARD_H); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); addComponent(medLoc.getIdeaDashboardTitle(), "top:15px;left:20px"); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH); mainAbsLay.setHeight(IDEADASHBOARD_H); addComponent(mainAbsLay, IDEADASHBOARD_OFFSET_POS); Embedded backgroundImage = new Embedded(null, medLoc.getIdeaDashboardBackground()); backgroundImage.setWidth(IDEADASHBOARD_BGND_W); backgroundImage.setHeight(IDEADASHBOARD_BGND_H); mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px"); // stack the pages addComponent(recentTab, IDEADASHBOARD_TABCONTENT_POS); recentTab.initGui(); addComponent(innovateTab, IDEADASHBOARD_TABCONTENT_POS); innovateTab.initGui(); innovateTab.setVisible(false); addComponent(defendTab, IDEADASHBOARD_TABCONTENT_POS); defendTab.initGui(); defendTab.setVisible(false); addComponent(superActiveTab, IDEADASHBOARD_TABCONTENT_POS); superActiveTab.initGui(); superActiveTab.setVisible(false); // add the tab butts TabClickHandler tabHndlr = new TabClickHandler(); HorizontalLayout tabHL = new HorizontalLayout(); tabHL.setSpacing(false); String gameTitleLC = Game.getTL().getTitle().toLowerCase(); makeBlackLabelOverlays(gameTitleLC); // put the card type names styleBlackTabs(gameTitleLC, tabHL); addComponent(tabHL, "top:60px;left:7px"); Label sp; tabHL.addComponent(sp = new Label()); sp.setWidth("9px"); recentButt.setStyleName("m-ideaDashboardMostRecentTab"); recentButt.addStyleName("m-ideaDashboardTab1"); // marker for testing recentButt.addClickListener(tabHndlr); tabHL.addComponent(recentButt); styleWhiteInnovateTab(gameTitleLC, tabHL, tabHndlr, CardType.getCurrentPositiveIdeaCardTypeTL()); styleWhiteDefendTab(gameTitleLC, tabHL, tabHndlr, CardType.getCurrentNegativeIdeaCardTypeTL()); superActiveButt.setStyleName("m-ideaDashboardSuperActiveTab"); superActiveButt.addStyleName("m-ideaDashboardTab4"); // marker for testing superActiveButt.addClickListener(tabHndlr); tabHL.addComponent(superActiveButt); superActiveButt.addStyleName("m-transparent-background"); // invisible }
From source file:edu.nps.moves.mmowgli.modules.cards.IdeaDashboard.java
License:Open Source License
private void makeBlackLabelOverlays(String gameTitleLC) { if (gameTitleLC.contains("energy") || gameTitleLC.contains("innovate")) return;/*from ww w.ja v a 2 s . c o m*/ AbsoluteLayout absL = new AbsoluteLayout(); absL.addStyleName("m-ideaDashboardTabStrip"); absL.setHeight("60px"); absL.setWidth("778px"); String posText = CardType.getCurrentPositiveIdeaCardTypeTL().getTitle(); String negText = CardType.getCurrentNegativeIdeaCardTypeTL().getTitle(); Label lab; absL.addComponent(lab = new Label(posText), "top:0px;left:210px;"); lab.setWidth("162px"); lab.setHeight("60px"); lab.addStyleName("m-ideaDashboardPositiveBlackTab"); absL.addComponent(lab = new Label(negText), "top:0px;left:370px;"); lab.setWidth("182px"); lab.setHeight("60px"); lab.addStyleName("m-ideaDashboardNegativeBlackTab"); addComponent(absL, "top:60px;left:7px"); }
From source file:edu.nps.moves.mmowgli.modules.cards.PlayAnIdeaPage2.java
License:Open Source License
@Override public void initGui() { setSpacing(true);//from w w w . ja va 2 s.co m Label lab = new Label(); lab.setWidth(CALLTOACTION_HOR_OFFSET_STR); addComponent(lab); MovePhase phase = MovePhase.getCurrentMovePhaseTL(); String playTitle = phase.getPlayACardTitle(); if (playTitle != null && playTitle.length() > 0) { addComponent(lab = new Label(playTitle)); setComponentAlignment(lab, Alignment.TOP_CENTER); lab.addStyleName("m-calltoaction-playprompt"); } AbsoluteLayout mainAbsL = new AbsoluteLayout(); mainAbsL.setWidth(PAIP_WIDTH); mainAbsL.setHeight("675px"); addComponent(mainAbsL); // do this at the bottom so z order is top: mainAbsL.addComponent(topHL = new HorizontalLayout(),"top:0px;left:0px"); topHL = new HorizontalLayout(); topHL.addComponent(leftAbsL = new AbsoluteLayout()); topHL.addComponent(rightAbsL = new AbsoluteLayout()); leftAbsL.setWidth(PAIP_HALFWIDTH); rightAbsL.setWidth(PAIP_HALFWIDTH); leftAbsL.setHeight(PAIP_TOP_HEIGHT); rightAbsL.setHeight(PAIP_TOP_HEIGHT); GameLinks gl = GameLinks.getTL(); final String howToPlayLink = gl.getHowToPlayLink(); if (howToPlayLink != null && howToPlayLink.length() > 0) { howToPlayButt = new NativeButton(null); BrowserWindowOpener bwo = new BrowserWindowOpener(howToPlayLink); bwo.setWindowName(MmowgliConstants.PORTALTARGETWINDOWNAME); bwo.extend(howToPlayButt); } else if (mockupOnly) howToPlayButt = new NativeButton(null); else howToPlayButt = new IDNativeButton(null, HOWTOPLAYCLICK); leftAbsL.addComponent(howToPlayButt, HOWTO_POS); leftType = CardType.getCurrentPositiveIdeaCardTypeTL(); leftAbsL.addComponent(poshdr = CardSummaryListHeader.newCardSummaryListHeader(leftType, mockupOnly, null), POS_POS); poshdr.initGui(); poshdr.addNewCardListener(newCardListener); if (mockupOnly) gotoDashboardButt = new NativeButton(null); else gotoDashboardButt = new IDNativeButton(null, IDEADASHBOARDCLICK); rightAbsL.addComponent(gotoDashboardButt, GOTO_POS); rightType = CardType.getCurrentNegativeIdeaCardTypeTL(); rightAbsL.addComponent(neghdr = CardSummaryListHeader.newCardSummaryListHeader(rightType, mockupOnly, null), NEG_POS); neghdr.initGui(); neghdr.addNewCardListener(newCardListener); howToPlayButt.setStyleName("m-howToPlayButton"); gotoDashboardButt.setStyleName("m-gotoIdeaDashboardButton"); // end of top gui VerticalLayout bottomVLay = new VerticalLayout(); mainAbsL.addComponent(bottomVLay, "top:200px;left:0px"); mainAbsL.addComponent(topHL, "top:0px;left:0px"); // doing this at the bottom so z order is top: HorizontalLayout hLay = buildLabelPopupRow(leftType.getTitle(), topNewCardLabel = new Label("new card played")); bottomVLay.addComponent(hLay); bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT); User me = Mmowgli2UI.getGlobals().getUserTL(); topholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly, "top"); bottomVLay.addComponent(topholder); ; topholder.initGui(); bottomVLay.addComponent(lab = new Label()); lab.setHeight("10px"); hLay = buildLabelPopupRow(rightType.getTitle(), bottomNewCardLabel = new Label("new card played")); bottomVLay.addComponent(hLay); bottomVLay.setComponentAlignment(hLay, Alignment.MIDDLE_LEFT); bottomholder = new HorizontalCardDisplay(new Dimension(CARDWIDTH, CARDHEIGHT), NUMCARDS, me, mockupOnly, "bottom"); bottomVLay.addComponent(bottomholder); bottomholder.initGui(); MCacheManager cMgr = AppMaster.instance().getMcache(); if (mockupOnly) { addCardsTL(topholder, cMgr.getPositiveIdeaCardsCurrentMove()); addCardsTL(bottomholder, cMgr.getNegativeIdeaCardsCurrentMove()); } else { Game g = Game.getTL(); if (g.isShowPriorMovesCards() || me.isAdministrator()) { addCardsTL(topholder, cMgr.getAllPositiveIdeaCards()); addCardsTL(bottomholder, cMgr.getAllNegativeIdeaCards()); } else if (!g.isShowPriorMovesCards()) { addCardsTL(topholder, cMgr.getPositiveUnhiddenIdeaCardsCurrentMove()); addCardsTL(bottomholder, cMgr.getNegativeUnhiddenIdeaCardsCurrentMove()); } } }
From source file:edu.nps.moves.mmowgli.modules.cards.PlayAnIdeaPage2.java
License:Open Source License
private HorizontalLayout buildLabelPopupRow(String text, Label popup) { HorizontalLayout hLay = new HorizontalLayout(); hLay.setHeight("25px"); hLay.setWidth("980px"); Label lab; hLay.addComponent(lab = new Label()); lab.setWidth("25px"); hLay.addComponent(lab = new HtmlLabel(text + " ")); // to keep italics from clipping lab.setSizeUndefined();/*from w w w. ja v a2 s .co m*/ lab.addStyleName("m-playanidea-heading-text"); hLay.setExpandRatio(lab, 0.5f); popup.addStyleName("m-newcardpopup"); hLay.addComponent(popup); hLay.setExpandRatio(popup, 0.5f); popup.setImmediate(true); Animator.animate(popup, new Css().opacity(0.0d)); hLay.addComponent(lab = new Label()); lab.setWidth("20px"); return hLay; }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.AddAuthorEventHandler.java
License:Open Source License
@SuppressWarnings("serial") public static void inviteAuthorsToActionPlan() { final Window win = new Window("Choose Action Plan"); win.setWidth("600px"); win.setHeight("500px"); VerticalLayout layout = new VerticalLayout(); win.setContent(layout);//from w ww .j av a2s .c om layout.setMargin(true); layout.setSpacing(true); layout.setSizeFull(); final ActionPlanTable apt = new ActionPlanTable() { @Override public ItemClickListener getItemClickListener() { return new ItemClickListener() { public void itemClick(ItemClickEvent event) { } }; // null listener } }; apt.setMultiSelect(false); apt.setPageLength(10); apt.setSizeFull(); layout.addComponent(apt); layout.setExpandRatio(apt, 1.0f); HorizontalLayout buttHL = new HorizontalLayout(); layout.addComponent(buttHL); buttHL.setWidth("100%"); buttHL.setSpacing(true); Label sp; buttHL.addComponent(sp = new Label()); sp.setWidth("1px"); buttHL.setExpandRatio(sp, 1.0f); Button selectButton = new Button("Select"); buttHL.addComponent(selectButton); Button cancelButton = new Button("Cancel"); buttHL.addComponent(cancelButton); UI.getCurrent().addWindow(win); win.center(); selectButton.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { win.close(); Object o = apt.getValue(); if (o != null) { HSess.init(); inviteAuthorsToActionPlanTL(o); HSess.close(); } } }); cancelButton.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { win.close(); } }); }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.EventMonitorPanel.java
License:Open Source License
private void buildTopInfo(VerticalLayout vertL) { captionLabel = new HtmlLabel("dummy"); vertL.addComponent(captionLabel);/* ww w. j a va2 s .c o m*/ HorizontalLayout bottomHL = new HorizontalLayout(); bottomHL.setMargin(false); bottomHL.setWidth("100%"); vertL.addComponent(bottomHL); statsLabel = new HtmlLabel("dummy"); statsLabel.setSizeUndefined(); bottomHL.addComponent(statsLabel); Label lab; bottomHL.addComponent(lab = new Label()); lab.setWidth("1px"); bottomHL.setExpandRatio(lab, 1.0f); newEventLabel = new HtmlLabel("new event "); // safari cuts off tail newEventLabel.setSizeUndefined(); newEventLabel.addStyleName("m-newcardpopup"); newEventLabel.setImmediate(true); bottomHL.addComponent(newEventLabel); Animator.animate(newEventLabel, new Css().opacity(0.0d)); // hide it }
From source file:edu.nps.moves.mmowgli.modules.gamemaster.UserAdminPanel.java
License:Open Source License
public void initGuiTL() { setWidth(APPLICATION_SCREEN_WIDTH);/*from w w w.j av a 2s . c o m*/ setHeight("100%"); setSpacing(false); HorizontalLayout titleHL = new HorizontalLayout(); addComponent(titleHL); Label lab; titleHL.addComponent(lab = new Label()); lab.setWidth("20px"); VerticalLayout tableVLayout = new VerticalLayout(); tableContainer = tableVLayout; tableVLayout.setWidth(APPLICATION_SCREEN_WIDTH); tableVLayout.setHeight("900px"); tableVLayout.setSpacing(true); tableVLayout.addStyleName("m-whitepage-header"); addComponent(tableVLayout); tableVLayout.addComponent(lab = new Label()); lab.setHeight("20px"); tableVLayout.addComponent( lab = new HtmlLabel("<span style='margin-left:40px;color:red;'>" + WARNING_LABEL + "</span>")); lab.addStyleName("m-text-align-center"); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberUsersLabelTL() + "</span>")); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberOnlineLabel() + "</span>")); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberGameMastersTL() + "</span>")); tableVLayout.addComponent( new HtmlLabel("<span style='margin-left:40px;'>" + getNumberCardsLabelTL() + "</span>")); tableVLayout .addComponent(new HtmlLabel("<span style='margin-left:40px;'>Double click a row to edit</span>")); tableVLayout.addComponent(lab = new HtmlLabel( "<center><b><span style='font-size:175%'>Player Administration</span></b></center>")); HorizontalLayout srchHL = buildSearchRow(); tableVLayout.addComponent(srchHL); tableVLayout.setComponentAlignment(srchHL, Alignment.MIDDLE_CENTER); table = createTable(lastTableFiller = new SimpleTableFiller()); table.setCaption(null); addTableToLayout(Mmowgli2UI.getGlobals().getUserID()); }
From source file:edu.nps.moves.mmowgli.modules.maps.LeafletMap.java
License:Open Source License
public void initGuiTL() { setSpacing(true);// www . jav a 2 s . co m setSizeUndefined(); setWidth("950px"); addStyleName("m-marginleft-20"); Label lab; HorizontalLayout hLay = new HorizontalLayout(); hLay.setMargin(false); hLay.setSpacing(false); hLay.setWidth("100%"); NativeButton butt; hLay.addComponent(butt = new NativeButton("go to default game location", new MyDefaultLocationListener())); hLay.setExpandRatio(butt, 0.5f); hLay.setComponentAlignment(butt, Alignment.BOTTOM_LEFT); hLay.addComponent(lab = new HtmlLabel(title)); lab.setWidth(null); makeLayerPopups(); HorizontalLayout popLay = new HorizontalLayout(); popLay.setMargin(false); popLay.setSpacing(false); popLay.setWidth("100%"); popLay.addComponent(lab = new Label()); lab.setWidth("1px"); popLay.setExpandRatio(lab, 1.0f); popLay.addComponent(baseLayerPopup); popLay.addComponent(overlayPopup); hLay.addComponent(popLay); hLay.setComponentAlignment(popLay, Alignment.BOTTOM_RIGHT); hLay.setExpandRatio(popLay, 0.5f); addComponent(hLay); User me = Mmowgli2UI.getGlobals().getUserTL(); this.imAGuest = me.isViewOnly() || me.isAccountDisabled(); map.setAttributionPrefix("Powered by Leaflet with v-leaflet"); map.addStyleName("m-greyborder"); map.removeAllComponents(); // map.addControl(new LScale()); layerMap = installAllLayers(map); fillLayerPopupsTL(); // build the widgets setDefaultMapValuesTL(me); // set default zoom, center, layers if (!imAGuest) setUserMapValuesTL(me); // set zoom, center and layers from userID pref. setOptionGroupWidgetsFromLayerMap();// syncs up the widgets to match the active layers Collection<Extension> exts = map.getExtensions(); LLayers llayers = null; for (Extension ex : exts) if (ex instanceof LLayers) { llayers = (LLayers) ex; break; } if (llayers != null) map.removeExtension(llayers); addComponent(map); setExpandRatio(map, 1); map.setHeight("600px"); map.setWidth("100%"); map.addMoveEndListener(new MyMoveEndListener()); }
From source file:edu.nps.moves.mmowgli.modules.maps.OpenLayersMap.java
License:Open Source License
public void initGuiTL() { setSpacing(true);/* w w w . j av a2 s. c o m*/ setSizeUndefined(); setWidth("100%"); addStyleName("m-marginleft-20"); Label lab; addComponent(lab = new HtmlLabel(title)); lab.setWidth(null); setComponentAlignment(lab, Alignment.MIDDLE_CENTER); CssLayout cssLay = new CssLayout(); cssLay.addStyleName("m-greybackground"); cssLay.addStyleName("m-darkgreyborder"); cssLay.setWidth("960px"); cssLay.setHeight("600px"); cssLay.setId("mmowgliMap"); addComponent(cssLay); setComponentAlignment(cssLay, Alignment.TOP_CENTER); /* See http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example This requires the "http://openlayers.org/api/OpenLayers.js" file to be loaded: see the annotation in Mmowgli2UI.java. */ /* One example layer: String js = "var m_map = new OpenLayers.Map('mmowgliMap');"+ "var m_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\","+ "\"http://vmap0.tiles.osgeo.org/wms/vmap0\", {layers: 'basic'} );"+ "m_map.addLayer(m_wms);"+ "m_map.zoomToMaxExtent();"; */ String jsOSM = "mMap = new OpenLayers.Map('mmowgliMap');" + // "shadeLayer = new OpenLayers.Layer.WMS("+ // "\"Shaded Relief\"," + // "\"http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3\","+ // "{layers: HR-NED.IMAGE, reaspect: false, transparent: true, visibility: false}); "+ "var osLay = new OpenLayers.Layer.OSM();" + "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");" + // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");" + // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);" + "var zoom = 15;" + " mMap.addLayer(osLay);" + //" mMap.addLayer(shadeLayer);"+ //" mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ " mMap.setCenter(position, zoom );"; /* String worldWind = "mMap = new OpenLayers.Map('mmowgliMap', {'maxResolution': .28125, tileSize: new OpenLayers.Size(512, 512)});"+ "var osLay = new OpenLayers.Layer.OSM();"+ "var ol_wms = new OpenLayers.Layer.WMS( \"OpenLayers WMS\", \"http://vmap0.tiles.osgeo.org/wms/vmap0?\", {layers: 'basic'} );"+ // "var ww = new OpenLayers.Layer.WorldWind( \"Bathy\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx?\", 36, 4,{T:\"bmng.topo.bathy.200406\"});"+ // "var ww2 = new OpenLayers.Layer.WorldWind( \"LANDSAT\",\"http://worldwind25.arc.nasa.gov/tile/tile.aspx\", 2.25, 4,{T:\"105\"});"+ "mMap.addLayers([osLay]); //,ol_wms]);"+ //, ww, ww2]);"+ // "mMap.addControl(new OpenLayers.Control.LayerSwitcher());"+ "var fromProjection = new OpenLayers.Projection(\"EPSG:4326\");"+ // Transform from WGS 1984 "var toProjection = new OpenLayers.Projection(\"EPSG:900913\");"+ // to Spherical Mercator Projection "var position = new OpenLayers.LonLat(-121.875267, 36.599878).transform( fromProjection, toProjection);"+ "var zoom = 15;"+ //"mMap.setCenter(new OpenLayers.LonLat(-71.4, 42.3), 6);"+ " mMap.setCenter(position, zoom );"+ ""; */ JavaScript.getCurrent().execute(jsOSM); }