git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into features/JAL-2446NCList
[jalview.git]
/
src
/
jalview
/
gui
/
Finder.java
diff --git
a/src/jalview/gui/Finder.java
b/src/jalview/gui/Finder.java
index
21c6c8a
..
5c917ae
100755
(executable)
--- a/
src/jalview/gui/Finder.java
+++ b/
src/jalview/gui/Finder.java
@@
-42,6
+42,7
@@
import javax.swing.JComponent;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.KeyStroke;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.KeyStroke;
+import javax.swing.event.InternalFrameEvent;
/**
* Performs the menu option for searching the alignment, for the next or all
/**
* Performs the menu option for searching the alignment, for the next or all
@@
-100,11
+101,19
@@
public class Finder extends GFinder
frame = new JInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame = new JInternalFrame();
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
+ frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosing(InternalFrameEvent e)
+ {
+ closeAction();
+ }
+ });
addEscapeHandler();
Desktop.addInternalFrame(frame, MessageManager.getString("label.find"),
MY_WIDTH, MY_HEIGHT);
frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
addEscapeHandler();
Desktop.addInternalFrame(frame, MessageManager.getString("label.find"),
MY_WIDTH, MY_HEIGHT);
frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
- textfield.requestFocus();
+ searchBox.requestFocus();
}
/**
}
/**
@@
-119,19
+128,11
@@
public class Finder extends GFinder
@Override
public void actionPerformed(ActionEvent e)
{
@Override
public void actionPerformed(ActionEvent e)
{
- escapeActionPerformed();
+ closeAction();
}
});
}
}
});
}
- /**
- * Close the panel on Escape key press
- */
- protected void escapeActionPerformed()
- {
- setVisible(false);
- frame.dispose();
- }
/**
* Performs the 'Find Next' action.
/**
* Performs the 'Find Next' action.
@@
-212,7
+213,7
@@
public class Finder extends GFinder
List<SequenceI> seqs = new ArrayList<SequenceI>();
List<SequenceFeature> features = new ArrayList<SequenceFeature>();
List<SequenceI> seqs = new ArrayList<SequenceI>();
List<SequenceFeature> features = new ArrayList<SequenceFeature>();
- String searchString = textfield.getText().trim();
+ String searchString = searchBox.getEditor().getItem().toString().trim();
String desc = "Search Results";
/*
String desc = "Search Results";
/*
@@
-222,12
+223,13
@@
public class Finder extends GFinder
for (SearchResultMatchI match : searchResults.getResults())
{
seqs.add(match.getSequence().getDatasetSequence());
for (SearchResultMatchI match : searchResults.getResults())
{
seqs.add(match.getSequence().getDatasetSequence());
- features.add(new SequenceFeature(searchString, desc, null, match
+ features.add(new SequenceFeature(searchString, desc,
+ match
.getStart(), match.getEnd(), desc));
}
if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs,
.getStart(), match.getEnd(), desc));
}
if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs,
- features, true, ap, searchString))
+ features, true, ap))
{
/*
* ensure feature display is turned on to show the new features,
{
/*
* ensure feature display is turned on to show the new features,
@@
-249,7
+251,7
@@
public class Finder extends GFinder
{
createFeatures.setEnabled(false);
{
createFeatures.setEnabled(false);
- String searchString = textfield.getText().trim();
+ String searchString = searchBox.getUserInput().trim();
if (isInvalidSearchString(searchString))
{
if (isInvalidSearchString(searchString))
{
@@
-331,7
+333,7
@@
public class Finder extends GFinder
seqIndex = 0;
}
}
seqIndex = 0;
}
}
-
+ searchBox.updateCache();
}
/**
}
/**
@@
-383,4
+385,15
@@
public class Finder extends GFinder
}
return error;
}
}
return error;
}
+
+ protected void closeAction()
+ {
+ frame.setVisible(false);
+ frame.dispose();
+ searchBox.persistCache();
+ if (getFocusedViewport())
+ {
+ ap.alignFrame.requestFocus();
+ }
+ }
}
}