當前位置: 首頁>>代碼示例>>Java>>正文


Java ExternalResource類代碼示例

本文整理匯總了Java中com.vaadin.server.ExternalResource的典型用法代碼示例。如果您正苦於以下問題:Java ExternalResource類的具體用法?Java ExternalResource怎麽用?Java ExternalResource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExternalResource類屬於com.vaadin.server包,在下文中一共展示了ExternalResource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: enter

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
@Override
public void enter(ViewChangeEvent event) {
	pageHelper.setErrorHandler(this);

	this.removeAllComponents();

	// Get application
	int appId = Integer.parseInt(event.getParameters());

	Application app = pageHelper.getApp(appId);

	// Header
	this.addComponent(new PageHeader(app, "Endpoints"));

	// Add endpoints links
	app.endpoints().asList().stream()
	   .forEach(endpointUrl -> this.addComponent(new Link(endpointUrl+".json", new ExternalResource(endpointUrl+".json"), "_blank", 0, 0, BorderStyle.DEFAULT)));
}
 
開發者ID:vianneyfaivre,項目名稱:Persephone,代碼行數:19,代碼來源:EndpointsPage.java

示例2: test

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
@Test
public void test() {
    ExternalResource resource = new ExternalResource("http://www.google.com");
    FLink link = new FLink().withCaption("My link")
                            .withResource(resource)
                            .withTargetBorder(BorderStyle.MINIMAL)
                            .withTargetHeight(500)
                            .withTargetWidth(500)
                            .withTargetName("_blank");

    assertEquals("My link", link.getCaption());
    assertEquals(resource, link.getResource());
    assertEquals(BorderStyle.MINIMAL, link.getTargetBorder());
    assertEquals(500, link.getTargetHeight());
    assertEquals(500, link.getTargetWidth());
    assertEquals("_blank", link.getTargetName());
}
 
開發者ID:viydaag,項目名稱:vaadin-fluent-api,代碼行數:18,代碼來源:FLinkTest.java

示例3: testAudio

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
@Test
public void testAudio() {
    final Resource audioResource = new ExternalResource(
            "http://mirrors.creativecommons.org/ccmixter/contrib/Wired/The%20Rapture%20-%20Sister%20Saviour%20(Blackstrobe%20Remix).mp3");
    FAudio audio = new FAudio().withAltText("alt")
                               .withAutoplay(true)
                               .withCaption("My audio")
                               .withHtmlContentAllowed(true)
                               .withMuted(true)
                               .withLoop(true)
                               .withPreload(PreloadMode.METADATA)
                               .withSource(audioResource)
                               .withShowControls(true);

    assertEquals("alt", audio.getAltText());
    assertEquals("My audio", audio.getCaption());
    assertTrue(audio.isAutoplay());
    assertTrue(audio.isHtmlContentAllowed());
    assertTrue(audio.isShowControls());
    assertTrue(audio.isLoop());
    assertTrue(audio.isMuted());
    assertEquals(PreloadMode.METADATA, audio.getPreload());
    assertEquals(audioResource, audio.getSources().get(0));

}
 
開發者ID:viydaag,項目名稱:vaadin-fluent-api,代碼行數:26,代碼來源:FluentMediaTest.java

示例4: buildMovieDetails

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
private Component buildMovieDetails(final Movie movie,
        final Date startTime, final Date endTime) {
    HorizontalLayout details = new HorizontalLayout();
    details.setWidth(100.0f, Unit.PERCENTAGE);
    details.addStyleName(ValoTheme.LAYOUT_HORIZONTAL_WRAPPING);
    details.setMargin(true);
    details.setSpacing(true);

    final Image coverImage = new Image(null, new ExternalResource(
            movie.getThumbUrl()));
    coverImage.addStyleName("cover");
    details.addComponent(coverImage);

    Component detailsForm = buildDetailsForm(movie, startTime, endTime);
    details.addComponent(detailsForm);
    details.setExpandRatio(detailsForm, 1);

    return details;
}
 
開發者ID:imotSpot,項目名稱:imotSpot,代碼行數:20,代碼來源:MovieDetailsWindow.java

示例5: SourceView

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
public SourceView() {

        Label caption = new Label("Sources");
        caption.addStyleName(DSTheme.LABEL_HUGE);
        addComponents(caption);

        List<Link> linkList = new ArrayList<Link>();

        Link aidedd = new Link("AideDD", new ExternalResource("http://www.aidedd.org/"));
        linkList.add(aidedd);
        Link gemmaline = new Link("Gemmaline", new ExternalResource("http://www.gemmaline.com/faerun/"));
        linkList.add(gemmaline);
        Link frwiki = new Link("Wiki des royaumes oubliés",
                new ExternalResource("https://fr.wikipedia.org/wiki/Portail:Royaumes_oubli%C3%A9s"));
        linkList.add(frwiki);

        for (Link link : linkList) {
            link.setTargetName("_blank");
            addComponent(link);
        }
    }
 
