currParPath = JcrUtils.parentPath(currNodePath);
if ("".equals(currParPath))
currParPath = "/";
+
+
+
Object[][] colMatrix = new Object[browserCols.size()][2];
((FilterEntitiesVirtualTable) colMatrix[l][1]).dispose();
}
+ // Remove disposed columns
+ // TODO investigate and fix the mechanism that leave them there after
+ // disposal
+ if (browserCols.containsKey(currNodePath)) {
+ FilterEntitiesVirtualTable currCol = browserCols.get(currNodePath);
+ if (currCol.isDisposed())
+ browserCols.remove(currNodePath);
+ }
+
if (!browserCols.containsKey(currNodePath))
createBrowserColumn(colViewer, node);
private Point imageWidth = new Point(250, 0);
+ /**
+ * Recreates the content of the box that displays information about the
+ * current selected node.
+ */
private Control createNodeView(Composite parent, Node context)
throws RepositoryException {
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.widgets.Composite;
private final CmsEditable cmsEditable;
private MouseListener mouseListener;
+ private FocusListener focusListener;
private EditablePart edited;
private ISelection selection = StructuredSelection.EMPTY;
if (cmsEditable.canEdit()) {
mouseListener = createMouseListener();
+ focusListener = createFocusListener();
}
page = findPage(parent);
}
};
}
+ /** Create (retrieve) the FocusListener to use. */
+ protected FocusListener createFocusListener() {
+ return new FocusListener() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void focusLost(FocusEvent event) {
+ }
+
+ @Override
+ public void focusGained(FocusEvent event) {
+ }
+ };
+ }
+
protected Composite findPage(Composite composite) {
if (composite instanceof ScrolledPage) {
return (ScrolledPage) composite;
return mouseListener;
}
+ public FocusListener getFocusListener() {
+ return focusListener;
+ }
+
public CmsEditable getCmsEditable() {
return cmsEditable;
}
import org.argeo.cms.CmsNames;
import org.argeo.cms.util.CmsUtils;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
private Composite box;
protected MouseListener mouseListener;
+ protected FocusListener focusListener;
private Boolean editing = Boolean.FALSE;
clear(false);
control = createControl(box, style);
setControlLayoutData(control);
+
+ // add the focus listener to the newly created edition control
+ if (focusListener != null)
+ control.addFocusListener(focusListener);
}
public synchronized void stopEditing() {
if (control != null && this.mouseListener != null)
control.addMouseListener(mouseListener);
}
+
+ public void setFocusListener(FocusListener focusListener) {
+ if (this.focusListener != null && control != null)
+ control.removeFocusListener(this.focusListener);
+ this.focusListener = focusListener;
+ if (control != null && this.focusListener != null)
+ control.addFocusListener(focusListener);
+ }
}