List of usage examples for com.vaadin.ui Label setWidth
@Override public void setWidth(String width)
From source file:edu.nps.moves.mmowgli.modules.administration.AbstractGameBuilderPanel.java
License:Open Source License
@Override public void initGui() { String title = getTitle();//from ww w .j a va 2 s . c o m if (title != null) { Label titleLab; addComponent(titleLab = new Label(title)); titleLab.addStyleName("m-centeralign"); } Embedded e = this.getImage(); if (e != null) { e.setWidth("800px"); // "930px"); e.setHeight("400px"); // "465px"); e.addStyleName("m-greyborder3"); addComponent(e); setComponentAlignment(e, Alignment.MIDDLE_CENTER); } if (lines.size() > 0) { grid.setColumns(3); String heading = getHeading(); Component footer = getFooter(); int nRows = lines.size() + (heading != null ? 1 : 0) + (footer != null ? 1 : 0); grid.setRows(nRows); int rowOffst = 0; if (heading != null) { grid.addComponent(makeLabel(heading), 0, 0, 2, 0); rowOffst = 1; } for (int r = 0; r < lines.size(); r++) { EditLine edLine = lines.get(r); if (edLine.ta != null) edLine.ta.setDescription(edLine.tooltip); if (edLine.isSeparator()) { addSeparator(grid, r + rowOffst); continue; } if (edLine.justComponent()) { addLineComponent(grid, r + rowOffst, edLine.ta); continue; } Label textLab = new HtmlLabel(edLine.name); textLab.setDescription(edLine.tooltip); textLab.addStyleName("m-font-bold14"); textLab.setWidth(getColumn1WidthString()); grid.addComponent(textLab, 0, r + rowOffst); // c0,r0,c1,r1 Label fieldLab = new Label(edLine.info); fieldLab.setDescription(edLine.tooltip); fieldLab.addStyleName("m-italic"); fieldLab.setWidth(getColumn2WidthString()); grid.addComponent(fieldLab, 1, r + rowOffst); if (edLine.ta instanceof TextArea) { TextArea ta = (TextArea) edLine.ta; ta.setDescription(edLine.tooltip); ta.setImmediate(true); ta.setWidth("100%"); if (edLine.fieldName != null && autoSave) ta.addValueChangeListener(new IndivListener(edLine, updatesOK, edLine.fieldClass == null ? String.class : edLine.fieldClass)); grid.addComponent(ta, 2, r + rowOffst); } else if (edLine.ta instanceof CheckBox) { CheckBox cb = (CheckBox) edLine.ta; cb.setDescription(edLine.tooltip); cb.setImmediate(true); if (edLine.fieldName != null && autoSave) cb.addValueChangeListener(new IndivListener(edLine, updatesOK, boolean.class)); grid.addComponent(cb, 2, r + rowOffst); } else if (edLine.ta instanceof Component) { grid.addComponent(edLine.ta, 2, r + rowOffst); } } if (footer != null) { int frow = lines.size() + rowOffst; grid.addComponent(footer, 0, frow, 2, frow); } grid.setWidth("99%"); grid.setHeight("100%"); addComponent(grid); grid.setColumnExpandRatio(2, 1.0f); if (showTestButton) { Button testButt = new Button(getTextButtonText(), new ClickListener() { private static final long serialVersionUID = 1L; @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); testButtonClickedTL(event); HSess.close(); } }); addComponent(testButt); setComponentAlignment(testButt, Alignment.MIDDLE_CENTER); } } }
From source file:edu.nps.moves.mmowgli.modules.administration.CardColorChooserComponent.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor/*from w ww . j ava2 s . com*/ CardColorChooserComponent(CardType ct) { this.ct = ct; setSpacing(true); setMargin(false); setSizeUndefined(); // temp if (ct == null) this.ct = CardType.getCurrentPositiveIdeaCardTypeTL(); addComponent(colorCombo = new ColorSelect()); colorCombo.addValueChangeListener(new MyColorComboListener()); Label lab; addComponent(lab = new Label()); lab.setWidth("10px"); openSamplesButt = new NativeButton("view color samples"); addComponent(openSamplesButt); setComponentAlignment(openSamplesButt, Alignment.MIDDLE_CENTER); openSamplesButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { ColorSampler.show(openSamplesButt); } }); }
From source file:edu.nps.moves.mmowgli.modules.administration.GameDesignPanel.java
License:Open Source License
public void initGuiTL() { tabSh.setHeight("100%"); tabSh.setWidth("930px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true);//from www . j a va 2s. c om topHL.setMargin(true); Label lab; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new Label("Round being edited:")); lab.setSizeUndefined(); topHL.addComponent(moveSelector = new MoveSelector(null)); moveSelector.addValueChangeListener(new MoveSelectorListener()); topHL.addComponent( runningMoveWarningLabel = new HtmlLabel("<font color='red'><i>Active game round!</i></font>")); runningMoveWarningLabel.setSizeUndefined(); runningMoveWarningLabel.setVisible(AbstractGameBuilderPanel.isRunningMoveTL(moveBeingEdited)); topHL.addComponent(newMoveButt = new NativeButton("Add new round to game", new NewMoveListener())); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.setWidth("100%"); addComponent(topHL); addComponent(lab = new Label("The currently active round is set through the Game Administrator menu")); lab.setSizeUndefined(); setComponentAlignment(lab, Alignment.TOP_CENTER); tabSh.addTab(titlesPan, "Game Titles"); tabSh.addTab(topCardsPan, "Top Card Types"); tabSh.addTab(subCardsPan, "Sub Card Types"); //tabSh.addTab(seedCardsPan, "Seed Card Initialization"); tabSh.addTab(chaptersPan, "Action Plan Headings"); addComponent(tabSh); titlesPan.initGui(); topCardsPan.initGui(); subCardsPan.initGui(); //seedCardsPan.initGui(); chaptersPan.initGui(); moveSelector.setMove(Game.getTL().getCurrentMove()); }
From source file:edu.nps.moves.mmowgli.modules.administration.GameDesignPanel.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor//from w ww . j a v a2 s . c om public PhasesEditPanel(Move move, GameDesignGlobals globs) { this.moveBeingEdited = move; setWidth("100%"); setSpacing(true); phaseBeingEdited = moveBeingEdited.getCurrentMovePhase(); tabSh = new TabSheet(); tabPanels.add(titlePan = new PhaseTitlesGameDesignPanel(phaseBeingEdited, auxListener, globs)); tabPanels.add(signupPan = new SignupHTMLGameDesignPanel(phaseBeingEdited, auxListener, globs)); tabPanels.add(loginPan = new LoginSignupGameDesignPanel(phaseBeingEdited, auxListener, globs)); tabPanels.add(welcomePan = new WelcomeScreenGameDesignPanel(phaseBeingEdited, auxListener, globs)); tabPanels.add(call2ActionPan = new CallToActionGameDesignPanel(phaseBeingEdited, auxListener, globs)); Label lab; addComponent(lab = new Label()); lab.setHeight("5px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(topLevelLabel = new Label()); setTopLabelText(moveBeingEdited); topLevelLabel.setSizeUndefined(); topHL.addComponent(phaseSelector = new PhaseSelector(null, Move.getCurrentMoveTL())); phaseSelector.addValueChangeListener(new PhaseComboListener()); topHL.addComponent( runningPhaseWarningLabel = new HtmlLabel("<font color='red'><i>Active game phase!</i></font>")); runningPhaseWarningLabel.setSizeUndefined(); runningPhaseWarningLabel.setVisible(AbstractGameBuilderPanel.isRunningPhaseTL(phaseBeingEdited)); topHL.addComponent(newPhaseButt = new NativeButton("Add new phase to round")); newPhaseButt.setEnabled(false); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.setWidth("100%"); addComponent(topHL); propagateCB = new CheckBox("Propagate new phase-dependent edits to all other phases in this round"); addComponent(propagateCB); setComponentAlignment(propagateCB, Alignment.MIDDLE_CENTER); propagateCB.setVisible(phaseBeingEdited.isPreparePhase()); addComponent(lab = new HtmlLabel( "<b>The currently running phase is set through the Game Administrator menu</b>")); lab.setSizeUndefined(); setComponentAlignment(lab, Alignment.TOP_CENTER); newPhaseButt.addClickListener(new ClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void buttonClick(ClickEvent event) { HSess.init(); NewMovePhaseDialog dial = new NewMovePhaseDialog(moveBeingEdited); dial.addCloseListener(new CloseListener() { @Override public void windowClose(CloseEvent e) { Object key = HSess.checkInit(); phaseSelector.fillCombo(moveBeingEdited); HSess.checkClose(key); } }); dial.showDialog(); HSess.close(); } }); }
From source file:edu.nps.moves.mmowgli.modules.administration.NewMovePhaseDialog.java
License:Open Source License
@SuppressWarnings("serial") public NewMovePhaseDialog(Move move) { super("Make a new Phase for " + move.getName()); this.moveBeingEdited = Move.getTL(move.getId()); setSizeUndefined();/*from w w w . j a v a 2s . co m*/ setWidth("390px"); VerticalLayout vLay; setContent(vLay = new VerticalLayout()); vLay.setSpacing(true); vLay.setMargin(true); vLay.addComponent(new Label("Choose a descriptive name for this phase. Suggested names are shown in the " + "drop down list, but any text is permitted.")); descriptionCB = new ComboBox("Phase description"); vLay.addComponent(descriptionCB); fillCombo(descriptionCB); descriptionCB.setInputPrompt("Choose suggested description, or enter text"); descriptionCB.setWidth("350px"); descriptionCB.setImmediate(true); descriptionCB.setNullSelectionAllowed(false); descriptionCB.setTextInputAllowed(true); descriptionCB.addValueChangeListener(new ValueChangeListener() { @Override public void valueChange(final ValueChangeEvent event) { // final String valueString = String.valueOf(event.getProperty().getValue()); // Notification.show("Value changed:", valueString, // Type.TRAY_NOTIFICATION); } }); vLay.addComponent(existingPhasesGLay = new GridLayout()); existingPhasesGLay.setColumns(3); existingPhasesGLay.setRows(1); // to start existingPhasesGLay.setSpacing(true); existingPhasesGLay.addStyleName("m-greyborder"); existingPhasesGLay.setCaption("Existing Phases"); fillExistingPhases(); HorizontalLayout buttHLay; vLay.addComponent(buttHLay = new HorizontalLayout()); buttHLay.setWidth("100%"); buttHLay.setSpacing(true); Label lab; buttHLay.addComponent(lab = new Label()); lab.setWidth("1px"); buttHLay.setExpandRatio(lab, 1.0f); buttHLay.addComponent(cancelButt = new Button("Cancel", saveCancelListener)); buttHLay.addComponent(saveButt = new Button("Save", saveCancelListener)); }
From source file:edu.nps.moves.mmowgli.modules.administration.ScoringGameDesignPanel.java
License:Open Source License
@Override protected Component getFooter() { HorizontalLayout hlay = new HorizontalLayout(); Label sp; hlay.addComponent(sp = new Label()); sp.setWidth("1px"); hlay.setExpandRatio(sp, 0.5f);/* w w w.j a va2 s .co m*/ Button butt = new Button("Click for scoring help and examples", new HelpListener()); hlay.addComponent(butt); hlay.addComponent(sp = new Label()); sp.setWidth("1px"); hlay.setExpandRatio(sp, 0.5f); hlay.setWidth("100%"); return hlay; }
From source file:edu.nps.moves.mmowgli.modules.administration.SubCardsGameDesignPanel.java
License:Open Source License
private Component renderFields(CardTypeFields fields, NativeSelect combo, String name) { VerticalLayout topPan = new VerticalLayout(); topPan.setWidth("98%"); topPan.addStyleName("m-greyborder3"); Label lab; topPan.addComponent(lab = new Label()); lab.setHeight("18px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true);//from w w w. ja va 2s . c o m ; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>")); lab.setSizeUndefined(); topHL.addComponent(combo); Button newTypeButt; topHL.addComponent(newTypeButt = new NativeButton("Define new type")); newTypeButt.addStyleName(Runo.BUTTON_SMALL); newTypeButt.setReadOnly(globs.readOnlyCheck(false)); newTypeButt.setEnabled(!newTypeButt.isReadOnly()); if (!newTypeButt.isReadOnly()) newTypeButt.addClickListener(new NewTypeListener(fields.typeOrdinal)); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topPan.addComponent(topHL); topHL.setWidth("100%"); topPan.addComponent(fields); fields.setWidth("100%"); return topPan; }
From source file:edu.nps.moves.mmowgli.modules.administration.TopCardsGameDesignPanel.java
License:Open Source License
private Component renderFields(CardTypeFields fields, NativeSelect combo, String name, Label editWarningLab) { VerticalLayout topPan = new VerticalLayout(); topPan.setWidth("98%"); topPan.addStyleName("m-greyborder3"); Label lab; topPan.addComponent(lab = new Label()); lab.setHeight("18px"); HorizontalLayout topHL = new HorizontalLayout(); topHL.setSpacing(true);/*www.j av a 2 s .co m*/ ; topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topHL.addComponent(lab = new HtmlLabel("<b>" + name + "</b>")); lab.setSizeUndefined(); topHL.addComponent(combo); Button newTypeButt; topHL.addComponent(newTypeButt = new NativeButton("Define new top-level type")); newTypeButt.addStyleName(Runo.BUTTON_SMALL); newTypeButt.setReadOnly(globals.readOnlyCheck(false)); newTypeButt.setEnabled(!newTypeButt.isReadOnly()); if (!newTypeButt.isReadOnly()) newTypeButt.addClickListener(new NewCardClassListener(fields.cardClass)); topHL.addComponent(lab = new Label()); lab.setWidth("1px"); topHL.setExpandRatio(lab, 0.5f); topPan.addComponent(topHL); topHL.setWidth("100%"); addComponent(editWarningLab); topPan.addComponent(fields); fields.setWidth("100%"); return topPan; }
From source file:edu.nps.moves.mmowgli.modules.cards.CallToActionPage.java
License:Open Source License
public void initGui() { Object sessKey = HSess.checkInit(); Label spacer = new Label(); spacer.setWidth(CALLTOACTION_HOR_OFFSET_STR); addComponent(spacer);/*from w ww.j av a 2 s .co m*/ VerticalLayout mainVl = new VerticalLayout(); addComponent(mainVl); mainVl.setSpacing(true); mainVl.setWidth("100%"); MovePhase phase = MovePhase.getCurrentMovePhaseTL(); String sum = phase.getCallToActionBriefingSummary(); String tx = phase.getCallToActionBriefingText(); Media v = phase.getCallToActionBriefingVideo(); Embedded headerImg = new Embedded(null, Mmowgli2UI.getGlobals().mediaLocator().getCallToActionBang()); headerImg.setDescription("Review motivation and purpose of this game"); NativeButton needButt = new NativeButton(); needButt.setStyleName("m-weNeedYourHelpButton"); vidPan = new VideoWithRightTextPanel(v, headerImg, sum, tx, needButt); // needImg); vidPan.initGui(); mainVl.addComponent(vidPan); String playCardString = Game.getTL().getCurrentMove().getCurrentMovePhase().getPlayACardTitle(); NativeButton butt; if (!mockupOnly) butt = new IDNativeButton(playCardString, MmowgliEvent.PLAYIDEACLICK); else butt = new NativeButton(playCardString); // no listener butt.addStyleName("borderless"); butt.addStyleName("m-calltoaction-playprompt"); butt.setDescription("View existing cards and play new ones"); mainVl.addComponent(butt); mainVl.setComponentAlignment(butt, Alignment.MIDDLE_CENTER); HSess.checkClose(sessKey); }
From source file:edu.nps.moves.mmowgli.modules.cards.CardChainPage.java
License:Open Source License
@HibernateRead private GhostVerticalLayoutWrapper makeCardMarkingPanelTL() { GhostVerticalLayoutWrapper wrapper = new GhostVerticalLayoutWrapper(); VerticalLayout vl = new VerticalLayout(); vl.setSpacing(true);/*from w w w . j a v a2 s .com*/ wrapper.ghost_setContent(vl); Label lab = new HtmlLabel("<b><i>Game Master Actions</i></b>"); vl.addComponent(lab); vl.setComponentAlignment(lab, Alignment.MIDDLE_CENTER); NativeButton editCardButt = new NativeButton("Edit Card"); editCardButt.addStyleName(BaseTheme.BUTTON_LINK); editCardButt.addClickListener(new EditCardTextListener()); vl.addComponent(editCardButt); markingRadioGroup = new OptionGroup(null); markingRadioGroup.setMultiSelect(false); markingRadioGroup.setImmediate(true); markingRadioGroup.setDescription("Only game masters may change."); vl.addComponent(markingRadioGroup); NativeButton clearButt = new NativeButton("clear card marking"); clearButt.addStyleName(BaseTheme.BUTTON_LINK); vl.addComponent(clearButt); clearButt.addClickListener(new MarkingClearListener()); Collection<?> markings = CardMarking.getContainer().getItemIds(); CardMarking hiddencm = null; for (Object o : markings) { CardMarking cm = CardMarking.getTL(o); if (cm == CardMarkingManager.getHiddenMarking()) hiddencm = cm; else if (cm == CardMarkingManager.getNoChildrenMarking()) ; // todo enable with game switch else markingRadioGroup.addItem(cm); } if (hiddencm != null) markingRadioGroup.addItem(hiddencm); Card card = Card.getTL(cardId); // feb refactor DBGet.getCardTL(cardId); vl.addComponent(lab = new Label()); lab.setHeight("5px"); NativeButton newActionPlanButt = new IDNativeButton("create action plan from this card", CARDCREATEACTIONPLANCLICK, cardId); newActionPlanButt.addStyleName(BaseTheme.BUTTON_LINK); vl.addComponent(newActionPlanButt); if (Mmowgli2UI.getGlobals().getUserTL().isTweeter()) { String tweet = TWEETBUTTONEMBEDDED_0 + buildTweet(card) + TWEETBUTTONEMBEDDED_1; Label tweeter = new HtmlLabel(tweet); tweeter.setHeight(TWEETBUTTON_HEIGHT); tweeter.setWidth(TWEETBUTTON_WIDTH); vl.addComponent(tweeter); } return wrapper; }