com.vaadin.server.ExternalResource Java Examples

The following examples show how to use com.vaadin.server.ExternalResource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RDFUnitDemo.java    From RDFUnit with Apache License 2.0 6 votes vote down vote up
private void initLayoutHeader() {
    headerLayout.setWidth("100%");
    headerLayout.setHeight("80px");
    headerLayout.setId("header");

    Link rdfunit = new Link("",
            new ExternalResource("http://rdfunit.aksw.org/"));
    rdfunit.setIcon(new ThemeResource("images/logo-rdfunit.png"));

    headerLayout.addComponent(rdfunit);

    Link aksw = new Link("",
            new ExternalResource("http://aksw.org/"));
    aksw.setIcon(new ThemeResource("images/logo-aksw.png"));
    aksw.addStyleName("align-right");
    headerLayout.addComponent(aksw);
}
 
Example #2
Source File: AccountModuleImpl.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
public AccountModuleImpl() {
    addStyleName("module");
    ControllerRegistry.addController(new UserAccountController(this));

    MHorizontalLayout topPanel = new MHorizontalLayout().withFullWidth().withMargin(true).withStyleName(WebThemes.BORDER_BOTTOM).withId("tab-content-header");
    AccountSettingBreadcrumb breadcrumb = ViewManager.getCacheComponent(AccountSettingBreadcrumb.class);

    MButton helpBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_HELP))
            .withIcon(VaadinIcons.ACADEMY_CAP).withStyleName(WebThemes.BUTTON_LINK);
    ExternalResource helpRes = new ExternalResource("https://docs.mycollab.com/user-guide/account-management/");
    BrowserWindowOpener helpOpener = new BrowserWindowOpener(helpRes);
    helpOpener.extend(helpBtn);

    topPanel.with(breadcrumb, helpBtn).withAlign(helpBtn, Alignment.TOP_RIGHT);

    tabSheet = new VerticalTabsheet();
    tabSheet.getContentWrapper().addStyleName("content-height");
    tabSheet.setSizeFull();
    tabSheet.addToggleNavigatorControl();
    CssLayout contentWrapper = tabSheet.getContentWrapper();
    contentWrapper.addComponentAsFirst(topPanel);

    this.buildComponents();
    this.setContent(tabSheet);
}
 
Example #3
Source File: ProjectAssetsUtil.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
public static Component clientLogoComp(Client client, int size) {
    AbstractComponent wrapper;
    if (!StringUtils.isBlank(client.getAvatarid())) {
        wrapper = new Image(null, new ExternalResource(StorageUtils.getEntityLogoPath(AppUI.getAccountId(), client.getAvatarid(), 100)));
    } else {
        String clientName = client.getName();
        clientName = (clientName.length() > 3) ? clientName.substring(0, 3) : clientName;
        ELabel projectIcon = new ELabel(clientName).withStyleName(WebThemes.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(WebThemes.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}
 
Example #4
Source File: ProjectAssetsUtil.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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.substring(0, 1)).withStyleName(WebThemes.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center");
        projectIcon.setWidth(size, Sizeable.Unit.PIXELS);
        projectIcon.setHeight(size, Sizeable.Unit.PIXELS);
        wrapper = new MVerticalLayout(projectIcon).withAlign(projectIcon, Alignment.MIDDLE_CENTER).withMargin(false);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    wrapper.addStyleName(WebThemes.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}
 
Example #5
Source File: LoginWindow.java    From jpa-invoicer with The Unlicense 6 votes vote down vote up
@Override
public void attach() {
    super.attach();

    service = createService();
    String url = service.getAuthorizationUrl(null);
    
    gplusLoginButton = new Link("Login with Google", new ExternalResource(url));
    gplusLoginButton.addStyleName(ValoTheme.LINK_LARGE);

    VaadinSession.getCurrent().addRequestHandler(this);

    setContent(new MVerticalLayout(gplusLoginButton).alignAll(
            Alignment.MIDDLE_CENTER).withFullHeight());
    setModal(true);
    setWidth("300px");
    setHeight("200px");

}
 
Example #6
Source File: AboutWindow.java    From mycollab with GNU Affero General Public License v3.0 6 votes vote down vote up
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())).withFullWidth();
    ELabel javaNameLbl = new ELabel(String.format("%s, %s", System.getProperty("java.vm.name"),
            System.getProperty("java.runtime.version"))).withFullWidth();
    Label homeFolderLbl = new Label("Home folder: " + AppContextUtil.getSpringBean(ServerConfiguration.class).getHomeDir().getAbsolutePath());
    WebBrowser browser = Page.getCurrent().getWebBrowser();
    ELabel osLbl = new ELabel(String.format("%s, %s", System.getProperty("os.name"), browser.getBrowserApplication())).withFullWidth();
    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"));
    ELabel licenseLbl = ELabel.html(licenseDiv.write()).withFullWidth();
    Label copyRightLbl = ELabel.html(String.format("© %s - %s MyCollab Ltd. All rights reserved", "2011",
            LocalDate.now().getYear() + "")).withFullWidth();
    rightPanel.with(versionLbl, javaNameLbl, osLbl, homeFolderLbl, licenseLbl, copyRightLbl).withAlign(copyRightLbl, Alignment.BOTTOM_LEFT);
    content.with(about, rightPanel).expand(rightPanel);
}
 
Example #7
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createLoginPageLink() {
	final Link pageLink = new Link("Login", new ExternalResource(
			LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.LOGIN));
	pageLink.setId(ViewAction.VISIT_LOGIN.name());
	pageLink.setIcon(VaadinIcons.SIGN_IN);
	return pageLink;
}
 
Example #8
Source File: IntroTab.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
private void initLayout() {
    this.setMargin(true);
    this.addComponent(new Label("<h2>RDFUnit - A Unit Testing Suite for RDF</h2>", ContentMode.HTML));

    this.addComponent(new Label(
            "<p><strong>Welcome to the RDFUnit Demo</strong></p>" +
                    "<p>RDFUnit is a testing framework that can verify your data against a schema / vocabulary or custom SPARQL test cases.</p>" +
                    "<p>Please note that you cannot use all features of RDFUnit from this UI. For example, you cannot define your own tests cases or test SPARQL Endpoints directly. " +
                    "For more thorough testing please try the command line (CLI) version.</p>",
            ContentMode.HTML));

    Link homepage = new Link("Homepage", new ExternalResource("http://rdfunit.aksw.org/"));
    Link github = new Link("Github page", new ExternalResource("https://github.com/AKSW/RDFUnit"));
    Link report = new Link("Report", new ExternalResource("http://svn.aksw.org/papers/2014/WWW_Databugger/public.pdf"));

    HorizontalLayout links = new HorizontalLayout();
    this.addComponent(links);
    links.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT);
    links.addComponent(new Label("To learn more about RDFUnit you can navigate to our: &nbsp;", ContentMode.HTML));
    links.addComponent(homepage);
    links.addComponent(new Label(" / "));
    links.addComponent(github);
    links.addComponent(new Label(" / "));
    links.addComponent(report);


}
 
Example #9
Source File: TestGenerationView.java    From RDFUnit with Apache License 2.0 5 votes vote down vote up
@Override
public void sourceGenerationStarted(final Source source, TestGenerationType generationType) {
    UI.getCurrent().access(() -> {
        Link uriLink = new Link(source.getUri(), new ExternalResource(source.getUri()));
        uriLink.setTargetName("_blank");
        resultsTable.addItem(new Object[]{
                source.getClass().getSimpleName(), uriLink, new Label("-"), new Label("-")}, source);
        resultsTable.setCurrentPageFirstItemIndex(resultsTable.getCurrentPageFirstItemIndex() + 1);
        CommonAccessUtils.pushToClient();
    });


}
 
Example #10
Source File: ProjectAssetsUtil.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public static Component editableProjectLogoComp(String projectShortname, Integer projectId, String projectAvatarId, int size) {
    MCssLayout wrapper = new MCssLayout();

    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) {
        wrapper.addStyleName(WebThemes.CURSOR_POINTER);
        wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
        wrapper.addLayoutClickListener((LayoutEvents.LayoutClickListener) layoutClickEvent ->
                UI.getCurrent().addWindow(new ProjectLogoUploadWindow(projectShortname, projectId, projectAvatarId))
        );
    }

    if (!StringUtils.isBlank(projectAvatarId)) {
        Image image = new Image(null, new ExternalResource(StorageUtils.getResourcePath
                (String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(AppUI.getAccountId(), projectId),
                        projectAvatarId, size))));
        image.addStyleName(WebThemes.CIRCLE_BOX);
        wrapper.addComponent(image);
    } else {
        ELabel projectIcon = new ELabel(projectShortname.substring(0, 1)).withStyleName(WebThemes.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center", WebThemes.CIRCLE_BOX).withDescription(projectShortname);
        projectIcon.setWidth(size, Sizeable.Unit.PIXELS);
        projectIcon.setHeight(size, Sizeable.Unit.PIXELS);
        wrapper.addComponent(projectIcon);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    return wrapper;
}
 
Example #11
Source File: SOSConfigForm.java    From sensorhub with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void build(String title, MyBeanItem<? extends Object> beanItem)
{
    super.build(title, beanItem);
    
    // add link to capabilities
    Property<?> endPointProp = beanItem.getItemProperty(PROP_ENDPOINT);
    if (endPointProp != null)
    {
        String baseUrl = ((String)endPointProp.getValue()).substring(1);
        String href = baseUrl + "?service=SOS&version=2.0&request=GetCapabilities";
        Link link = new Link("Link to capabilities", new ExternalResource(href), "_blank", 0, 0, null);
        this.addComponent(link, 0);
    }
}
 
Example #12
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createUserHomeViewPageLink() {
	final Link pageLink = new Link("User account:", new ExternalResource(PAGE_PREFIX
			+ UserViews.USERHOME_VIEW_NAME));
		pageLink.setId(ViewAction.VISIT_USER_HOME_VIEW.name());
		pageLink.setIcon(VaadinIcons.USER);
		return pageLink;
}
 
Example #13
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createRegisterPageLink() {
	final Link pageLink = new Link("Register", new ExternalResource(
			LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME + PAGE_SEPARATOR + ApplicationPageMode.REGISTER));
	pageLink.setId(ViewAction.VISIT_REGISTER.name());
	pageLink.setIcon(VaadinIcons.RANDOM);
	return pageLink;
}
 
Example #14
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createPoliticianPageLink(final PersonData personData) {
	final Link pageLink = new Link(POLITICIAN
			+ personData.getFirstName() + ' '
			+ personData.getLastName(), new ExternalResource(PAGE_PREFIX
					+ UserViews.POLITICIAN_VIEW_NAME + PAGE_SEPARATOR + personData.getId()));
	pageLink.setId(ViewAction.VISIT_POLITICIAN_VIEW.name() + PAGE_SEPARATOR
			+ personData.getId());
	pageLink.setIcon(VaadinIcons.BUG);
	return pageLink;
}
 
Example #15
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createMainViewPageLink() {
	final Link pageLink = new Link(MAIN_VIEW_LINK_TEXT, new ExternalResource(
			LINK_SEPARATOR + CommonsViews.MAIN_VIEW_NAME));
	pageLink.setId(ViewAction.VISIT_MAIN_VIEW.name());
	pageLink.setIcon(VaadinIcons.STAR);
	return pageLink;
}
 
Example #16
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link createAdminPagingLink(final String label,final String page, final String pageId, final String pageNr) {
	final Link pageLink = new Link(label,
			new ExternalResource(PAGE_PREFIX + page + PAGE_SEPARATOR
					+ "[" + pageNr + "]"));
	pageLink.setId(page +"ShowPage" + PAGE_SEPARATOR
			+ pageNr);
	pageLink.setIcon(VaadinIcons.SERVER);

	return pageLink;
}
 
Example #17
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link addPartyPageLink(final ViewRiksdagenParty data) {
	final Link pageLink = new Link(PARTY + data.getPartyName(),
			new ExternalResource(PAGE_PREFIX + UserViews.PARTY_VIEW_NAME + PAGE_SEPARATOR
					+ data.getPartyId()));
	pageLink.setId(ViewAction.VISIT_PARTY_VIEW.name() + PAGE_SEPARATOR
			+ data.getPartyId());
	pageLink.setIcon(VaadinIcons.GROUP);
	return pageLink;
}
 
Example #18
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link addMinistryPageLink(final ViewRiksdagenMinistry data) {
	final Link pageLink = new Link(MINISTRY + data.getNameId(),
			new ExternalResource(PAGE_PREFIX + UserViews.MINISTRY_VIEW_NAME + PAGE_SEPARATOR
					+ data.getNameId()));
	pageLink.setId(ViewAction.VISIT_MINISTRY_VIEW.name() + PAGE_SEPARATOR
			+ data.getNameId());
	pageLink.setIcon(VaadinIcons.GROUP);
	return pageLink;
}
 
Example #19
Source File: PageLinkFactoryImpl.java    From cia with Apache License 2.0 5 votes vote down vote up
@Override
public Link addCommitteePageLink(final ViewRiksdagenCommittee data) {
	final Link pageLink = new Link(COMMITTEE
			+ data.getEmbeddedId().getDetail(), new ExternalResource(PAGE_PREFIX
					+ UserViews.COMMITTEE_VIEW_NAME + PAGE_SEPARATOR + data.getEmbeddedId().getOrgCode()));
	pageLink.setId(ViewAction.VISIT_COMMITTEE_VIEW.name() + PAGE_SEPARATOR
			+ data.getEmbeddedId().getOrgCode());
	pageLink.setIcon(VaadinIcons.GROUP);
	return pageLink;
}
 
Example #20
Source File: WebRelativePathResource.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void setMimeType(String mimeType) {
    this.mimeType = mimeType;

    if (resource != null) {
        ((ExternalResource) resource).setMIMEType(mimeType);
    }
}
 
Example #21
Source File: WebRelativePathResource.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void createResource() {
    try {
        URL context = new URL(ControllerUtils.getLocationWithoutParams());
        resource = new ExternalResource(new URL(context, path));
    } catch (MalformedURLException e) {
        throw new RuntimeException("Can't create RelativePathResource", e);
    }
}
 
Example #22
Source File: WebUrlResource.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void setMimeType(String mimeType) {
    this.mimeType = mimeType;

    if (resource != null) {
        ((ExternalResource) resource).setMIMEType(mimeType);
    }
}
 
Example #23
Source File: WebLink.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public String getUrl() {
    Resource resource = component.getResource();
    if (resource instanceof ExternalResource)
        return ((ExternalResource) resource).getURL();

    return null;
}
 
Example #24
Source File: WebLink.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void setUrl(String url) {
    component.setResource(new ExternalResource(url));
}
 
Example #25
Source File: AdminMonitoringPageModContentFactoryImpl.java    From cia with Apache License 2.0 4 votes vote down vote up
@Secured({ "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
	final VerticalLayout content = createPanelContent();

	final String pageId = getPageId(parameters);

	getMenuItemFactory().createMainPageMenuBar(menuBar);

	final BrowserFrame browser = new BrowserFrame(ADMIN_MONITORING, new ExternalResource(MONITORING_CONTEXT_PATH));
	browser.setSizeFull();

	content.addComponent(browser);
	content.setExpandRatio(browser, ContentRatio.FULL_SIZE);

	getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_MONITORING_VIEW, ApplicationEventGroup.ADMIN,
			NAME, null, pageId);

	return content;

}
 
Example #26
Source File: SPUIComponentProvider.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Method to create a link.
 *
 * @param id
 *            of the link
 * @param name
 *            of the link
 * @param resource
 *            path of the link
 * @param icon
 *            of the link
 * @param targetOpen
 *            specify how the link should be open (f. e. new windows = _blank)
 * @param style
 *            chosen style of the link. Might be {@code null} if no style should
 *            be used
 * @return a link UI component
 */
public static Link getLink(final String id, final String name, final String resource, final FontAwesome icon,
        final String targetOpen, final String style) {

    final Link link = new Link(name, new ExternalResource(resource));
    link.setId(id);
    link.setIcon(icon);
    link.setDescription(name);

    link.setTargetName(targetOpen);
    if (style != null) {
        link.setStyleName(style);
    }

    return link;

}
 
Example #27
Source File: GeneralSettingViewImpl.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
private void buildShortcutIconPanel() {
    FormContainer formContainer = new FormContainer();
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false);
    ELabel logoDesc = ELabel.html(UserUIContext.getMessage(FileI18nEnum.OPT_FAVICON_FORMAT_DESCRIPTION)).withFullWidth();
    leftPanel.with(logoDesc).withWidth("250px");
    MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false);
    final Image favIconRes = new Image("", new ExternalResource(StorageUtils.getFavIconPath(billingAccount.getId(),
            billingAccount.getFaviconpath())));

    MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(true, false, false, false));
    buttonControls.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT);
    final UploadField favIconUploadField = new UploadField() {
        private static final long serialVersionUID = 1L;

        @Override
        protected void updateDisplayComponent() {
            byte[] imageData = this.getValue();
            String mimeType = this.getLastMimeType();
            if (mimeType.equals("image/jpeg")) {
                imageData = ImageUtil.convertJpgToPngFormat(imageData);
                if (imageData == null) {
                    throw new UserInvalidInputException(UserUIContext.getMessage(FileI18nEnum.ERROR_INVALID_SUPPORTED_IMAGE_FORMAT));
                } else {
                    mimeType = "image/png";
                }
            }

            if (mimeType.equals("image/png")) {
                try {
                    AccountFavIconService favIconService = AppContextUtil.getSpringBean(AccountFavIconService.class);
                    BufferedImage image = ImageIO.read(new ByteArrayInputStream(imageData));
                    String newFavIconPath = favIconService.upload(UserUIContext.getUsername(), image, AppUI.getAccountId());
                    favIconRes.setSource(new ExternalResource(StorageUtils.getFavIconPath(billingAccount.getId(),
                            newFavIconPath)));
                    UIUtils.reloadPage();
                } catch (IOException e) {
                    throw new MyCollabException(e);
                }
            } else {
                throw new UserInvalidInputException(UserUIContext.getMessage(FileI18nEnum.ERROR_UPLOAD_INVALID_SUPPORTED_IMAGE_FORMAT));
            }
        }
    };
    favIconUploadField.setButtonCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE));
    favIconUploadField.addStyleName("upload-field");
    favIconUploadField.setSizeUndefined();
    favIconUploadField.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME));

    MButton resetButton = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> {
        BillingAccountService billingAccountService = AppContextUtil.getSpringBean(BillingAccountService.class);
        billingAccount.setFaviconpath(null);
        billingAccountService.updateWithSession(billingAccount, UserUIContext.getUsername());
        UIUtils.reloadPage();
    }).withStyleName(WebThemes.BUTTON_OPTION);
    resetButton.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME));

    buttonControls.with(resetButton, favIconUploadField);
    rightPanel.with(favIconRes, buttonControls);
    layout.with(leftPanel, rightPanel).expand(rightPanel);
    formContainer.addSection("Favicon", layout);
    this.with(formContainer);
}
 
Example #28
Source File: UrlLink.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
public UrlLink(String urlLink) {
    this.setResource(new ExternalResource(urlLink));
    this.setCaption(urlLink);
    this.setTargetName("_blank");
}
 
Example #29
Source File: WebUrlResource.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
protected void createResource() {
    resource = new ExternalResource(url);

    ((ExternalResource) resource).setMIMEType(mimeType);
}
 
Example #30
Source File: PoliticianOverviewPageModContentFactoryImpl.java    From cia with Apache License 2.0 3 votes vote down vote up
/**
 * Creates the overview content.
 *
 * @param panelContent the panel content
 * @param personData the person data
 * @param viewRiksdagenPolitician the view riksdagen politician
 * @param pageId the page id
 */
private void createOverviewContent(final VerticalLayout panelContent, final PersonData personData,
		final ViewRiksdagenPolitician viewRiksdagenPolitician, final String pageId) {
	LabelFactory.createHeader2Label(panelContent, OVERVIEW);

	final Link createPoliticianPageLink = getPageLinkFactory().createPoliticianPageLink(personData);
	panelContent.addComponent(createPoliticianPageLink);

	final Image image = new Image("",
			new ExternalResource(personData.getImageUrl192().replace("http://", "https://")));

	final HorizontalLayout horizontalLayout = new HorizontalLayout();
	horizontalLayout.setSizeFull();

	panelContent.addComponent(horizontalLayout);

	horizontalLayout.addComponent(image);

	getFormFactory().addFormPanelTextFields(horizontalLayout, viewRiksdagenPolitician,
			ViewRiksdagenPolitician.class, AS_LIST);

	final VerticalLayout overviewLayout = new VerticalLayout();
	overviewLayout.setSizeFull();

	panelContent.addComponent(overviewLayout);
	panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);

	getPoliticianMenuItemFactory().createOverviewPage(overviewLayout, pageId);

	panelContent.setExpandRatio(createPoliticianPageLink, ContentRatio.SMALL);
	panelContent.setExpandRatio(horizontalLayout, ContentRatio.GRID);

}