import javax.jcr.Repository;
import javax.jcr.RepositoryException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.argeo.cms.AbstractCmsEntryPoint;
import org.argeo.cms.CmsException;
import org.argeo.cms.CmsImageManager;
/** Simple header/body ergonomics. */
public class SimpleErgonomics extends AbstractCmsEntryPoint {
+ private final static Log log = LogFactory.getLog(SimpleErgonomics.class);
+
+ private boolean uiInitialized = false;
private Composite headerArea;
private Composite bodyArea;
private final CmsUiProvider uiProvider;
bodyArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
bodyArea.setLayout(CmsUtils.noSpaceGridLayout());
+ uiInitialized = true;
refresh();
}
@Override
protected void refresh() {
+ if (!uiInitialized)
+ return;
+ if (getState() == null)
+ setState("");
refreshHeader();
refreshBody();
+ if (log.isTraceEnabled())
+ log.trace("UI refreshed " + getNode());
}
protected void refreshHeader() {
- if (headerArea == null)
- return;
for (Control child : headerArea.getChildren())
child.dispose();
try {
}
protected void refreshBody() {
- if (bodyArea == null)
- return;
// Exception
Throwable exception = getException();
if (exception != null) {
child.dispose();
bodyArea.setLayout(CmsUtils.noSpaceGridLayout());
- String state = getState();
try {
- if (state == null)
- setState("");
- // throw new CmsException("State cannot be null");
uiProvider.createUi(bodyArea, getNode());
} catch (RepositoryException e) {
throw new CmsException("Cannot refresh body", e);