Revision 43580 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/gui/DefaultViewInformationArea.java

View differences:

DefaultViewInformationArea.java
18 18

  
19 19
import java.awt.BorderLayout;
20 20
import java.util.ArrayList;
21
import java.util.Collection;
22 21
import java.util.Collections;
23 22
import java.util.Comparator;
24 23
import java.util.HashMap;
......
29 28
import javax.swing.JPanel;
30 29
import javax.swing.JTabbedPane;
31 30
import org.gvsig.tools.swing.api.Component;
31
import org.slf4j.Logger;
32
import org.slf4j.LoggerFactory;
32 33

  
33 34
/**
34 35
 *
......
36 37
 */
37 38
public class DefaultViewInformationArea implements ViewInformationArea {
38 39

  
40
    protected final Logger logger = LoggerFactory.getLogger(DefaultViewInformationArea.class);
41
    
39 42
    private static class Element implements Component {
40 43
        
41 44
        private final JComponent component;
......
78 81
    
79 82
    private final Map<String,Element> elements;
80 83
    private JPanel panel;
84
    private JTabbedPane tab;
81 85
    
82 86
    public DefaultViewInformationArea() {
83 87
        this.elements = new HashMap<>();
84 88
        this.panel = null;
89
        this.tab = null;
85 90
    }
86 91
    
87 92
    @Override
......
120 125
        JTabbedPane tab = new JTabbedPane();
121 126
        tab.setTabPlacement(JTabbedPane.BOTTOM);
122 127
        tab.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
123
        this.panel.add(tab, BorderLayout.CENTER);
124 128
        for( Element element : elements ) {
125 129
            tab.addTab(
126 130
                element.getLabel(), 
......
129 133
                element.getTip()
130 134
            );
131 135
        }
136
        int index = 0;
137
        if( this.tab != null ) { 
138
            index = this.tab.getSelectedIndex();
139
        }
140
        if( index < 0 ) {
141
            index = 0;
142
        } else if( index >= tab.getTabCount() ) {
143
            index = tab.getTabCount()-1;
144
        }
145
        try {
146
            tab.setSelectedIndex(index);
147
        } catch(Exception ex) {
148
            logger.warn("Can't restore the selected tab", ex);
149
        }
150
        this.tab = tab;
151
        this.panel.add(this.tab, BorderLayout.CENTER);
132 152
    }
133 153
    
134 154
    @Override

Also available in: Unified diff