List of usage examples for com.vaadin.server ExternalResource ExternalResource
public ExternalResource(String sourceURL)
From source file:org.opencms.ui.apps.scheduler.CmsJobTable.java
License:Open Source License
/** * Gets the icon resource for the given workplace resource path.<p> * * @param subPath the path relative to the workplace resources * * @return the icon resource//from ww w. j a v a 2 s .c o m */ ExternalResource getIconResource(String subPath) { String resPath = CmsWorkplace.getResourceUri(subPath); return new ExternalResource(resPath); }
From source file:org.opencms.ui.apps.scheduler.CmsScheduledJobsAppConfig.java
License:Open Source License
/** * @see org.opencms.ui.apps.I_CmsWorkplaceAppConfiguration#getIcon() */// w w w . j a v a2 s . c om public Resource getIcon() { return new ExternalResource(OpenCmsTheme.getImageLink("apps/scheduler.png")); }
From source file:org.opencms.ui.CmsVaadinUtils.java
License:Open Source License
/** * Returns the available resource types container.<p> * * @return the resource types container// ww w. j a v a2s . c om */ public static IndexedContainer getResourceTypesContainer() { IndexedContainer types = new IndexedContainer(); types.addContainerProperty(PropertyId.caption, String.class, null); types.addContainerProperty(PropertyId.icon, Resource.class, null); types.addContainerProperty(PropertyId.isFolder, Boolean.class, null); types.addContainerProperty(PropertyId.isXmlContent, Boolean.class, null); for (I_CmsResourceType type : OpenCms.getResourceManager().getResourceTypes()) { CmsExplorerTypeSettings typeSetting = OpenCms.getWorkplaceManager() .getExplorerTypeSetting(type.getTypeName()); if (typeSetting != null) { Item typeItem = types.addItem(type); typeItem.getItemProperty(PropertyId.caption) .setValue(CmsVaadinUtils.getMessageText(typeSetting.getKey())); typeItem.getItemProperty(PropertyId.icon).setValue(new ExternalResource( CmsWorkplace.getResourceUri(CmsWorkplace.RES_PATH_FILETYPES + typeSetting.getIcon()))); typeItem.getItemProperty(PropertyId.isXmlContent) .setValue(Boolean.valueOf(type instanceof CmsResourceTypeXmlContent)); typeItem.getItemProperty(PropertyId.isFolder) .setValue(Boolean.valueOf(type instanceof A_CmsResourceTypeFolderBase)); } } return types; }
From source file:org.opencms.ui.CmsVaadinUtils.java
License:Open Source License
/** * Gets external resource from workplace resource folder.<p> * * @param subPath path relative to workplace resource folder * * @return the external resource// w w w . j ava 2s . co m */ public static ExternalResource getWorkplaceResource(String subPath) { return new ExternalResource(CmsWorkplace.getResourceUri(subPath)); }
From source file:org.opencms.ui.components.CmsToolBar.java
License:Open Source License
/** * Creates the user info drop down.<p> * * @return the drop down component//from ww w. ja va 2 s . co m */ private Component createUserInfoDropDown() { PopupView pv = new PopupView(new PopupView.Content() { private static final long serialVersionUID = 1L; public String getMinimizedValueAsHTML() { CmsObject cms = A_CmsUI.getCmsObject(); return getDropDownButtonHtml(new ExternalResource(OpenCms.getWorkplaceAppManager() .getUserIconHelper().getSmallIconPath(cms, cms.getRequestContext().getCurrentUser()))); } public Component getPopupComponent() { return new CmsUserInfo(new I_UploadListener() { public void onUploadFinished(List<String> uploadedFiles) { handleUpload(uploadedFiles); } }, getDialogContext()); } }); pv.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_USER_INFO_TITLE_0)); pv.addStyleName(OpenCmsTheme.NAVIGATOR_DROPDOWN); pv.setHideOnMouseOut(false); pv.addStyleName(OpenCmsTheme.USER_INFO); return pv; }
From source file:org.opencms.ui.components.CmsUserInfo.java
License:Open Source License
/** * Creates the user image button.<p> * * @return the created button/*from w ww.j av a 2 s. c o m*/ */ private Component createImageButton() { CssLayout layout = new CssLayout(); layout.addStyleName(OpenCmsTheme.USER_IMAGE); Image userImage = new Image(); userImage.setSource(new ExternalResource(OpenCms.getWorkplaceAppManager().getUserIconHelper() .getBigIconPath(A_CmsUI.getCmsObject(), m_user))); layout.addComponent(userImage); if (!CmsAppWorkplaceUi.isOnlineProject()) { CmsUploadButton uploadButton = createImageUploadButton(null, FontOpenCms.UPLOAD_SMALL, m_user, m_uploadListener); layout.addComponent(uploadButton); if (CmsUserIconHelper.hasUserImage(m_user)) { Button deleteButton = new Button(FontOpenCms.TRASH_SMALL); deleteButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { OpenCms.getWorkplaceAppManager().getUserIconHelper() .deleteUserImage(A_CmsUI.getCmsObject()); m_context.updateUserInfo(); } }); layout.addComponent(deleteButton); } } return layout; }
From source file:org.opencms.ui.dataview.CmsColumnValueConverter.java
License:Open Source License
/** * Gets the actual column value for the given data value.<p> * * @param value the data value// w w w. j a va 2 s . co m * @param type the column type enum * * @return the actual column value to use */ public static Object getColumnValue(Object value, CmsDataViewColumn.Type type) { if (type == Type.imageType) { Image image = new Image("", new ExternalResource((String) value)); image.addStyleName("o-table-image"); return image; } else { return value; } }
From source file:org.opencms.ui.dialogs.history.diff.CmsImageDiff.java
License:Open Source License
/** * @see org.opencms.ui.dialogs.history.diff.I_CmsDiffProvider#diff(org.opencms.file.CmsObject, org.opencms.gwt.shared.CmsHistoryResourceBean, org.opencms.gwt.shared.CmsHistoryResourceBean) *//* w w w. jav a 2 s . c o m*/ public Optional<Component> diff(CmsObject cms, CmsHistoryResourceBean v1, CmsHistoryResourceBean v2) throws CmsException { CmsResource r1 = A_CmsAttributeDiff.readResource(cms, v1); if (OpenCms.getResourceManager().matchResourceType(CmsResourceTypeImage.getStaticTypeName(), r1.getTypeId())) { HorizontalLayout hl = new HorizontalLayout(); hl.setSpacing(true); String v1Param = v1.getVersion().getVersionNumber() != null ? "" + v1.getVersion().getVersionNumber() : "" + CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION; String v2Param = v2.getVersion().getVersionNumber() != null ? "" + v2.getVersion().getVersionNumber() : "" + CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION; String link1 = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, CmsHistoryListUtil.getHistoryLink(cms, v1.getStructureId(), v1Param)); String link2 = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, CmsHistoryListUtil.getHistoryLink(cms, v2.getStructureId(), v2Param)); int scaleWidth = 400; int scaleHeight = (2 * scaleWidth) / 3; final String scaleParams = "w:" + scaleWidth + ",h:" + scaleHeight + ",t:1"; // scale type 1 for thumbnails (no enlargement) link1 = CmsRequestUtil.appendParameter(link1, "__scale", scaleParams); link2 = CmsRequestUtil.appendParameter(link2, "__scale", scaleParams); Image img1 = new Image("", new ExternalResource(link1)); Image img2 = new Image("", new ExternalResource(link2)); for (Image img : new Image[] { img1, img2 }) { img.setWidth("" + scaleWidth + "px"); } img1.setCaption("V1"); img2.setCaption("V2"); hl.addComponent(img1); hl.addComponent(img2); Panel result = new Panel("Image comparison"); hl.setMargin(true); result.setContent(hl); return Optional.fromNullable((Component) result); } else { return Optional.absent(); } }
From source file:org.opencms.ui.dialogs.permissions.CmsPrincipalSelect.java
License:Open Source License
/** * Opens the principal select dialog window.<p> *//*from w w w. j a v a 2 s. com*/ void openPrincipalSelect() { String parameters = "?type=" + m_widgetType.name() + "&realonly=" + m_realOnly + "&flags=null&action=listindependentaction&useparent=true&listaction="; if ((m_widgetType.equals(WidgetType.principalwidget) && I_CmsPrincipal.PRINCIPAL_GROUP.equals(m_principalTypeSelect.getValue())) || m_widgetType.equals(WidgetType.groupwidget)) { parameters += "iag"; } else { parameters += "iau"; } BrowserFrame selectFrame = new BrowserFrame("Select principal", new ExternalResource(OpenCms.getLinkManager().substituteLinkForUnknownTarget(A_CmsUI.getCmsObject(), "/system/workplace/commons/principal_selection.jsp") + parameters)); selectFrame.setWidth("100%"); selectFrame.setHeight("500px"); CmsBasicDialog dialog = new CmsBasicDialog(); dialog.setContent(selectFrame); m_window = CmsBasicDialog.prepareWindow(); m_window.setCaption(CmsVaadinUtils.getMessageText( org.opencms.workplace.commons.Messages.GUI_PRINCIPALSELECTION_LIST_ACTION_SELECT_NAME_0)); m_window.setContent(dialog); A_CmsUI.get().addWindow(m_window); CmsPrincipalSelectExtension.getInstance().setCurrentSelect(this); }
From source file:org.opencms.ui.editors.A_CmsFrameEditor.java
License:Open Source License
/** * @see org.opencms.ui.editors.I_CmsEditor#initUI(org.opencms.ui.apps.I_CmsAppUIContext, org.opencms.file.CmsResource, java.lang.String) *///from w ww . j a v a 2 s .c o m public void initUI(I_CmsAppUIContext context, CmsResource resource, String backLink) { m_resource = resource; CmsObject cms = A_CmsUI.getCmsObject(); String sitepath = cms.getSitePath(m_resource); String link = OpenCms.getLinkManager().substituteLinkForRootPath(cms, getEditorUri()); m_frame = new CmsBrowserFrame(); m_frame.setDescription("Editor"); m_frame.setName("edit"); m_frame.setSource(new ExternalResource(link + "?resource=" + sitepath + "&backlink=" + backLink)); m_frame.setSizeFull(); context.showInfoArea(false); context.hideToolbar(); m_frame.addStyleName("o-editor-frame"); context.setAppContent(m_frame); context.setAppTitle(CmsVaadinUtils.getMessageText(Messages.GUI_CONTENT_EDITOR_TITLE_2, resource.getName(), CmsResource.getParentFolder(sitepath))); m_editorState = new CmsEditorStateExtension(m_frame); }