本文整理汇总了Java中com.vaadin.server.BrowserWindowOpener类的典型用法代码示例。如果您正苦于以下问题:Java BrowserWindowOpener类的具体用法?Java BrowserWindowOpener怎么用?Java BrowserWindowOpener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BrowserWindowOpener类属于com.vaadin.server包,在下文中一共展示了BrowserWindowOpener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WebNewWindowButton
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
public WebNewWindowButton() {
component = new CubaButton();
component.addStyleName(NEW_WINDOW_BUTTON_STYLENAME);
component.setDescription(null);
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);
}
示例2: AccountModuleImpl
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
public AccountModuleImpl() {
addStyleName("module");
ControllerRegistry.addController(new UserAccountController(this));
MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true).withStyleName("border-bottom");
AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);
MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP))
.withIcon(FontAwesome.MORTAR_BOARD).withStyleName(WebThemes.BUTTON_LINK);
ExternalResource helpRes = new ExternalResource("https://community.mycollab.com/docs/account-management/");
BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes);
helpOpener.extend(helpBtn);
topPanel.with(breadcrumb, helpBtn).withAlign(helpBtn, Alignment.TOP_RIGHT);
tabSheet = new VerticalTabsheet();
tabSheet.setSizeFull();
tabSheet.setNavigatorStyleName("sidebar-menu");
tabSheet.addToggleNavigatorControl();
VerticalLayout contentWrapper = tabSheet.getContentWrapper();
contentWrapper.addStyleName("main-content");
contentWrapper.addComponentAsFirst(topPanel);
this.buildComponents();
this.setContent(tabSheet);
}
示例3: buildLanguageUpdatePanel
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
private void buildLanguageUpdatePanel() {
FormContainer formContainer = new FormContainer();
MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true));
MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false);
Label logoDesc = new Label(UserUIContext.getMessage(ShellI18nEnum.OPT_LANGUAGE_DOWNLOAD));
leftPanel.with(logoDesc).withWidth("250px");
MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false);
MButton downloadBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD))
.withStyleName(WebThemes.BUTTON_ACTION).withIcon(FontAwesome.DOWNLOAD);
ServerConfiguration serverConfiguration = AppContextUtil.getSpringBean(ServerConfiguration.class);
BrowserWindowOpener opener = new BrowserWindowOpener(serverConfiguration.getApiUrl("localization/translations"));
opener.extend(downloadBtn);
rightPanel.with(downloadBtn, new ELabel(UserUIContext.getMessage(ShellI18nEnum
.OPT_UPDATE_LANGUAGE_INSTRUCTION)).withStyleName(UIConstants.META_INFO));
layout.with(leftPanel, rightPanel).expand(rightPanel);
formContainer.addSection("Languages", layout);
this.with(formContainer);
}
示例4: getButton
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
/**
* @param caption
* @param bwo
* @param icon
* @return un bouton pour l'assistance
*/
private OneClickButton getButton(String caption, String bwo, com.vaadin.server.Resource icon){
BrowserWindowOpener browser = new BrowserWindowOpener(new ExternalResource(bwo));
OneClickButton btn = new OneClickButton(caption, icon);
btn.addStyleName(ValoTheme.BUTTON_LINK);
browser.extend(btn);
return btn;
}
示例5: initializeButtons
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
protected void initializeButtons() {
//
// 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);
}
示例6: initComponents
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
/**
* Setup UI.
* @param errorMessage
*/
private void initComponents(String errorMessage) {
logoutLink = new LogoutLink();
logoutLink.setVisible(false);
User user =
(User)VaadinSession.getCurrent().getAttribute(SessionStorageKey.USER.name());
// if authencication has been successful we open up a new tab to show the DHConvalidator services
btContinue = new Button(Messages.getString("LoginResultPanel.continue")); //$NON-NLS-1$
new BrowserWindowOpener(DHConvalidatorServices.class).extend(btContinue);
btRetry = new Button(Messages.getString("LoginResultPanel.retry")); //$NON-NLS-1$
btRetry.setVisible(false);
Label infoLabel = new Label("", ContentMode.HTML);
if (errorMessage != null) {
infoLabel.setValue(
Messages.getString("LoginResultPanel.authenticationFailure", errorMessage)); //$NON-NLS-1$
btContinue.setVisible(false);
btRetry.setVisible(true);
}
else {
infoLabel.setValue(
Messages.getString(
"LoginResultPanel.greeting", //$NON-NLS-1$
user.getFirstName(),
user.getLastName()));
logoutLink.setVisible(true);
}
addCenteredComponent(logoutLink, Alignment.TOP_RIGHT);
addCenteredComponent(infoLabel);
addCenteredComponent(btContinue);
addCenteredComponent(btRetry);
}
示例7: initWindow
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
private void initWindow(final String caption, final byte[] file, final String fileName) {
setCaption(caption);
final VerticalLayout contentContainer = new VerticalLayout();
contentContainer.setMargin(true);
contentContainer.setSpacing(true);
final Label infoLbl = new Label(fileName);
contentContainer.addComponent(infoLbl);
final HorizontalLayout toolbar = new HorizontalLayout();
toolbar.setSpacing(true);
final Button downloadBtn = new Button("Скачать", Fontello.DOWNLOAD);
createDownloader(file, fileName).extend(downloadBtn);
toolbar.addComponent(downloadBtn);
final Button viewBtn = new Button("Посмотреть", Fontello.SEARCH_1);
final BrowserWindowOpener opener =
new BrowserWindowOpener(new StreamResource(
() -> new ByteArrayInputStream(file), encodeWebFileName(fileName)));
opener.extend(viewBtn);
toolbar.addComponent(viewBtn);
contentContainer.addComponent(toolbar);
contentContainer.setComponentAlignment(toolbar, Alignment.MIDDLE_CENTER);
setContent(contentContainer);
}
示例8: PrintButton
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
public PrintButton() {
setIcon(FontAwesome.PRINT);
formReportStreamSource = new FormReportStreamSource(new FormReportTemplateExecutor(""));
BrowserWindowOpener printWindowOpener = new BrowserWindowOpener(new StreamResource(formReportStreamSource, UUID.randomUUID().toString() + ".pdf"));
printWindowOpener.extend(this);
}
示例9: attach
import com.vaadin.server.BrowserWindowOpener; //导入依赖的package包/类
@Override
public void attach() {
super.attach();
URI myUrl = UI.getCurrent().getPage().getLocation();
String myUrlRoot = myUrl.getScheme() + "://" + myUrl.getAuthority()
+ myUrl.getPath();
String modelUrl = myUrlRoot + "?getmodelid=" + modelId;
String modelUrlEnc;
try {
modelUrlEnc = URLEncoder.encode(modelUrl, "UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
String url = visualDesignerUrl + "?restartApplication&modelid="
+ modelId + "&modeluri=" + modelUrlEnc;
BrowserWindowOpener opener = new BrowserWindowOpener(url);
Button button = new Button("Open Visual Designer");
button.setIcon(Icons.APPLICATION_ARROW);
opener.extend(button);
layout.addComponent(button);
Button fetchButton = new Button("Get from Visual Designer");
fetchButton.setIcon(Icons.ARROW_180_MEDIUM);
fetchButton.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
fetch(modelId);
}
});
layout.addComponent(fetchButton);
}