開發者ID:viydaag,項目名稱:dungeonstory-java,代碼行數:22,代碼來源:SourceView.java

示例6: WebNewWindowButton

import com.vaadin.server.ExternalResource; //導入依賴的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);
}
 
開發者ID:cuba-platform,項目名稱:cuba,代碼行數:20,代碼來源:WebNewWindowButton.java

示例7: MenuView

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
public MenuView() {
    setMargin(true);
    setSpacing(true);

    Label header = new Label("GridStack Vaadin add-on");
    header.addStyleName(ValoTheme.LABEL_H1);
    addComponent(header);

    addComponents(
            createNavigation(SimpleView.class, SimpleView.VIEW_NAME, "Simple example"),
            createNavigation(TestView.class, TestView.VIEW_NAME, "Test it"),
            createNavigation(SplitView.class, SplitView.VIEW_NAME, "List demo")
    );

    addComponent(new Link(
            "GridStack Vaadin add-on project page on GitHub",
            new ExternalResource("https://github.com/alump/GridStack")));

    addComponent(new Link(
            "This project is based on gridstack.js JavaScript library, written by Pavel Reznikov",
            new ExternalResource("https://github.com/troolee/gridstack.js")));
}
 
開發者ID:alump,項目名稱:GridStack,代碼行數:23,代碼來源:MenuView.java

示例8: showGrCodeDialog

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
/**
 * Shows QR Code dialog.
 * @param qrCodeUrl the QR code URL
 */
public static void showGrCodeDialog(final String qrCodeUrl) {
    final Window subWindow = new Window(Site.getCurrent().localize("header-scan-qr-code-with-google-authenticator"));
    subWindow.setModal(true);
    final VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);
    final Image qrCodeImage = new Image(null, new ExternalResource(qrCodeUrl));
    verticalLayout.addComponent(qrCodeImage);
    verticalLayout.setComponentAlignment(qrCodeImage, Alignment.MIDDLE_CENTER);
    subWindow.setContent(verticalLayout);
    subWindow.setResizable(false);
    subWindow.setWidth(230, Sizeable.Unit.PIXELS);
    subWindow.setHeight(260, Sizeable.Unit.PIXELS);
    subWindow.center();
    UI.getCurrent().addWindow(subWindow);
}
 
開發者ID:bubblecloud,項目名稱:ilves,代碼行數:20,代碼來源:GoogleAuthenticatorService.java

示例9: AboutWindow

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
public AboutWindow() {

        MHorizontalLayout content = new MHorizontalLayout().withMargin(true).withFullWidth();
        this.setContent(content);

        Image about = new Image("", new ExternalResource(StorageUtils.generateAssetRelativeLink(WebResourceIds._about)));
        MVerticalLayout rightPanel = new MVerticalLayout();
        ELabel versionLbl = ELabel.h2(String.format("MyCollab Community Edition %s", Version.getVersion()));
        Label javaNameLbl = new Label(String.format("%s, %s", System.getProperty("java.vm.name"),
                System.getProperty("java.runtime.version")));
        Label homeFolderLbl = new Label("Home folder: " + FileUtils.getHomeFolder().getAbsolutePath());
        WebBrowser browser = Page.getCurrent().getWebBrowser();
        Label osLbl = new Label(String.format("%s, %s", System.getProperty("os.name"),
                browser.getBrowserApplication()));
        osLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
        Div licenseDiv = new Div().appendChild(new Text("Powered by: "))
                .appendChild(new A("https://www.mycollab.com")
                        .appendText("MyCollab")).appendChild(new Text(". Open source under GPL license"));
        Label licenseLbl = ELabel.html(licenseDiv.write());
        Label copyRightLbl = ELabel.html(String.format("&copy; %s - %s MyCollab Ltd. All rights reserved", "2011",
                new GregorianCalendar().get(Calendar.YEAR) + ""));
        rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl)
                .withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
        content.with(about, rightPanel).expand(rightPanel);
    }
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:26,代碼來源:AboutWindow.java

