@Override protected Div createMainArea() { final Div ret = new Div(); UITools.maximize(ret); final BrowserModel model = getModel(); if (model instanceof DefaultLiveEditBrowserModel) { final DefaultLiveEditBrowserModel liveEditBrowserModel = (DefaultLiveEditBrowserModel) model; this.liveEditView = newDefaultLiveEditView(liveEditBrowserModel); this.liveEditView.getViewComponent().setParent(ret); } else { ret.appendChild(new Label(Labels.getLabel(EMPTY_MESSAGE))); } return ret; }
@Override protected void createAdditionalRightCaptionComponents(final Hbox hbox) { UITools.detachChildren(hbox); final BrowserModel browserModel = getModel(); if (browserModel instanceof DefaultLiveEditBrowserModel) { final DefaultLiveEditBrowserModel liveEditBrowserModel = (DefaultLiveEditBrowserModel) getModel(); if (liveEditBrowserModel.getActiaveCatalogVersion() != null) { final UIBrowserArea area = getModel().getArea(); if (area instanceof DefaultLiveEditBrowserArea) { final DefaultLiveEditBrowserArea liveEditArea = (DefaultLiveEditBrowserArea) area; final boolean liveEditModeEnabled = liveEditArea.isLiveEditModeEnabled(); // Live edit button createRightCaptionButton( Labels.getLabel(liveEditModeEnabled ? "browser.liveEditOn" : "browser.liveEditOff"), (liveEditModeEnabled ? "btnliveeditcontent_quickedit_active" : "btnliveeditcontent_quickedit"), hbox, new org.zkoss.zk.ui.event.EventListener() { @Override public void onEvent(final Event event) throws Exception // NOPMD: ZK Specific { liveEditArea.fireModeChange(); } }); final boolean isPreviewDataActive = liveEditBrowserModel.isPreviewDataVisible(); // Preview context button createRightCaptionButton( Labels.getLabel("browser.previewData"), (isPreviewDataActive ? "btnliveeditcontent_previewcontext_active" : "btnliveeditcontent_previewcontext"), hbox, new org.zkoss.zk.ui.event.EventListener() { @Override public void onEvent(final Event event) throws Exception // NOPMD: ZK Specific { liveEditBrowserModel.fireTogglePreviewDataMode( DefaultLiveEditContentBrowser.this); } }); final String sitePk = getCmsAdminSiteService().getActiveSite().getPk().toString(); final String catalogPk = getCmsAdminSiteService().getActiveCatalogVersion().getPk().toString(); // Open in page edit button if (StringUtils.isNotBlank(liveEditBrowserModel.getRelatedPagePk())) { createRightCaptionButton( Labels.getLabel("browser.openInPageEdit"), "btnliveeditcontent_pageedit", hbox, new org.zkoss.zk.ui.event.EventListener() { @Override public void onEvent(final Event event) throws Exception // NOPMD: ZK Specific { final StringBuilder urlBuilder = new StringBuilder(); urlBuilder.append("?").append(PERSP_TAG); urlBuilder.append("=").append(PAGE_VIEW_PERSPECTIVE_ID); urlBuilder.append("&").append(EVENTS_TAG); urlBuilder.append("=").append(CMS_NAVIGATION_EVENT); urlBuilder.append("&").append(CMS_PNAV_SITE); urlBuilder.append("=").append(sitePk); urlBuilder.append("&").append(CMS_PNAV_CATALOG); urlBuilder.append("=").append(catalogPk); urlBuilder.append("&").append(CMS_PNAV_PAGE); urlBuilder.append("=").append(liveEditBrowserModel.getRelatedPagePk()); if (LOG.isDebugEnabled()) { LOG.debug("URL for Open in Page edit event: " + urlBuilder.toString()); } Executions.getCurrent().sendRedirect(urlBuilder.toString()); } }); } } } } }