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

- The "show view" action also selects the view (seems coherent with JAVAAPI-132)

- VlDockView.select() now works as expected (JAVAAPI-132)
- Minor code cleaning
parent e81d66ac
Branches
Tags
No related merge requests found
...@@ -25,9 +25,9 @@ import fr.soleil.docking.vl.view.VlDockView; ...@@ -25,9 +25,9 @@ import fr.soleil.docking.vl.view.VlDockView;
public class SoleilDockingDesktop extends DockingDesktop { public class SoleilDockingDesktop extends DockingDesktop {
private static final long serialVersionUID = -2283595226822086501L; private static final long serialVersionUID = -6192752805034560434L;
protected Map<String, RelativeDockablePosition> closedPositions = new HashMap<String, RelativeDockablePosition>(); protected final Map<String, RelativeDockablePosition> closedPositions;
protected boolean closeEnabled; protected boolean closeEnabled;
protected boolean autoHideEnabled; protected boolean autoHideEnabled;
...@@ -40,17 +40,17 @@ public class SoleilDockingDesktop extends DockingDesktop { ...@@ -40,17 +40,17 @@ public class SoleilDockingDesktop extends DockingDesktop {
public SoleilDockingDesktop(boolean close, boolean autoHide, boolean maximize, boolean floating) { public SoleilDockingDesktop(boolean close, boolean autoHide, boolean maximize, boolean floating) {
super(); super();
closedPositions = new HashMap<>();
closeEnabled = close; closeEnabled = close;
autoHideEnabled = autoHide; autoHideEnabled = autoHide;
maximizeEnabled = maximize; maximizeEnabled = maximize;
floatingEnabled = floating; floatingEnabled = floating;
addDockingActionListener(generateDockingActionListener()); addDockingActionListener(generateDockingActionListener());
addDockableSelectionListener(new DockableSelectionListener() { addDockableSelectionListener(new DockableSelectionListener() {
@Override @Override
public void selectionChanged(DockableSelectionEvent arg0) { public void selectionChanged(DockableSelectionEvent dse) {
if (arg0.getSelectedDockable() instanceof VlDockView) { if (dse.getSelectedDockable() instanceof VlDockView) {
((VlDockView) arg0.getSelectedDockable()).focusGained(null); ((VlDockView) dse.getSelectedDockable()).focusGained(null);
} }
} }
}); });
...@@ -92,12 +92,13 @@ public class SoleilDockingDesktop extends DockingDesktop { ...@@ -92,12 +92,13 @@ public class SoleilDockingDesktop extends DockingDesktop {
public void showDockable(Dockable dockable) { public void showDockable(Dockable dockable) {
DockableState state = getDockableState(dockable); DockableState state = getDockableState(dockable);
if (state == null || Location.CLOSED.equals(state.getLocation()) || Location.HIDDEN.equals(state.getLocation())) { if (state == null || Location.CLOSED.equals(state.getLocation())
|| Location.HIDDEN.equals(state.getLocation())) {
RelativeDockablePosition position = getPositionForClosedView(dockable); RelativeDockablePosition position = getPositionForClosedView(dockable);
if (position != null) { if (position == null) {
addDockable(dockable, position);
} else {
addDockable(dockable); addDockable(dockable);
} else {
addDockable(dockable, position);
} }
} }
} }
......
...@@ -21,6 +21,8 @@ import com.vldocking.swing.docking.DockKey; ...@@ -21,6 +21,8 @@ import com.vldocking.swing.docking.DockKey;
import com.vldocking.swing.docking.Dockable; import com.vldocking.swing.docking.Dockable;
import com.vldocking.swing.docking.DockableState; import com.vldocking.swing.docking.DockableState;
import com.vldocking.swing.docking.DockableState.Location; import com.vldocking.swing.docking.DockableState.Location;
import com.vldocking.swing.docking.DockingUtilities;
import com.vldocking.swing.docking.TabbedDockableContainer;
import com.vldocking.swing.docking.event.DockingActionCloseEvent; import com.vldocking.swing.docking.event.DockingActionCloseEvent;
import com.vldocking.swing.docking.event.DockingActionEvent; import com.vldocking.swing.docking.event.DockingActionEvent;
import com.vldocking.swing.docking.event.DockingActionListener; import com.vldocking.swing.docking.event.DockingActionListener;
...@@ -110,9 +112,13 @@ public class VlDockView implements IView, Dockable, DockingActionListener, Focus ...@@ -110,9 +112,13 @@ public class VlDockView implements IView, Dockable, DockingActionListener, Focus
@Override @Override
public void select() { public void select() {
setVisible(true); setVisible(true);
// TODO Doesn't work !!!!!!
focus(component, true); focus(component, true);
focusGained(new FocusEvent(component, FocusEvent.FOCUS_GAINED)); focusGained(new FocusEvent(component, FocusEvent.FOCUS_GAINED));
// Following code is the one that really works
TabbedDockableContainer tabbedDockableContainer = DockingUtilities.findTabbedDockableContainer(this);
if (tabbedDockableContainer != null) {
tabbedDockableContainer.setSelectedDockable(this);
}
} }
protected static boolean focus(Component comp, boolean forceFocus) { protected static boolean focus(Component comp, boolean forceFocus) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment