GUIUtility.addNewTab(stigmata.getMessages(), "wellknown", controlTab, wellknownClassses);
GUIUtility.addNewTab(stigmata.getMessages(), "classpath", controlTab, classpath);
GUIUtility.addNewTab(stigmata.getMessages(), "property", controlTab, properties);
+ controlTab.setSelectedIndex(0);
+
reset();
}
stigmata.setExpertMode(expertmode);
if(expertmode){
+ int index = controlTab.getSelectedIndex();
GUIUtility.addNewTab(stigmata.getMessages(), "definition", controlTab, definition);
GUIUtility.addNewTab(stigmata.getMessages(), "filter", controlTab, filters);
GUIUtility.addNewTab(stigmata.getMessages(), "history", controlTab, history);
+ controlTab.setSelectedIndex(index);
}
else{
removeTabByName(stigmata.getMessages().get("definition.tab.label"));
bst = BirthmarkStoreTarget.MEMORY;
}
context.setStoreTarget(bst);
-
+
return context;
}
*/
import java.awt.Component;
+import java.awt.Dimension;
import java.awt.Image;
+import java.awt.BorderLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
+import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.TitledBorder;
+import javax.swing.border.EmptyBorder;
import jp.sourceforge.talisman.i18n.Messages;
}
public static void addNewTab(Messages messages, String key, JTabbedPane tabPane, Component comp, Object[] tabnameValues, Object[] values){
+ addNewTab(messages, key, tabPane, comp, tabnameValues, values, false);
+ }
+
+ public static void addNewTab(Messages messages, String key, final JTabbedPane tabPane,
+ final Component comp, Object[] tabnameValues, Object[] values,
+ boolean closable){
String tabName = messages.get(key + ".tab.label");
String tooltip = messages.get(key + ".tab.tooltip");
Icon icon = getIcon(messages, key + ".tab.icon");
tooltip = MessageFormat.format(tooltip, values);
}
tabPane.addTab(tabName, icon, comp, tooltip);
+ tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
+ if(closable){
+ JLabel label = new JLabel(tabName);
+ if(icon != null){
+ label.setIcon(icon);
+ }
+ Icon closeIcon = getIcon(messages, "closetab.tabicon");
+ JButton button = new JButton(closeIcon);
+ button.setPreferredSize(new Dimension(closeIcon.getIconWidth(), closeIcon.getIconHeight()));
+ JPanel panel = new JPanel(new BorderLayout());
+ panel.setOpaque(false);
+ label.setBorder(new EmptyBorder(0, 0, 0, 4));
+ panel.add(label, BorderLayout.WEST);
+ panel.add(button, BorderLayout.EAST);
+ button.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e){
+ tabPane.remove(comp);
+ }
+ });
+ button.setBorder(new EmptyBorder(1, 1, 1, 1));
+ panel.setBorder(new EmptyBorder(2, 1, 1, 1));
+ tabPane.setTabComponentAt(tabPane.getTabCount() - 1, panel);
+ }
}
}
Utility.array2String(target1.getBirthmarkTypes()),
target1.getName(),
target2.getName(),
- }
+ }, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
}
public void compareRoundRobin(String[] targetX, String[] targetY,
Utility.array2String(context.getBirthmarkTypes()),
Utility.array2String(targetX),
Utility.array2String(targetY),
- }
+ }, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
} catch(Throwable e){
showExceptionMessage(e);
}
Utility.array2String(context.getBirthmarkTypes()),
Utility.array2String(targetX),
Utility.array2String(targetY),
- }
+ }, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
} catch(Throwable e){
showExceptionMessage(e);
}
Utility.array2String(context.getBirthmarkTypes()),
Utility.array2String(targetX),
Utility.array2String(targetY),
- }
+ }, true
);
tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
}catch(Throwable e){
Utility.array2String(context.getBirthmarkTypes()),
Utility.array2String(targetX),
Utility.array2String(targetY),
- }
+ }, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
}catch(Exception e){
showExceptionMessage(e);
}
GUIUtility.addNewTab(
getMessages(), "comparisonresultset", tabPane,
new PairComparisonResultSetPane(this, resultset),
- new Object[] { new Integer(comparePair), }, null
+ new Object[] { new Integer(comparePair), }, null, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
}
public void showMdsGraph(BirthmarkSet[] set, BirthmarkContext context){
int mappingGraphCount = getNextCount("mds_graph");
GUIUtility.addNewTab(
getMessages(), "mappinggraph", tabPane, panel,
- new Object[] { new Integer(mappingGraphCount), }, null
+ new Object[] { new Integer(mappingGraphCount), }, null, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
} catch(Exception e){
showExceptionMessage(e);
}
int similarityGraphCount = getNextCount("similarity_graph");
GUIUtility.addNewTab(
getMessages(), "similaritygraph", tabPane, graph,
- new Object[] { new Integer(similarityGraphCount), }, null
+ new Object[] { new Integer(similarityGraphCount), }, null, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
}
public void compareExtractionResult(ExtractionResultSet ers){
Utility.array2String(ers.getBirthmarkTypes()),
Utility.array2String(new String[0]),
Utility.array2String(new String[0]),
- }
+ }, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
}
public void showExtractionResult(ExtractionResultSet ers){
GUIUtility.addNewTab(
getMessages(), "extract", tabPane, viewer,
new Object[] { new Integer(extractCount), },
- new Object[] { Utility.array2String(ers.getBirthmarkTypes()), }
+ new Object[] { Utility.array2String(ers.getBirthmarkTypes()), }, true
);
- tabPane.setSelectedIndex(tabPane.getTabCount() - 1);
-
}
public void extract(String[] targetX, String[] targetY, BirthmarkContext context){
setTitle(getMessages().get("stigmata.frame.title"));
initComponents();
- GUIUtility.addNewTab(getMessages(), "control", tabPane, control = new ControlPane(this), null, null);
+ GUIUtility.addNewTab(getMessages(), "control", tabPane, control = new ControlPane(this), null, null, false);
control.inititalize();
tabPane.setSelectedIndex(tabPane.getTabCount() - 1);