Skip to content
Snippets Groups Projects
Commit 0ae371e5 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT Committed by Patrick MADELA
Browse files

Making an IView unclosable makes its ancestors unclosable too (JAVAAPI-211)

parent 6496377c
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ import net.infonode.docking.AbstractTabWindow;
import net.infonode.docking.DockingWindow;
import net.infonode.docking.DockingWindowListener;
import net.infonode.docking.OperationAbortedException;
import net.infonode.docking.RootWindow;
import net.infonode.docking.View;
import fr.soleil.docking.view.IView;
import fr.soleil.docking.view.IViewListener;
......@@ -29,7 +30,7 @@ import fr.soleil.docking.view.IViewListener;
*/
public class InfoNodeView extends View implements IView {
private static final long serialVersionUID = 7028633985357675678L;
private static final long serialVersionUID = 1934485690520898657L;
protected Object id;
......@@ -194,12 +195,34 @@ public class InfoNodeView extends View implements IView {
@Override
public void setClosable(boolean closable) {
if (getWindowProperties() != null) {
getWindowProperties().getTabProperties().getNormalButtonProperties().getCloseButtonProperties()
setClosable(this, closable, true);
}
/**
* Methods that allow or not a {@link DockingWindow} to be closable. If the {@link DockingWindow} is set as not
* closable, all its ancestors will be set as unclosable too.
*
* @param window The {@link DockingWindow} to set closable/unclosable
* @param closable Whether the {@link DockingWindow} should be closable
* @param updateRootWindowToo Whether to update root window properties too. Will have effect only if
* <code>closable</code> is <code>false</code>.
*/
protected static void setClosable(DockingWindow window, boolean closable, boolean updateRootWindowToo) {
if ((window != null) && (window.getWindowProperties() != null)) {
window.getWindowProperties().getTabProperties().getNormalButtonProperties().getCloseButtonProperties()
.setVisible(closable);
getWindowProperties().getTabProperties().getHighlightedButtonProperties().getCloseButtonProperties()
window.getWindowProperties().getTabProperties().getHighlightedButtonProperties().getCloseButtonProperties()
.setVisible(closable);
getWindowProperties().setCloseEnabled(closable);
window.getWindowProperties().setCloseEnabled(closable);
if (!closable) {
if (updateRootWindowToo) {
RootWindow rootWindow = window.getRootWindow();
if ((rootWindow != null) && (rootWindow.getRootWindowProperties() != null)) {
rootWindow.getRootWindowProperties().getDockingWindowProperties().setCloseEnabled(closable);
}
}
setClosable(window.getWindowParent(), closable, false);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment