List of usage examples for com.vaadin.server BrowserWindowOpener setWindowName
public void setWindowName(String windowName)
From source file:com.haulmont.cuba.web.gui.components.mainwindow.WebNewWindowButton.java
License:Apache License
public WebNewWindowButton() { component = new CubaButton(); component.addStyleName(NEW_WINDOW_BUTTON_STYLENAME); component.setDescription(null);// w w w . j a v a2 s .c om URL pageUrl; try { pageUrl = Page.getCurrent().getLocation().toURL(); } catch (MalformedURLException ignored) { LoggerFactory.getLogger(WebNewWindowButton.class).warn("Couldn't get URL of current Page"); return; } ExternalResource currentPage = new ExternalResource(pageUrl); final BrowserWindowOpener opener = new BrowserWindowOpener(currentPage); opener.setWindowName("_blank"); opener.extend(component); }
From source file:edu.nps.moves.mmowgli.modules.cards.PlayAnIdeaPage2.java
License:Open Source License
@Override public void initGui() { setSpacing(true);/* www . j av a2 s . c om*/ 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:org.apache.openaz.xacml.admin.components.PolicyEditor.java
License:Apache License
protected void initializeButtons() { ///* www .j av a 2 s . c o m*/ // The Save button // this.buttonSave.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { self.savePolicy(); } }); // // Attach a window opener to the View XML button // BrowserWindowOpener opener = new BrowserWindowOpener(new StreamResource(new StreamResource.StreamSource() { private static final long serialVersionUID = 1L; @Override public InputStream getStream() { try { if (logger.isDebugEnabled()) { logger.debug("Setting view xml button to: " + self.file.getAbsolutePath()); } return new FileInputStream(self.file); } catch (Exception e) { logger.error("Failed to open input stream " + self.file); } return null; } }, self.file.getName())); opener.setWindowName("_new"); opener.extend(this.buttonViewXML); }