示例10: projectLogoComp

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
public static Component projectLogoComp(String projectShortname, Integer projectId, String projectAvatarId, int size) {
    AbstractComponent wrapper;
    if (!StringUtils.isBlank(projectAvatarId)) {
        wrapper = new Image(null, new ExternalResource(StorageUtils.getResourcePath
                (String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(AppUI.getAccountId(), projectId),
                        projectAvatarId, size))));
    } else {
        ELabel projectIcon = new ELabel(projectShortname).withStyleName(UIConstants.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center");
        projectIcon.setWidth(size, Sizeable.Unit.PIXELS);
        projectIcon.setHeight(size, Sizeable.Unit.PIXELS);
        wrapper = new VerticalLayout();
        ((VerticalLayout) wrapper).addComponent(projectIcon);
        ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    wrapper.addStyleName(UIConstants.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:21,代碼來源:ProjectAssetsUtil.java

示例11: clientLogoComp

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
public static Component clientLogoComp(SimpleAccount account, int size) {
    AbstractComponent wrapper;
    if (!StringUtils.isBlank(account.getAvatarid())) {
        wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI.getAccountId(), account.getAvatarid(), 100)));
    } else {
        String accountName = account.getAccountname();
        accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName;
        ELabel projectIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center");
        wrapper = new VerticalLayout();
        ((VerticalLayout) wrapper).addComponent(projectIcon);
        ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    wrapper.addStyleName(UIConstants.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:19,代碼來源:ProjectAssetsUtil.java

示例12: AccountModuleImpl

import com.vaadin.server.ExternalResource; //導入依賴的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);
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:27,代碼來源:AccountModuleImpl.java

示例13: buildComponents

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
private void buildComponents() {
    activityTabs.addTab(constructCalendarView(), "calendar",
            UserUIContext.getMessage(ActivityI18nEnum.TAB_CALENDAR_TITLE),
            new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/22/crm/calendar.png")));

    activityTabs.addTab(constructActivityListView(), "activities",
            UserUIContext.getMessage(ActivityI18nEnum.TAB_ACTIVITY_TITLE),
            new ExternalResource(StorageUtils.generateAssetRelativeLink("icons/22/crm/activitylist.png")));

    activityTabs.addSelectedTabChangeListener(selectedTabChangeEvent -> {
        Tab tab = ((VerticalTabsheet) selectedTabChangeEvent.getSource()).getSelectedTab();
        String caption = tab.getCaption();

        if (UserUIContext.getMessage(ActivityI18nEnum.TAB_CALENDAR_TITLE).equals(caption)) {
            calendarPresenter.go(ActivityRootView.this, new ActivityScreenData.GotoCalendar());
        } else if (UserUIContext.getMessage(ActivityI18nEnum.TAB_ACTIVITY_TITLE).equals(caption)) {
            ActivitySearchCriteria criteria = new ActivitySearchCriteria();
            criteria.setSaccountid(new NumberSearchField(AppUI.getAccountId()));
            eventPresenter.go(ActivityRootView.this, new ActivityScreenData.GotoActivityList(criteria));
        }
    });
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:23,代碼來源:ActivityRootView.java

示例14: accountLogoComp

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
public static Component accountLogoComp(SimpleAccount account, int size) {
    AbstractComponent wrapper;
    if (!StringUtils.isBlank(account.getAvatarid())) {
        wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI
                .getAccountId(), account.getAvatarid(), 100)));
    } else {
        String accountName = account.getAccountname();
        accountName = (accountName.length() > 3) ? accountName.substring(0, 3) : accountName;
        ELabel accountIcon = new ELabel(accountName).withStyleName(UIConstants.TEXT_ELLIPSIS, "center");
        accountIcon.setWidth(size, Sizeable.Unit.PIXELS);
        accountIcon.setHeight(size, Sizeable.Unit.PIXELS);
        wrapper = new VerticalLayout();
        ((VerticalLayout) wrapper).addComponent(accountIcon);
        ((VerticalLayout) wrapper).setComponentAlignment(accountIcon, Alignment.MIDDLE_CENTER);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    wrapper.addStyleName(UIConstants.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}
 
開發者ID:MyCollab,項目名稱:mycollab,代碼行數:22,代碼來源:CrmAssetsUtil.java

示例15: init

import com.vaadin.server.ExternalResource; //導入依賴的package包/類
@Override
protected void init(VaadinRequest request) {
	final VerticalLayout layout = new VerticalLayout();
	layout.setMargin(true);
	setContent(layout);

	ActiveLink link = new ActiveLink("Click Me", new ExternalResource(
			"http://blog.porotype.com"));
	link.addListener(new LinkActivatedListener() {

		@Override
		public void linkActivated(LinkActivatedEvent event) {
			MouseEventDetails d = event.getMouseEventDetails();
			String caption = "Link " + d.getButtonName() + "-clicked";
			String msg = "Ctrl: " + d.isCtrlKey() + " Shift: "
					+ d.isShiftKey() + " Alt: " + d.isAltKey() + " Meta: "
					+ d.isMetaKey();
			Notification.show(caption, msg, Type.WARNING_MESSAGE);
			System.err.println(caption + " " + msg);
		}
	});
	layout.addComponent(link);
}
 
開發者ID:Porotype,項目名稱:activelink,代碼行數:24,代碼來源:DemoUI.java


注:本文中的com.vaadin.server.ExternalResource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。