Files
Opis/mcp/mobius/opis/api/TabPanelRegistrar.java
T
ProfMobius 486abcb4bb Tabs are now dynamically added at runtime by the client Proxy.
They can be registered and will be displayed in the order requested.
They can be retrieved by a name provided using the ITabPanel interface.
2014-03-31 17:07:00 +02:00

35 lines
810 B
Java

package mcp.mobius.opis.api;
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.JPanel;
import mcp.mobius.opis.swing.SwingUI;
public enum TabPanelRegistrar {
INSTANCE;
private ArrayList<ITabPanel> panels = new ArrayList<ITabPanel>();
private HashMap<String, ITabPanel> lookup = new HashMap<String, ITabPanel>();
public ITabPanel registerTab(ITabPanel panel){
this.panels.add(panel);
this.lookup.put(panel.getTabRefName(), panel);
SwingUI.instance().getTabbedPane().addTab(panel.getTabTitle(), (JPanel)panel);
return panel;
}
public ITabPanel getTab(String refname){
return lookup.get(refname);
}
public JPanel getTabAsPanel(String refname){
return (JPanel)lookup.get(refname);
}
public ArrayList<ITabPanel> getTabs(){
return this.panels;
}
}