import java.io.IOException;
import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import javax.jcr.security.Privilege;
import javax.jcr.version.VersionManager;
-import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.argeo.cms.auth.LoginRequiredException;
import org.argeo.cms.internal.ImageManagerImpl;
import org.argeo.cms.util.BundleResourceLoader;
import org.argeo.cms.util.CmsUtils;
+import org.argeo.cms.util.SystemNotifications;
import org.argeo.jcr.JcrUtils;
import org.eclipse.gemini.blueprint.context.BundleContextAware;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
import org.osgi.framework.BundleContext;
/** Configures an Argeo CMS RWT application. */
// ADD ENTRY POINT
//
application.addEntryPoint("/" + page, new CmsEntryPointFactory(
- pages.get(page), repository, workspace), properties);
+ pages.get(page), repository, workspace, properties),
+ properties);
log.info("Registered entry point /" + page);
}
private final CmsUiProvider page;
private final Repository repository;
private final String workspace;
+ private final Map<String, String> properties;
public CmsEntryPointFactory(CmsUiProvider page, Repository repository,
- String workspace) {
+ String workspace, Map<String, String> properties) {
this.page = page;
this.repository = repository;
this.workspace = workspace;
+ this.properties = properties;
}
@Override
public EntryPoint create() {
CmsEntryPoint entryPoint = new CmsEntryPoint(repository, workspace,
- page);
+ page, properties);
entryPoint.setState("");
CmsSession.current.set(entryPoint);
return entryPoint;
private final CmsUiProvider uiProvider;
public CmsEntryPoint(Repository repository, String workspace,
- CmsUiProvider uiProvider) {
- super(repository, workspace);
+ CmsUiProvider uiProvider, Map<String, String> factoryProperties) {
+ super(repository, workspace, factoryProperties);
this.uiProvider = uiProvider;
}
protected void refreshBody() {
if (bodyArea == null)
return;
- // clear
- for (Control child : bodyArea.getChildren())
- child.dispose();
- bodyArea.setLayout(CmsUtils.noSpaceGridLayout());
-
// Exception
Throwable exception = getException();
if (exception != null) {
- new Label(bodyArea, SWT.NONE).setText("Unreachable state : "
- + getState());
- if (getNode() != null)
- new Label(bodyArea, SWT.NONE).setText("Context : "
- + getNode());
-
- Text errorText = new Text(bodyArea, SWT.MULTI | SWT.H_SCROLL
- | SWT.V_SCROLL);
- errorText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- true));
- StringWriter sw = new StringWriter();
- exception.printStackTrace(new PrintWriter(sw));
- errorText.setText(sw.toString());
- IOUtils.closeQuietly(sw);
+ // new Label(bodyArea, SWT.NONE).setText("Unreachable state : "
+ // + getState());
+ // if (getNode() != null)
+ // new Label(bodyArea, SWT.NONE).setText("Context : "
+ // + getNode());
+ //
+ // Text errorText = new Text(bodyArea, SWT.MULTI | SWT.H_SCROLL
+ // | SWT.V_SCROLL);
+ // errorText.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
+ // true,
+ // true));
+ // StringWriter sw = new StringWriter();
+ // exception.printStackTrace(new PrintWriter(sw));
+ // errorText.setText(sw.toString());
+ // IOUtils.closeQuietly(sw);
+ SystemNotifications systemNotifications = new SystemNotifications(
+ bodyArea);
+ systemNotifications.notifyException(exception);
resetException();
+ return;
// TODO report
- } else {
- String state = getState();
- try {
- if (state == null)
- throw new CmsException("State cannot be null");
- uiProvider.createUi(bodyArea, getNode());
- } catch (RepositoryException e) {
- throw new CmsException("Cannot refresh body", e);
- }
}
+
+ // clear
+ for (Control child : bodyArea.getChildren())
+ child.dispose();
+ bodyArea.setLayout(CmsUtils.noSpaceGridLayout());
+
+ String state = getState();
+ try {
+ if (state == null)
+ throw new CmsException("State cannot be null");
+ uiProvider.createUi(bodyArea, getNode());
+ } catch (RepositoryException e) {
+ throw new CmsException("Cannot refresh body", e);
+ }
+
bodyArea.layout(true, true);
}