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
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,9 @@ import fr.soleil.docking.vl.view.VlDockView;
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 autoHideEnabled;
......@@ -40,17 +40,17 @@ public class SoleilDockingDesktop extends DockingDesktop {
public SoleilDockingDesktop(boolean close, boolean autoHide, boolean maximize, boolean floating) {
super();
closedPositions = new HashMap<>();
closeEnabled = close;
autoHideEnabled = autoHide;
maximizeEnabled = maximize;
floatingEnabled = floating;
addDockingActionListener(generateDockingActionListener());
addDockableSelectionListener(new DockableSelectionListener() {
@Override
public void selectionChanged(DockableSelectionEvent arg0) {
if (arg0.getSelectedDockable() instanceof VlDockView) {
((VlDockView) arg0.getSelectedDockable()).focusGained(null);
public void selectionChanged(DockableSelectionEvent dse) {
if (dse.getSelectedDockable() instanceof VlDockView) {
((VlDockView) dse.getSelectedDockable()).focusGained(null);
}
}
});
......@@ -92,12 +92,13 @@ public class SoleilDockingDesktop extends DockingDesktop {
public void showDockable(Dockable 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);
if (position != null) {
addDockable(dockable, position);
} else {
if (position == null) {
addDockable(dockable);
} else {
addDockable(dockable, position);
}
}
}
......
......@@ -21,6 +21,8 @@ import com.vldocking.swing.docking.DockKey;
import com.vldocking.swing.docking.Dockable;
import com.vldocking.swing.docking.DockableState;
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.DockingActionEvent;
import com.vldocking.swing.docking.event.DockingActionListener;
......@@ -110,9 +112,13 @@ public class VlDockView implements IView, Dockable, DockingActionListener, Focus
@Override
public void select() {
setVisible(true);
// TODO Doesn't work !!!!!!
focus(component, true);
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment