List of usage examples for com.vaadin.ui AbsoluteLayout AbsoluteLayout
public AbsoluteLayout()
From source file:de.uni_leipzig.informatik.pcai042.boa.gui.goldstandard.GoldstandardGUI.java
License:Open Source License
@SuppressWarnings("deprecation") @AutoGenerated//from w w w .ja v a 2 s .c om private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setCaption("close XML"); mainLayout.setImmediate(false); mainLayout.setWidth("100%"); mainLayout.setHeight("100%"); mainLayout.setMargin(false); // top-level component properties setWidth("100.0%"); setHeight("100.0%"); // buttonNext buttonNext = new Button(); buttonNext.setCaption("next"); buttonNext.setImmediate(true); buttonNext.setWidth("-1px"); buttonNext.setHeight("-1px"); mainLayout.addComponent(buttonNext, "top:0.0px;left:81.0px;"); // buttonDiscard buttonDiscard = new Button(); buttonDiscard.setCaption("discard"); buttonDiscard.setImmediate(true); buttonDiscard.setWidth("-1px"); buttonDiscard.setHeight("-1px"); mainLayout.addComponent(buttonDiscard, "top:0.0px;left:431.0px;"); // buttonAddAnno buttonAddAnno = new Button(); buttonAddAnno.setCaption("add"); buttonAddAnno.setImmediate(true); buttonAddAnno.setWidth("-1px"); buttonAddAnno.setHeight("-1px"); mainLayout.addComponent(buttonAddAnno, "top:180.0px;left:160.0px;"); // buttonDelAnno buttonDelAnno = new Button(); buttonDelAnno.setCaption("delete"); buttonDelAnno.setImmediate(true); buttonDelAnno.setWidth("-1px"); buttonDelAnno.setHeight("-1px"); mainLayout.addComponent(buttonDelAnno, "top:180.0px;left:439.0px;"); // comboBoxTypes comboBoxTypes = new ComboBox(); comboBoxTypes.setImmediate(false); comboBoxTypes.setWidth("210px"); comboBoxTypes.setHeight("-1px"); mainLayout.addComponent(comboBoxTypes, "top:269.0px;left:0.0px;"); // textFieldLabel textFieldLabel = new TextField(); textFieldLabel.setImmediate(false); textFieldLabel.setWidth("210px"); textFieldLabel.setHeight("-1px"); textFieldLabel.setSecret(false); mainLayout.addComponent(textFieldLabel, "top:206.0px;left:0.0px;"); // labelLabel labelLabel = new Label(); labelLabel.setImmediate(false); labelLabel.setWidth("-1px"); labelLabel.setHeight("-1px"); labelLabel.setValue("Label:"); mainLayout.addComponent(labelLabel, "top:182.0px;left:1.0px;"); // labelType labelType = new Label(); labelType.setImmediate(false); labelType.setWidth("-1px"); labelType.setHeight("-1px"); labelType.setValue("Type:"); mainLayout.addComponent(labelType, "top:242.0px;left:0.0px;"); // panelTokens panelTokens = buildPanelTokens(); mainLayout.addComponent(panelTokens, "top:30.0px;left:0.0px;"); // listSelectAnnotations listSelectAnnotations = new ListSelect(); listSelectAnnotations.setImmediate(false); listSelectAnnotations.setWidth("271px"); listSelectAnnotations.setHeight("87px"); mainLayout.addComponent(listSelectAnnotations, "top:206.0px;left:230.0px;"); // labelSentence labelSentence = new Label(); labelSentence.setImmediate(false); labelSentence.setWidth("-1px"); labelSentence.setHeight("-1px"); labelSentence.setValue("Sentence:"); mainLayout.addComponent(labelSentence, "top:2.0px;left:0.0px;"); // labelAnnotations labelAnnotations = new Label(); labelAnnotations.setImmediate(false); labelAnnotations.setWidth("-1px"); labelAnnotations.setHeight("-1px"); labelAnnotations.setValue("Annotations:"); mainLayout.addComponent(labelAnnotations, "top:182.0px;left:230.0px;"); return mainLayout; }
From source file:edu.kit.dama.ui.admin.LoginInformationBar.java
License:Apache License
private void buildMainLayout() { loggedInAsLabel = new Label("Login Username"); loggedInAsLabel.addStyleName("myboldcaption"); loggedInUserLabel = new Label(); activeGroupLabel = new Label("Active Group"); activeGroupLabel.addStyleName("myboldcaption"); groupSelection = new ComboBox(); groupSelection.addValueChangeListener(this); activeRoleLabel = new Label("Current Role"); activeRoleLabel.addStyleName("myboldcaption"); roleLabel = new Label(); Label spacer1 = new Label(""); home = buildMenuItem("home", new ThemeResource("img/70x48/logo_default.png")); profile = buildMenuItem("profile", new ThemeResource("img/70x48/preferences.png")); simon = buildMenuItem("simon", new ThemeResource("img/70x48/simon.png")); settings = buildMenuItem("settings", new ThemeResource("img/70x48/gears_preferences.png")); exit = buildMenuItem("exit", new ThemeResource("img/70x48/exit.png")); final AbsoluteLayout helps = new AbsoluteLayout(); helps.setHeight("48px"); helps.setWidth("100%"); addHelpItem("home", "Return to the main page.", helps); addHelpItem("profile", "Open your profile, e.g. to change your password.", helps); addHelpItem("simon", "Open the <b>SI</b>mple<b>MON</b>itoring Tool, e.g. to check the availability of single services.", helps);//from w w w . j a v a 2s. c o m addHelpItem("settings", "Open the system settings. (Only available for Group Managers and Administrators)", helps); addHelpItem("exit", "Logout.", helps); HorizontalLayout navigation = new HorizontalLayout(home, profile, simon, settings, exit, helps, spacer1); navigation.setExpandRatio(helps, .9f); navigation.setExpandRatio(spacer1, .1f); navigation.setSizeFull(); navigation.addStyleName("mynavigationmargin"); navigation.addLayoutClickListener((LayoutEvents.LayoutClickEvent event) -> { if (home.equals(event.getClickedComponent())) { parent.updateView(VIEW.INFORMATION); } else if (profile.equals(event.getClickedComponent())) { parent.updateView(VIEW.PROFILE); } else if (simon.equals(event.getClickedComponent())) { parent.updateView(VIEW.SIMON); } else if (settings.equals(event.getClickedComponent())) { parent.updateView(VIEW.SETTINGS); } else if (exit.equals(event.getClickedComponent())) { parent.logout(); } }); GridLayout loginInformationLayout = new UIUtils7.GridLayoutBuilder(3, 2) .addComponent(loggedInAsLabel, Alignment.MIDDLE_CENTER, 0, 0, 1, 1) .addComponent(activeGroupLabel, Alignment.MIDDLE_CENTER, 1, 0, 1, 1) .addComponent(activeRoleLabel, Alignment.MIDDLE_CENTER, 2, 0, 1, 1) .addComponent(loggedInUserLabel, Alignment.MIDDLE_CENTER, 0, 1, 1, 1) .addComponent(groupSelection, Alignment.MIDDLE_CENTER, 1, 1, 1, 1) .addComponent(roleLabel, Alignment.MIDDLE_CENTER, 2, 1, 1, 1).getLayout(); loginInformationLayout.setSpacing(true); mainLayout = new UIUtils7.GridLayoutBuilder(5, 2) .addComponent(navigation, Alignment.MIDDLE_LEFT, 0, 0, 3, 2) .addComponent(loginInformationLayout, Alignment.MIDDLE_RIGHT, 3, 0, 2, 2).getLayout(); mainLayout.setColumnExpandRatio(0, 1.0f); mainLayout.setColumnExpandRatio(1, .01f); mainLayout.setColumnExpandRatio(2, .01f); mainLayout.setColumnExpandRatio(3, .01f); mainLayout.setColumnExpandRatio(4, .01f); mainLayout.setSpacing(true); mainLayout.setMargin(new MarginInfo(false, true, false, true)); mainLayout.setSizeFull(); }
From source file:edu.kit.dama.ui.simon.panel.SimonMainPanel.java
License:Apache License
/** * Build the overview tab including the list of all categories and der * overall status./* www .ja va 2 s.c o m*/ * * @param pCategories A list of all categories. * * @return The tab component. */ private Component buildOverviewTab(String[] pCategories) { AbsoluteLayout abLay = new AbsoluteLayout(); UIUtils7.GridLayoutBuilder layoutBuilder = new UIUtils7.GridLayoutBuilder(4, pCategories.length + 1); updateButton = new Button("Update Status"); updateButton.addClickListener(this); Embedded logo = new Embedded(null, new ThemeResource("img/simon.png")); abLay.addComponent(logo, "top:30px;left:30px;"); Label simonSaysLabel = new Label("", ContentMode.HTML); simonSaysLabel.setHeight("150px"); setSimonSaysContent(simonSaysLabel, "Everything is fine."); abLay.addComponent(simonSaysLabel, "top:30px;left:250px;"); int row = 0; for (String category : pCategories) { HorizontalLayout rowLayout = new HorizontalLayout(); Label name = new Label(category); name.setWidth("200px"); name.setHeight("24px"); List<AbstractProbe> probes = probesByCategory.get(category); Collections.sort(probes, new Comparator<AbstractProbe>() { @Override public int compare(AbstractProbe o1, AbstractProbe o2) { return o1.getCurrentStatus().compareTo(o2.getCurrentStatus()); } }); int failed = 0; int unknown = 0; int unavailable = 0; int charactersPerProbe = 100; if (probes.size() > 0) { charactersPerProbe = (int) Math.rint((700.0 / probes.size()) / 8.0); } for (AbstractProbe probe : probes) { Label probeLabel = new Label(StringUtils.abbreviate(probe.getName(), charactersPerProbe)); probeLabel.setHeight("24px"); switch (probe.getCurrentStatus()) { case UNKNOWN: probeLabel.setDescription(probe.getName() + ": UNKNOWN"); probeLabel.addStyleName("probe-unknown"); unknown++; break; case UPDATING: probeLabel.setDescription(probe.getName() + ": UPDATING"); probeLabel.addStyleName("probe-updating"); break; case UNAVAILABLE: probeLabel.setDescription(probe.getName() + ": UNAVAILABLE"); probeLabel.addStyleName("probe-unavailable"); unavailable++; break; case FAILED: probeLabel.setDescription(probe.getName() + ": FAILED"); probeLabel.addStyleName("probe-failed"); failed++; break; default: probeLabel.setDescription(probe.getName() + ": SUCCESS"); probeLabel.addStyleName("probe-success"); } probeLabel.addStyleName("probe"); rowLayout.addComponent(probeLabel); } if (failed != 0) { setSimonSaysContent(simonSaysLabel, "There are errors!"); } else { if (unknown != 0) { setSimonSaysContent(simonSaysLabel, "There are unknown states. Please select 'Update Status'."); } else { if (unavailable != 0) { setSimonSaysContent(simonSaysLabel, "Some probes are unavailable. Please check their configuration."); } } } rowLayout.setWidth("700px"); layoutBuilder.addComponent(name, Alignment.TOP_LEFT, 0, row, 1, 1).addComponent(rowLayout, Alignment.TOP_LEFT, 1, row, 3, 1); row++; } layoutBuilder.addComponent(updateButton, Alignment.BOTTOM_RIGHT, 3, row, 1, 1); GridLayout tabLayout = layoutBuilder.getLayout(); tabLayout.setSpacing(true); tabLayout.setMargin(true); Panel p = new Panel(); p.setContent(tabLayout); p.setWidth("1024px"); p.setHeight("400px"); abLay.addComponent(p, "top:160px;left:30px;"); abLay.setSizeFull(); return abLay; }
From source file:edu.nps.moves.mmowgli.components.CardSummaryListHeader.java
License:Open Source License
@SuppressWarnings("serial") @Override//from w ww . j ava 2 s . c om public void initGui() { addStyleName("m-cursor-pointer"); if (bckgrndResource != null) { Embedded bkgnd = new Embedded(null, bckgrndResource); addComponent(bkgnd, "top:0px;left:0px"); } final MmowgliSessionGlobals globs = Mmowgli2UI.getGlobals(); ct = CardType.getTL(ctId); String textColorStyle = CardStyler.getCardTextColorOverBaseStyle(ct); // nested abslay for the click handler AbsoluteLayout topHalfLay = new AbsoluteLayout(); topHalfLay.setWidth(CARDLISTHEADER_W); topHalfLay.setHeight(HEIGHT_NODRAWER); addComponent(topHalfLay, "top:0px;left:0px"); title.setValue(ct.getTitle()); // .toUpperCase()); title.setHeight(CARDLISTHEADER_TITLE_H); title.setWidth(CARDLISTHEADER_TITLE_W); title.addStyleName("m-cardsummarylist-header-title"); title.addStyleName("m-cursor-pointer"); title.addStyleName("m-vagabond-font"); if (textColorStyle != null) title.addStyleName(textColorStyle); topHalfLay.addComponent(title, CARDLISTHEADER_TITLE_POS); content.setValue(ct.getPrompt()); content.setHeight(CARDLISTHEADER_CONTENT_H); content.setWidth(CARDLISTHEADER_CONTENT_W); content.addStyleName("m-cardsummarylist-header-content"); content.addStyleName("m-cursor-pointer"); if (textColorStyle != null) content.addStyleName(textColorStyle); // cause exception w/ 2 windows? content.setId(CardDebug.getCardCreateClickDebugId(ct)); topHalfLay.addComponent(content, CARDLISTHEADER_CONTENT_POS); boolean cantCreateBecauseHiddenParent = checkNoCreateBecauseHiddenTL(parent); boolean cantCreateBecauseParentMarkedNoChild = false; //todo enable with gameswitch checkNoCreateBecauseParentMarkedNoChild(parent); if (globs.canCreateCard(ct.isIdeaCard())) { markedAsNoCreate = false; if (!cantCreateBecauseHiddenParent && !cantCreateBecauseParentMarkedNoChild) { //Add the text at the bottom Label lab; topHalfLay.addComponent(lab = new Label("click to add new"), "top:130px;left:75px"); lab.addStyleName("m-click-to-add-new"); if (textColorStyle != null) lab.addStyleName(textColorStyle); } } else markedAsNoCreate = true; drawerComponent = new BuilderDrawer(); addComponent(drawerComponent, CARDLISTHEADER_DRAWER_POS); drawerComponent.setVisible(false); setWidth(CARDLISTHEADER_W); setHeight(HEIGHT_NODRAWER); if (!mockupOnly) topHalfLay.addLayoutClickListener(new LayoutClickListener() { @Override @MmowgliCodeEntry @HibernateOpened @HibernateClosed public void layoutClick(LayoutClickEvent event) { HSess.init(); if (checkNoCreateBecauseHiddenTL(parent)) { //todo enable with game switch || checkNoCreateBecauseParentMarkedNoChild(parent)) { if (drawerComponent.isVisible()) closeDrawer(); HSess.close(); return; } if (drawerComponent.isVisible()) closeDrawer(); else { CardPermission cp = globs.cardPermissionsCommon(ct.isIdeaCard()); if (!cp.canCreate) { if (!markedAsNoCreate) handleNoCreate(); Notification.show(cp.whyNot); } else { showDrawer(); handleCanCreate(); // reset tt, etc. if (newCardListener != null) newCardListener.drawerOpenedTL(ctId); } } HSess.close(); } }); if (cantCreateBecauseHiddenParent) handleNoCreate("Can't add card to hidden parent"); else if (cantCreateBecauseParentMarkedNoChild) handleNoCreate("New child cards cannot be added to this card"); else if (!globs.canCreateCard(ct.isIdeaCard())) handleNoCreate(); else setTooltip("Click to add card"); }
From source file:edu.nps.moves.mmowgli.components.Footer.java
License:Open Source License
@Override public void initGui() { setWidth(FOOTER_W);//www. j av a 2 s . co m setHeight("130px"); //room for fouo butt//FOOTER_H); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(FOOTER_W); mainAbsLay.setHeight(FOOTER_H); addComponent(mainAbsLay, FOOTER_OFFSET_POS); MediaLocator medLoc = ((Mmowgli2UI) UI.getCurrent()).getMediaLocator(); Embedded back = new Embedded(null, medLoc.getFooterBackground()); mainAbsLay.addComponent(back, "top:0px;left:0px"); HorizontalLayout outerHorLay = new HorizontalLayout(); addComponent(outerHorLay, "top:45px;left:0px"); outerHorLay.setWidth(FOOTER_W); HorizontalLayout innerHorLay = new HorizontalLayout(); innerHorLay.setSpacing(true); outerHorLay.addComponent(innerHorLay); outerHorLay.setComponentAlignment(innerHorLay, Alignment.MIDDLE_CENTER); Label sp; innerHorLay.addComponent(aboutButt); innerHorLay.addComponent(pingPushLab = new HtmlLabel()); pingPushLab.setWidth("7px"); innerHorLay.addComponent(creditsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(faqsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(fixesButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(glossaryButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(reportsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(termsButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(troubleButt); troubleButt.addStyleName("m-red-text"); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(twitterButt); innerHorLay.addComponent(sp = new Label()); sp.setWidth("7px"); innerHorLay.addComponent(videosButt); GameLinks gl = GameLinks.getTL(); if (gl.getFixesLink().toLowerCase().contains("armyscitech") || gl.getGlossaryLink().toLowerCase().contains("armyscitech")) { ; // This is a hack, but I don't want to pollute the db with a bogus boolean...this is a special case just for these folks. } else { HorizontalLayout hl = new HorizontalLayout(); Label lab = null; hl.addComponent(lab = new HtmlLabel("Build " + MMOWGLI_BUILD_ID)); lab.addStyleName("m-footer-servername"); //small text lab.setDescription(Mmowgli2UI.getGlobals().getVaadinSessionCookie()); hl.addComponent(lab = new HtmlLabel(" Vaadin " + VAADIN_BUILD_VERSION)); lab.addStyleName("m-footer-servername"); //small text hl.addComponent(lab = new HtmlLabel(" " + AppMaster.instance().getServerName())); lab.addStyleName("m-footer-servername"); //small text hl.setSizeUndefined(); mainAbsLay.addComponent(hl, "bottom:3px;right:15px;"); } fouoLink = Footer.buildFouoNoticeTL(); addComponent(fouoLink, "top:92px;left:365px"); fouoLink.setVisible(Game.getTL().isShowFouo()); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboard.java
License:Open Source License
public void initGuiTL() { setSizeUndefined();/*w w w . jav a 2 s .c o m*/ setWidth(APPLICATION_SCREEN_WIDTH); // setHeight("855px"); //ACTIONDASHBOARD_H); Label sp; addComponent(sp = new Label()); sp.setHeight("10px"); HorizontalLayout titleHL = new HorizontalLayout(); titleHL.setWidth("95%"); addComponent(titleHL); titleHL.addComponent(sp = new Label()); sp.setWidth("20px"); Component titleC; titleHL.addComponent(titleC = Mmowgli2UI.getGlobals().getMediaLocator().getActionDashboardTitle()); titleHL.setComponentAlignment(titleC, Alignment.MIDDLE_LEFT); titleHL.addComponent(sp = new Label()); sp.setWidth("1px"); titleHL.setExpandRatio(sp, 1.0f); titleHL.addComponent(howToWinActionButt); howToWinActionButt.setDescription(howWinAction_tt); AbsoluteLayout absL = new AbsoluteLayout(); addComponent(absL); absL.setWidth(APPLICATION_SCREEN_WIDTH); absL.setHeight(ACTIONDASHBOARD_H); MediaLocator medLoc = Mmowgli2UI.getGlobals().getMediaLocator(); AbsoluteLayout mainAbsLay = new AbsoluteLayout(); // offset it from master mainAbsLay.setWidth(APPLICATION_SCREEN_WIDTH); mainAbsLay.setHeight(ACTIONDASHBOARD_H); absL.addComponent(mainAbsLay, ACTIONDASHBOARD_OFFSET_POS); // Now the background Embedded backgroundImage = new Embedded(null, medLoc.getActionDashboardPlanBackground()); backgroundImage.setWidth(ACTIONDASHBOARD_W); backgroundImage.setHeight(ACTIONDASHBOARD_H); mainAbsLay.addComponent(backgroundImage, "top:0px;left:0px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionDashboardBlackTabs"); tabsHL.setSpacing(false); tabsHL.addComponent(sp = new Label()); sp.setWidth("12px"); TabClickHandler tabHndlr = new TabClickHandler(); actionPlansTabButt.setStyleName("m-actionDashboardActionPlansTab"); actionPlansTabButt.addClickListener(tabHndlr); actionPlansTabButt.setId(ACTION_DASHBOARD_ACTION_PLANS_TAB); tabsHL.addComponent(actionPlansTabButt); tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); myPlansTabButt.setStyleName("m-actionDashboardMyPlansTab"); myPlansTabButt.addClickListener(tabHndlr); myPlansTabButt.setId(ACTION_DASHBOARD_MY_ACTION_PLANS_TAB); tabsHL.addComponent(myPlansTabButt); myPlansTabButt.addStyleName("m-transparent-background"); // initially tabsHL.addComponent(sp = new Label()); sp.setWidth("1px"); needAuthorsTabButt.setStyleName("m-actionDashboardNeedAuthorsTab"); needAuthorsTabButt.addClickListener(tabHndlr); needAuthorsTabButt.setId(ACTION_DASHBOARD_NEED_AUTHORS_TAB); tabsHL.addComponent(needAuthorsTabButt); needAuthorsTabButt.addStyleName("m-transparent-background"); // initially absL.addComponent(tabsHL, "left:7px;top:8px"); // stack the pages absL.addComponent(actionPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); actionPlansTab.initGuiTL(); absL.addComponent(myPlansTab, ACTIONDASHBOARD_TABCONTENT_POS); myPlansTab.initGuiTL(); myPlansTab.setVisible(false); absL.addComponent(needAuthorsTab, ACTIONDASHBOARD_TABCONTENT_POS); needAuthorsTab.initGuiTL(); needAuthorsTab.setVisible(false); User me = Mmowgli2UI.getGlobals().getUserTL(); Set<ActionPlan> invitedSet = me.getActionPlansInvited(); if (invitedSet != null && (invitedSet.size()) > 0) { Notification note = new Notification("<center>You're invited to an Action Plan!</center>", "<center> Look for the \"you're invited to join!\" notice.<br/>" + "First, check out the plan. Then, if you want to join,<br/>" + "click the link to become an author." + "</center>", Type.HUMANIZED_MESSAGE, true); // allow html note.setPosition(Position.MIDDLE_CENTER); note.setDelayMsec(5000);// 5 secs note.show(Page.getCurrent()); } }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionDashboardTabPanel.java
License:Open Source License
public ActionDashboardTabPanel() { setWidth(ACTIONDASHBOARD_TABCONTENT_W); setHeight(ACTIONDASHBOARD_TABCONTENT_H); leftAbsLay = new AbsoluteLayout(); leftAbsLay.setWidth(ACTIONDASHBOARD_TABCONTENT_LEFT_W); leftAbsLay.setHeight(ACTIONDASHBOARD_TABCONTENT_LEFT_H); leftAbsLay.addComponent(wrapper = new GhostVerticalLayoutWrapper(), "left:0px;right:0px"); leftVertLay = new VerticalLayout(); wrapper.ghost_setContent(leftVertLay); rightAbsLay = new AbsoluteLayout(); rightAbsLay.setWidth("669px"); // this needs about 10 more px //ACTIONDASHBOARD_TABCONTENT_RIGHT_W); rightAbsLay.setHeight(ACTIONDASHBOARD_TABCONTENT_RIGHT_H); addComponent(leftAbsLay, ACTIONDASHBOARD_TABCONTENT_LEFT_POS); addComponent(rightAbsLay, ACTIONDASHBOARD_TABCONTENT_RIGHT_POS); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.ActionPlanPage2.java
License:Open Source License
@SuppressWarnings("serial") public void initGuiTL() { ActionPlan actPln = ActionPlan.getTL(apId); User me = Mmowgli2UI.getGlobals().getUserTL(); addStyleName("m-cssleft-45"); setWidth("1089px"); setHeight("1821px"); Label sp;/*from w w w . j av a 2s . c o m*/ VerticalLayout mainVL = new VerticalLayout(); addComponent(mainVL, "top:0px;left:0px"); mainVL.addStyleName("m-overflow-visible"); mainVL.setWidth("1089px"); mainVL.setHeight(null); mainVL.setSpacing(false); mainVL.setMargin(false); VerticalLayout mainVLayout = new VerticalLayout(); mainVLayout.setSpacing(false); mainVLayout.setMargin(false); mainVLayout.addStyleName("m-actionplan-background2"); mainVLayout.setWidth("1089px"); mainVLayout.setHeight(null); //"1821px"); mainVL.addComponent(mainVLayout); mainVLayout.addComponent(makeIdField(actPln)); mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); VerticalLayout leftTopVL = new VerticalLayout(); leftTopVL.setWidth("820px"); leftTopVL.setSpacing(false); leftTopVL.setMargin(false); mainVLayout.addComponent(leftTopVL); HorizontalLayout titleAndThumbsHL = new HorizontalLayout(); titleAndThumbsHL.setSpacing(false); titleAndThumbsHL.setMargin(false); titleAndThumbsHL.setHeight("115px"); titleAndThumbsHL.addStyleName("m-actionplan-header-container"); leftTopVL.addComponent(titleAndThumbsHL); titleAndThumbsHL.addComponent(sp = new Label()); sp.setWidth("55px"); VerticalLayout vl = new VerticalLayout(); vl.addComponent(titleUnion); //titleTA); titleUnion.initGui(); titleHistoryButt = new NativeButton(); titleHistoryButt.setCaption("history"); titleHistoryButt.setStyleName(BaseTheme.BUTTON_LINK); titleHistoryButt.addStyleName("borderless"); titleHistoryButt.addStyleName("m-actionplan-history-button"); titleHistoryButt.addClickListener(new TitleHistoryListener()); titleHistoryButt.setEnabled(!readonly); vl.addComponent(titleHistoryButt); vl.setComponentAlignment(titleHistoryButt, Alignment.TOP_RIGHT); titleAndThumbsHL.addComponent(vl); //titleTA); titleUnion.setWidth(ACTIONPLAN_TITLE_W); titleUnion.setValueTL(actPln.getTitle() == null ? "" : actPln.getTitle()); titleUnion.addStyleName("m-lightgrey-border"); // titleUnion.addStyleName("m-opacity-75"); titleUnion.setHeight("95px"); // 120 px); must make it this way for alignment of r/o vs rw addComponent(saveCanPan, "top:0px;left:395px"); saveCanPan.setVisible(false); titleAndThumbsHL.addComponent(sp = new Label()); sp.setWidth("50px"); VerticalLayout thumbVL = new VerticalLayout(); titleAndThumbsHL.addComponent(thumbVL); thumbVL.addComponent(sp = new Label()); sp.setHeight("50px"); thumbPanel = new ThumbPanel(); Map<User, Integer> map = actPln.getUserThumbs(); Integer t = map.get(me); /* if(t == null) { map.put(me, 0); ActionPlan.update(actPln); GameEventLogger.logActionPlanUpdate(actPln, "thumbs changed",me.getUserName()); t = 0; } */ thumbPanel.setNumUserThumbs(t == null ? 0 : t); thumbVL.addComponent(thumbPanel); HorizontalLayout commentAndViewChainHL = new HorizontalLayout(); leftTopVL.addComponent(commentAndViewChainHL); commentAndViewChainHL.setSpacing(false); commentAndViewChainHL.setMargin(false); commentAndViewChainHL.addComponent(sp = new Label()); sp.setWidth("55px"); VerticalLayout commLeftVL = new VerticalLayout(); commentAndViewChainHL.addComponent(commLeftVL); commLeftVL.setWidth("95px"); commLeftVL.addComponent(commentsButt); commentsButt.setStyleName(BaseTheme.BUTTON_LINK); commentsButt.addStyleName("borderless"); commentsButt.addStyleName("m-actionplan-comments-button"); ClickListener commLis; commentsButt.addClickListener(commLis = new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().setScrollTop(1250); //commentsButt.getWindow().setScrollTop(1250); } }); commLeftVL.addComponent(sp = new Label()); sp.setHeight("65px"); //"50px"); commLeftVL.addComponent(envelopeButt); envelopeButt.addStyleName("m-actionplan-envelope-button"); envelopeButt.addClickListener(commLis); // same as the link button above commentAndViewChainHL.addComponent(sp = new Label()); sp.setWidth("5px"); VerticalLayout commMidVL = new VerticalLayout(); commentAndViewChainHL.addComponent(commMidVL); commMidVL.setWidth("535px"); commMidVL.addComponent(addCommentButt); addCommentButt.setCaption("Add Comment"); addCommentButt.setStyleName(BaseTheme.BUTTON_LINK); addCommentButt.addStyleName("borderless"); addCommentButt.addStyleName("m-actionplan-comments-button"); addCommentButt.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_TOP); addCommentButt.addClickListener(addCommentListener = new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().setScrollTop(1250); //addCommentButt.getWindow().setScrollTop(1250); commentPanel.AddCommentClicked(event); } }); commMidVL.addComponent(sp = new Label()); sp.setHeight("5px"); commMidVL.addComponent(lastCommentLabel = new HtmlLabel()); lastCommentLabel.setWidth("100%"); lastCommentLabel.setHeight("94px"); lastCommentLabel.addStyleName("m-actionplan-textentry"); lastCommentLabel.addStyleName("m-opacity-75"); addComponent(viewChainButt, "left:690px;top:140px"); viewChainButt.setStyleName("m-viewCardChainButton"); viewChainButt.addClickListener(new ViewCardChainHandler()); viewChainButt.setId(ACTIONPLAN_VIEW_CARD_CHAIN_BUTTON); // This guy sits on the bottom naw, gets covered // author list and rfe VerticalLayout rightVL = new VerticalLayout(); this.addComponent(rightVL, "left:830px;top:0px"); rightVL.setSpacing(false); rightVL.setMargin(false); rightVL.setWidth(null); VerticalLayout listVL = new VerticalLayout(); listVL.setSpacing(false); listVL.addStyleName("m-actionPlanAddAuthorList"); listVL.addStyleName("m-actionplan-header-container"); listVL.setHeight(null); listVL.setWidth("190px"); listVL.addComponent(sp = new Label()); sp.setHeight("35px"); sp.setDescription("List of current authors and (invited authors)"); Label subTitle; listVL.addComponent(subTitle = new Label("(invited in parentheses)")); subTitle.setWidth(null); // keep it from being 100% wide subTitle.setDescription("List of current authors and (invited authors)"); subTitle.addStyleName("m-actionplan-authorlist-sublabel"); listVL.setComponentAlignment(subTitle, Alignment.MIDDLE_CENTER); rightVL.addComponent(listVL); TreeSet<User> ts = new TreeSet<User>(new User.AlphabeticalComparator()); ts.addAll(actPln.getAuthors()); TreeSet<User> greyTs = new TreeSet<User>(new User.AlphabeticalComparator()); greyTs.addAll(actPln.getInvitees()); authorList = new UserList(null, ts, greyTs); listVL.addComponent(authorList); authorList.addStyleName("m-greyborder"); listVL.setComponentAlignment(authorList, Alignment.TOP_CENTER); authorList.setWidth("150px"); authorList.setHeight("95px"); listVL.addComponent(sp = new Label()); sp.setHeight("5px"); listVL.addComponent(addAuthButton); listVL.setComponentAlignment(addAuthButton, Alignment.TOP_CENTER); addAuthButton.setStyleName("m-actionPlanAddAuthorButt"); addAuthButton.addClickListener(new AddAuthorHandler()); addAuthButton.setDescription("Invite players to be authors of this action plan"); rightVL.addComponent(sp = new Label()); sp.setHeight("5px"); rightVL.addComponent(rfeButt); rightVL.setComponentAlignment(rfeButt, Alignment.TOP_CENTER); // done in handleDisabledments() rfeButt.setStyleName("m-rfeButton"); // end authorList and rfe mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); sp.setWidth("20px"); // Tabs: AbsoluteLayout absL = new AbsoluteLayout(); mainVLayout.addComponent(absL); absL.setHeight("60px"); absL.setWidth("830px"); HorizontalLayout tabsHL = new HorizontalLayout(); tabsHL.setStyleName("m-actionPlanBlackTabs"); tabsHL.setSpacing(false); absL.addComponent(tabsHL, "left:40px;top:0px"); NewTabClickHandler ntabHndlr = new NewTabClickHandler(); tabsHL.addComponent(sp = new Label()); sp.setWidth("19px"); thePlanTabButt.setStyleName("m-actionPlanThePlanTab"); thePlanTabButt.addStyleName(ACTIONPLAN_TAB_THEPLAN); // debug thePlanTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(thePlanTabButt); talkTabButt.setStyleName("m-actionPlanTalkItOverTab"); //talkTabButt.addStyleName(ACTIONPLAN_TAB_TALK); talkTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(talkTabButt); talkTabButt.addStyleName("m-transparent-background"); // initially imagesTabButt.setStyleName("m-actionPlanImagesTab"); imagesTabButt.addStyleName(ACTIONPLAN_TAB_IMAGES); imagesTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(imagesTabButt); imagesTabButt.addStyleName("m-transparent-background"); // initially videosTabButt.setStyleName("m-actionPlanVideosTab"); videosTabButt.addStyleName(ACTIONPLAN_TAB_VIDEO); videosTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(videosTabButt); videosTabButt.addStyleName("m-transparent-background"); // initially mapTabButt.setStyleName("m-actionPlanMapTab"); mapTabButt.addStyleName(ACTIONPLAN_TAB_MAP); mapTabButt.addClickListener(ntabHndlr); tabsHL.addComponent(mapTabButt); mapTabButt.addStyleName("m-transparent-background"); // initially newChatLab.setStyleName("m-newChatLabel"); absL.addComponent(newChatLab, "left:340px;top:15px"); newChatLab.setVisible(false); // stack the pages HorizontalLayout hsp = new HorizontalLayout(); hsp.setHeight("742px"); // allows for differing ghost box heights mainVLayout.addComponent(hsp); hsp.addComponent(sp = new Label()); sp.setWidth("45px"); hsp.addComponent(thePlanTab); thePlanTab.initGui(); hsp.addComponent(talkTab); talkTab.initGui(); talkTab.setVisible(false); hsp.addComponent(imagesTab); imagesTab.initGui(); imagesTab.setVisible(false); hsp.addComponent(videosTab); videosTab.initGui(); videosTab.setVisible(false); hsp.addComponent(mapTab); mapTab.initGui(); mapTab.setVisible(false); mainVLayout.addComponent(sp = new Label()); sp.setHeight("90px"); HorizontalLayout buttLay = new HorizontalLayout(); buttLay.addStyleName("m-marginleft-60"); mainVLayout.addComponent(buttLay); buttLay.setWidth(ActionPlanPageCommentPanel2.COMMENT_PANEL_WIDTH); addCommentButtBottom.setCaption("Add Comment"); addCommentButtBottom.setStyleName(BaseTheme.BUTTON_LINK); addCommentButtBottom.addStyleName("borderless"); addCommentButtBottom.addStyleName("m-actionplan-comments-button"); addCommentButtBottom.setId(ACTIONPLAN_ADD_COMMENT_LINK_BUTTON_BOTTOM); addCommentButtBottom.addClickListener(addCommentListener); buttLay.addComponent(addCommentButtBottom); if (me.isAdministrator() || me.isGameMaster()) { buttLay.addComponent(sp = new Label()); sp.setWidth("1px"); // "810px"); buttLay.setExpandRatio(sp, 1.0f); ToggleLinkButton tlb = new ToggleLinkButton("View all", "View unhidden only", "m-actionplan-comment-text"); tlb.setToolTips("Temporarily show all messages, including those marked \"hidden\" (gm)", "Temporarily hide messages marked \"hidden\" (gm)"); tlb.addStyleName("m-actionplan-comments-button"); tlb.addOnListener(new ViewAllListener()); tlb.addOffListener(new ViewUnhiddenOnlyListener()); buttLay.addComponent(tlb); buttLay.addComponent(sp = new Label()); sp.setWidth("5px"); } // And the comments hsp = new HorizontalLayout(); mainVLayout.addComponent(hsp); mainVLayout.addComponent(sp = new Label()); sp.setHeight("5px"); hsp.addComponent(sp = new Label()); sp.setWidth("56px"); hsp.addComponent(commentPanel); commentPanel.initGui(); // Set thumbs double thumbs = actPln.getAverageThumb(); long round = Math.round(thumbs); int numApThumbs = (int) (Math.min(round, 3)); thumbPanel.setNumApThumbs(numApThumbs); Integer myRating = actPln.getUserThumbs().get(me); if (myRating == null) myRating = 0; thumbPanel.setNumUserThumbs(myRating); helpWantedListener = new HelpWantedListener(); interestedListener = new InterestedListener(); handleDisablementsTL(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.AddImageDialog.java
License:Open Source License
@SuppressWarnings("serial") @HibernateSessionThreadLocalConstructor//from w ww . j a va 2 s . c o m public AddImageDialog(Object apId) { super("Add an Image"); addStyleName("m-greybackground"); setClosable(false); // no x in corner VerticalLayout mainVL = new VerticalLayout(); mainVL.setSpacing(true); mainVL.setMargin(true); mainVL.setSizeUndefined(); // auto size setContent(mainVL); mainHL = new HorizontalLayout(); mainVL.addComponent(mainHL); mainHL.setSpacing(true); holder = new AbsoluteLayout(); mainHL.addComponent(holder); holder.setWidth("150px"); holder.setHeight("150px"); holder.addStyleName("m-darkgreyborder"); VerticalLayout rightVL = new VerticalLayout(); mainHL.addComponent(rightVL); fromWebCheck = new CheckBox(); fromWebCheck.addStyleName("v-radiobutton"); fromWebCheck.setValue(true); fromWebCheck.setImmediate(true); fromWebCheck.addValueChangeListener(new RadioListener(fromWebCheck)); HorizontalLayout frWebHL = new HorizontalLayout(); rightVL.addComponent(frWebHL); frWebHL.addComponent(fromWebCheck); VerticalLayout frWebVL = new VerticalLayout(); frWebVL.setMargin(true); frWebVL.addStyleName("m-greyborder"); frWebHL.addComponent(frWebVL); frWebVL.setWidth("370px"); frWebVL.addComponent(new Label("From the web:")); HorizontalLayout webHL = new HorizontalLayout(); webHL.setSpacing(true); frWebVL.addComponent(webHL); webHL.addComponent(webUrl = new TextField()); webUrl.setColumns(21); webHL.addComponent(testButt = new Button("Test")); Label sp; webHL.addComponent(sp = new Label()); sp.setWidth("1px"); webHL.setExpandRatio(sp, 1.0f); fromDeskCheck = new CheckBox(); fromDeskCheck.addStyleName("v-radiobutton"); fromDeskCheck.setValue(false); fromDeskCheck.addValueChangeListener(new RadioListener(fromDeskCheck)); fromDeskCheck.setImmediate(true); HorizontalLayout dtHL = new HorizontalLayout(); rightVL.addComponent(dtHL); dtHL.addComponent(fromDeskCheck); VerticalLayout dtopVL = new VerticalLayout(); dtopVL.setMargin(true); dtopVL.addStyleName("m-greyborder"); dtHL.addComponent(dtopVL); dtopVL.setWidth("370px"); dtopVL.addComponent(new Label("From your desktop:")); HorizontalLayout localHL = new HorizontalLayout(); localHL.setSpacing(true); dtopVL.addComponent(localHL); localHL.addComponent(localTF = new TextField()); localTF.setColumns(21); localHL.addComponent(uploadWidget = new Upload()); panel = new UploadStatus(uploadWidget); uploadWidget.setButtonCaption("Browse"); File tempDir = Files.createTempDir(); tempDir.deleteOnExit(); handler = new UploadHandler(uploadWidget, panel, tempDir.getAbsolutePath()); uploadWidget.setReceiver(handler); uploadWidget.setImmediate(true); panel.setWidth("100%"); dtopVL.addComponent(panel); dtopVL.setComponentAlignment(panel, Alignment.TOP_CENTER); HorizontalLayout bottomHL = new HorizontalLayout(); mainVL.addComponent(bottomHL); bottomHL.setSpacing(true); bottomHL.setWidth("100%"); Label spacer; bottomHL.addComponent(spacer = new Label()); spacer.setWidth("100%"); bottomHL.setExpandRatio(spacer, 1.0f); bottomHL.addComponent(cancelButt = new Button("Cancel")); bottomHL.addComponent(submitButt = new Button("Add")); setDisabledFields(); uploadWidget.addFinishedListener(new FinishedListener() { @Override public void uploadFinished(FinishedEvent event) { Object key = HSess.checkInit(); System.out.println("AddImageDialog.uploadFinished()"); String fpath = handler.getFullUploadedPath(); if (fpath != null) { // error of some kind if null if (!MalwareChecker.isFileVirusFree(fpath)) { panel.state.setValue("<span style='color:red;'>Failed malware check</span>"); fpath = null; localTF.setValue(""); HSess.checkClose(key); return; } File f = new File(fpath); f.deleteOnExit(); try { MediaImage mediaImage = InstallImageDialog.putFileImageIntoDbTL(f, f.getName(), event.getMIMEType()); f.delete(); media = mediaImage.media; image = mediaImage.image; media.setCaption(null); Resource res = Mmowgli2UI.getGlobals().getMediaLocator().locate(media); setupEmbeddedImageThumbnail(res, media); localTF.setValue(event.getFilename()); } catch (IOException ex) { Notification.show("Error loading image", Notification.Type.ERROR_MESSAGE); MSysOut.println(ERROR_LOGS, "Error in AddImageDialog loading image: " + ex.getClass().getSimpleName() + ": " + ex.getLocalizedMessage()); } } HSess.checkClose(key); } }); testButt.addClickListener(new testWebImageHandler()); submitButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (fromWebCheck.getValue()) { if (checkBadUrl(webUrl.getValue(), event.getButton())) return; } UI.getCurrent().removeWindow(AddImageDialog.this); if (closer != null) closer.windowClose(null); } }); cancelButt.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { Object key = HSess.checkInit(); if (media != null) { Media.deleteTL(media); media = null; } if (image != null) { Image.deleteTL(image); image = null; } uploadWidget.interruptUpload(); UI.getCurrent().removeWindow(AddImageDialog.this); if (closer != null) closer.windowClose(null); HSess.checkClose(key); } }); webUrl.focus(); }
From source file:edu.nps.moves.mmowgli.modules.actionplans.AddVideoDialog.java
License:Open Source License
@SuppressWarnings("serial") public AddVideoDialog() { super("Add a Video"); addStyleName("m-greybackground"); setClosable(false); // no x in corner setWidth("530px"); setHeight("400px"); VerticalLayout mainVL = new VerticalLayout(); mainVL.setSpacing(true);/*from w w w .j av a2 s . com*/ mainVL.setMargin(true); mainVL.setSizeUndefined(); // auto size mainVL.setWidth("100%"); setContent(mainVL); Label helpLab = new HtmlLabel("Add YouTube videos to your Action Plan this way:" + "<OL><LI>Find the video you want at <a href=\"https://www.youtube.com\" target=\"" + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a>.</LI>" + "<LI>Click the \"share\" button below the video screen.</LI>" + "<LI>Copy the URL under \"Link to this video:\"</LI>" + "<LI>Paste the URL into the field below.</LI>" + "</OL>" + "If you have media that " + "has not been uploaded to YouTube, see <a href=\"https://www.youtube.com\" target=\"" + PORTALTARGETWINDOWNAME + "\">www.youtube.com</a> " + "for help with establishing a free account.<br/>"); helpLab.setWidth("100%"); mainVL.addComponent(helpLab); HorizontalLayout mainHL = new HorizontalLayout(); mainHL.setMargin(false); mainHL.setSpacing(true); mainVL.addComponent(mainHL); holder = new AbsoluteLayout(); mainHL.addComponent(holder); holder.addStyleName("m-darkgreyborder"); holder.setWidth("150px"); holder.setHeight("150px"); holder.addComponent(new Label("Test video display"), "top:0px;left:0px;"); VerticalLayout rightVL = new VerticalLayout(); mainHL.addComponent(rightVL); rightVL.setMargin(false); rightVL.setSpacing(true); rightVL.addComponent(new Label("YouTube video address")); HorizontalLayout tfHL = new HorizontalLayout(); tfHL.setSpacing(true); rightVL.addComponent(tfHL); addrTf = new TextField(); tfHL.addComponent(addrTf); addrTf.setColumns(21); tfHL.addComponent(testButt = new Button("Test")); rightVL.addComponent(new Label("Using the test button will set the")); rightVL.addComponent(new Label("default title and description.")); Label sp; rightVL.addComponent(sp = new Label()); sp.setHeight("15px"); HorizontalLayout bottomHL = new HorizontalLayout(); rightVL.addComponent(bottomHL); rightVL.setComponentAlignment(bottomHL, Alignment.TOP_RIGHT); bottomHL.setSpacing(true); bottomHL.setWidth("100%"); Label spacer; bottomHL.addComponent(spacer = new Label()); spacer.setWidth("100%"); bottomHL.setExpandRatio(spacer, 1.0f); bottomHL.addComponent(cancelButt = new Button("Cancel")); bottomHL.addComponent(submitButt = new Button("Add")); testButt.addClickListener(new TestVidHandler()); submitButt.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { UI.getCurrent().removeWindow(AddVideoDialog.this); if (closer != null) closer.windowClose(null); } }); cancelButt.addClickListener(new ClickListener() { public void buttonClick(ClickEvent event) { media = null; UI.getCurrent().removeWindow(AddVideoDialog.this); if (closer != null) closer.windowClose(null); } }); }