import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.KeyStroke;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
{
showInternalFrame = true;
featureSettingsPanels = new JTabbedPane();
+ featureSettingsPanels.addChangeListener(new ChangeListener()
+ {
+
+ @Override
+ public void stateChanged(ChangeEvent e)
+ {
+ if (e.getSource() != featureSettingsPanels
+ || featureSettingsUI == null
+ || featureSettingsUI.isClosed()
+ || !featureSettingsUI.isVisible())
+ {
+ // not our tabbed pane
+ return;
+ }
+ int tab = featureSettingsPanels.getSelectedIndex();
+ if (tab < 0 || featureSettingsPanels
+ .getSelectedComponent() instanceof FeatureSettingsControllerGuiI)
+ {
+ // no tab selected or already showing a feature settings GUI
+ return;
+ }
+ getAlignFrames().get(tab).showFeatureSettingsUI();
+ }
+ });
featureSettingsUI = new JInternalFrame(MessageManager.getString(
"label.sequence_feature_settings_for_CDS_and_Protein"));
featureSettingsPanels.setOpaque(true);
}
}
featureSettingsPanels = null;
+ featureSettingsUI = null;
};
});
featureSettingsUI.setLayer(JLayeredPane.PALETTE_LAYER);
}
}
- /*
- * for materialising feature settings for a tab when clicked on
- */
- private FocusListener fl1 = new FocusListener()
- {
-
- @Override
- public void focusLost(FocusEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void focusGained(FocusEvent e)
- {
- int tab = featureSettingsPanels.getSelectedIndex();
- getAlignFrames().get(tab).showFeatureSettingsUI();
- }
- };
-
/**
* tab names for feature settings
*/
for (int tabIndex = 0; tabIndex < 2; tabIndex++)
{
JPanel dummyTab = new JPanel();
- dummyTab.addFocusListener(fl1);
featureSettingsPanels.addTab(tabName[tabIndex], dummyTab);
}
}
for (int tabIndex = 0; tabIndex < 2; tabIndex++)
{
if (featureSettingsPanels.getTabCount() > tabIndex)
- {
+ {
dummyTab = featureSettingsPanels.getTabComponentAt(tabIndex);
if (dummyTab instanceof FeatureSettingsControllerGuiI
&& !dummyTab.isVisible())
- {
+ {
featureSettingsPanels.removeTabAt(tabIndex);
// close the feature Settings tab
((FeatureSettingsControllerGuiI) dummyTab)
.featureSettings_isClosed();
// create a dummy tab in its place
- dummyTab = new JPanel();
- dummyTab.addFocusListener(fl1);
+ dummyTab = new JPanel();
featureSettingsPanels.insertTab(tabName[tabIndex], null, dummyTab,
MessageManager.formatMessage(
"label.sequence_feature_settings_for",
tabName[tabIndex]),
tabIndex);
+ }
}
}
- }
}
@Override