X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FFeatureSettings.java;h=961ff14dd633637db1e36f578817e40f70a61a4f;hb=728cc74b3df1bfb78de1a2a42c3ca81fe6e89c89;hp=a5585ceb4dad8b65116f7133851361a4a056fdbe;hpb=74393b51f368cb9f58589472d432a433d9c4386d;p=jalview.git diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index a5585ce..961ff14 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -20,10 +20,13 @@ */ package jalview.gui; +import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewportI; import jalview.api.FeatureColourI; import jalview.api.FeatureSettingsControllerI; +import jalview.api.SplitContainerI; import jalview.api.ViewStyleI; +import jalview.controller.FeatureSettingsControllerGuiI; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import jalview.datamodel.features.FeatureMatcher; @@ -112,7 +115,7 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; public class FeatureSettings extends JPanel - implements FeatureSettingsControllerI + implements FeatureSettingsControllerI, FeatureSettingsControllerGuiI { private static final String SEQUENCE_FEATURE_COLOURS = MessageManager .getString("label.sequence_feature_colours"); @@ -161,10 +164,6 @@ public class FeatureSettings extends JPanel JSlider transparency = new JSlider(); - JCheckBox showComplement; - - JCheckBox showComplementOnTop; - /* * when true, constructor is still executing - so ignore UI events */ @@ -286,7 +285,8 @@ public class FeatureSettings extends JPanel @Override public void mousePressed(MouseEvent evt) { - selectedRow = table.rowAtPoint(evt.getPoint()); + Point pt = evt.getPoint(); + selectedRow = table.rowAtPoint(pt); String type = (String) table.getValueAt(selectedRow, TYPE_COLUMN); if (evt.isPopupTrigger()) { @@ -294,13 +294,15 @@ public class FeatureSettings extends JPanel popupSort(selectedRow, type, colour, fr.getMinMax(), evt.getX(), evt.getY()); } - else if (evt.getClickCount() == 2) + else if (evt.getClickCount() == 2 + && table.columnAtPoint(pt) == TYPE_COLUMN) { boolean invertSelection = evt.isAltDown(); boolean toggleSelection = Platform.isControlDown(evt); boolean extendSelection = evt.isShiftDown(); fr.ap.alignFrame.avc.markColumnsContainingFeatures( invertSelection, extendSelection, toggleSelection, type); + fr.ap.av.sendSelection(); } } @@ -357,7 +359,6 @@ public class FeatureSettings extends JPanel } discoverAllFeatureData(); - final PropertyChangeListener change; final FeatureSettings fs = this; fr.addPropertyChangeListener(change = new PropertyChangeListener() { @@ -374,37 +375,60 @@ public class FeatureSettings extends JPanel } }); - - frame = new JInternalFrame(); - frame.setContentPane(this); - if (Platform.isAMac()) + SplitContainerI splitframe = af.getSplitViewContainer(); + if (splitframe != null) { - Desktop.addInternalFrame(frame, - MessageManager.getString("label.sequence_feature_settings"), - 600, 480); + frame = null; // keeps eclipse happy + splitframe.addFeatureSettingsUI(this); } else { - Desktop.addInternalFrame(frame, - MessageManager.getString("label.sequence_feature_settings"), - 600, 450); - } - frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); + frame = new JInternalFrame(); + frame.setContentPane(this); + if (Platform.isAMac()) + { + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 600, 480); + } + else + { + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 600, 450); + } + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); - frame.addInternalFrameListener( - new javax.swing.event.InternalFrameAdapter() - { - @Override - public void internalFrameClosed( - javax.swing.event.InternalFrameEvent evt) + frame.addInternalFrameListener( + new javax.swing.event.InternalFrameAdapter() { - fr.removePropertyChangeListener(change); - }; - }); - frame.setLayer(JLayeredPane.PALETTE_LAYER); + @Override + public void internalFrameClosed( + javax.swing.event.InternalFrameEvent evt) + { + featureSettings_isClosed(); + }; + }); + frame.setLayer(JLayeredPane.PALETTE_LAYER); + } inConstruction = false; } + PropertyChangeListener change; + + @Override + public AlignViewControllerGuiI getAlignframe() + { + return af; + } + + @Override + public void featureSettings_isClosed() + { + fr.removePropertyChangeListener(change); + change = null; + } + protected void popupSort(final int rowSelected, final String type, final Object typeCol, final Map minmax, int x, int y) @@ -453,6 +477,7 @@ public class FeatureSettings extends JPanel { fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false, false, type); + fr.ap.av.sendSelection(); } }); JMenuItem clearCols = new JMenuItem(MessageManager @@ -464,6 +489,7 @@ public class FeatureSettings extends JPanel { fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false, false, type); + fr.ap.av.sendSelection(); } }); JMenuItem hideCols = new JMenuItem( @@ -474,6 +500,7 @@ public class FeatureSettings extends JPanel public void actionPerformed(ActionEvent arg0) { fr.ap.alignFrame.hideFeatureColumns(type, true); + fr.ap.av.sendSelection(); } }); JMenuItem hideOtherCols = new JMenuItem( @@ -484,6 +511,7 @@ public class FeatureSettings extends JPanel public void actionPerformed(ActionEvent arg0) { fr.ap.alignFrame.hideFeatureColumns(type, false); + fr.ap.av.sendSelection(); } }); men.add(selCols); @@ -1080,7 +1108,16 @@ public class FeatureSettings extends JPanel { try { - frame.setClosed(true); + if (frame != null) + { + frame.setClosed(true); + } + else + { + SplitContainerI sc = af.getSplitViewContainer(); + sc.closeFeatureSettings(this); + af.featureSettings = null; + } } catch (Exception exe) { } @@ -1275,8 +1312,12 @@ public class FeatureSettings extends JPanel MessageManager.getString("label.transparency_tip")); boolean nucleotide = af.getViewport().getAlignment().isNucleotide(); - showComplement = new JCheckBox( - "Show " + (nucleotide ? "protein" : "CDS") + " features"); + String text = MessageManager.formatMessage("label.show_linked_features", + nucleotide + ? MessageManager.getString("label.protein") + .toLowerCase() + : "CDS"); + JCheckBox showComplement = new JCheckBox(text); showComplement.setSelected(af.getViewport().isShowComplementFeatures()); showComplement.addActionListener(new ActionListener() { @@ -1289,7 +1330,8 @@ public class FeatureSettings extends JPanel } }); - showComplementOnTop = new JCheckBox("on top"); + JCheckBox showComplementOnTop = new JCheckBox( + MessageManager.getString("label.on_top")); showComplementOnTop .setSelected(af.getViewport().isShowComplementFeaturesOnTop()); showComplementOnTop.addActionListener(new ActionListener() @@ -1302,7 +1344,38 @@ public class FeatureSettings extends JPanel refreshDisplay(); } }); - + // JButton viewComplementSettings = new JButton(MessageManager + // .formatMessage("label.show_linked_feature_settings", + // nucleotide + // ? MessageManager.getString("label.protein") + // .toLowerCase() + // : "CDS")); + // viewComplementSettings.addActionListener(new ActionListener() + // { + // + // @Override + // public void actionPerformed(ActionEvent e) + // { + // AlignViewControllerGuiI complAf = af.getSplitViewContainer() + // .getComplementAlignFrame(af); + // FeatureSettings complFeatureSettings = (FeatureSettings) complAf + // .getFeatureSettingsUI(); + // if (complFeatureSettings != null) + // { + // complFeatureSettings.frame.setVisible(true); + // try + // { + // complFeatureSettings.frame.setSelected(true); + // return; + // } catch (Exception q) + // { + // } + // } + // { + // complAf.showFeatureSettingsUI(); + // } + // } + // }); JPanel lowerPanel = new JPanel(new GridLayout(1, 2)); bigPanel.add(lowerPanel, BorderLayout.SOUTH); @@ -1315,7 +1388,7 @@ public class FeatureSettings extends JPanel boolean hasComplement = af.getViewport().getCodingComplement() != null; JPanel transPanelLeft = new JPanel( - new GridLayout(hasComplement ? 3 : 2, 1)); + new GridLayout(hasComplement ? 4 : 2, 1)); transPanelLeft.add(new JLabel(" Colour transparency" + ":")); transPanelLeft.add(transparency); if (hasComplement)