{
final long progressSessionId = System.currentTimeMillis();
final StructureSelectionManager ssm = ap.getStructureSelectionManager();
+ final int preferredHeight = pnl_filter.getHeight();
ssm.setProgressIndicator(this);
ssm.setProgressSessionId(progressSessionId);
new Thread(new Runnable()
@Override
public void run()
{
- FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
- .getSelectedItem());
- String currentView = selectedFilterOpt.getView();
- if (currentView == VIEWS_FILTER)
- {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ String currentView = selectedFilterOpt.getView();
+ if (currentView == VIEWS_FILTER)
+ {
int pdbIdColIndex = getResultTable().getColumn("PDB Id")
.getModelIndex();
int refSeqColIndex = getResultTable().getColumn("Ref Sequence")
- .getModelIndex();
+ .getModelIndex();
int[] selectedRows = getResultTable().getSelectedRows();
- PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
- int count = 0;
- ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
- for (int row : selectedRows)
- {
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
+ ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
String pdbIdStr = getResultTable().getValueAt(row,
- pdbIdColIndex)
- .toString();
+ pdbIdColIndex).toString();
SequenceI selectedSeq = (SequenceI) getResultTable()
- .getValueAt(row,
- refSeqColIndex);
- selectedSeqsToView.add(selectedSeq);
+ .getValueAt(row, refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
if (pdbEntry == null)
{
pdbEntry = getFindEntry(pdbIdStr,
selectedSeq.getAllPDBEntries());
}
- if (pdbEntry == null)
- {
- pdbEntry = new PDBEntry();
- pdbEntry.setId(pdbIdStr);
- pdbEntry.setType(PDBEntry.Type.PDB);
- selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
- }
- pdbEntriesToView[count++] = pdbEntry;
- }
- SequenceI[] selectedSeqs = selectedSeqsToView
- .toArray(new SequenceI[selectedSeqsToView.size()]);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
+ pdbEntry.setId(pdbIdStr);
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSeq.getDatasetSequence().addPDBId(pdbEntry);
+ }
+ pdbEntriesToView[count++] = pdbEntry;
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
- }
- else if (currentView == VIEWS_LOCAL_PDB)
- {
- int[] selectedRows = tbl_local_pdb.getSelectedRows();
- PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
- int count = 0;
+ }
+ else if (currentView == VIEWS_LOCAL_PDB)
+ {
+ int[] selectedRows = tbl_local_pdb.getSelectedRows();
+ PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
+ int count = 0;
int pdbIdColIndex = tbl_local_pdb.getColumn("PDB Id")
.getModelIndex();
- int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
- .getModelIndex();
- ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
- for (int row : selectedRows)
- {
- PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
- pdbIdColIndex);
- pdbEntriesToView[count++] = pdbEntry;
- SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(row,
- refSeqColIndex);
- selectedSeqsToView.add(selectedSeq);
- }
- SequenceI[] selectedSeqs = selectedSeqsToView
- .toArray(new SequenceI[selectedSeqsToView.size()]);
+ int refSeqColIndex = tbl_local_pdb.getColumn("Ref Sequence")
+ .getModelIndex();
+ ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
+ for (int row : selectedRows)
+ {
+ PDBEntry pdbEntry = (PDBEntry) tbl_local_pdb.getValueAt(row,
+ pdbIdColIndex);
+ pdbEntriesToView[count++] = pdbEntry;
+ SequenceI selectedSeq = (SequenceI) tbl_local_pdb.getValueAt(
+ row, refSeqColIndex);
+ selectedSeqsToView.add(selectedSeq);
+ }
+ SequenceI[] selectedSeqs = selectedSeqsToView
+ .toArray(new SequenceI[selectedSeqsToView.size()]);
launchStructureViewer(ssm, pdbEntriesToView, ap, selectedSeqs);
- }
- else if (currentView == VIEWS_ENTER_ID)
- {
- SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
- .getCmb_assSeq().getSelectedItem()).getSequence();
- if (userSelectedSeq != null)
- {
- selectedSequence = userSelectedSeq;
- }
+ }
+ else if (currentView == VIEWS_ENTER_ID)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) idInputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
- String pdbIdStr = txt_search.getText();
- PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
- if (pdbEntry == null)
- {
- pdbEntry = new PDBEntry();
+ String pdbIdStr = txt_search.getText();
+ PDBEntry pdbEntry = selectedSequence.getPDBEntry(pdbIdStr);
+ if (pdbEntry == null)
+ {
+ pdbEntry = new PDBEntry();
if (pdbIdStr.split(":").length > 1)
{
pdbEntry.setId(pdbIdStr.split(":")[0]);
{
pdbEntry.setId(pdbIdStr);
}
- pdbEntry.setType(PDBEntry.Type.PDB);
- selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
- }
+ pdbEntry.setType(PDBEntry.Type.PDB);
+ selectedSequence.getDatasetSequence().addPDBId(pdbEntry);
+ }
- PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
+ PDBEntry[] pdbEntriesToView = new PDBEntry[] { pdbEntry };
launchStructureViewer(ssm, pdbEntriesToView, ap,
new SequenceI[] { selectedSequence });
- }
- else if (currentView == VIEWS_FROM_FILE)
- {
- SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
- .getCmb_assSeq().getSelectedItem()).getSequence();
- if (userSelectedSeq != null)
- {
- selectedSequence = userSelectedSeq;
- }
- PDBEntry fileEntry = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq(selectedPdbFileName,
- jalview.io.AppletFormatAdapter.FILE,
- selectedSequence, true, Desktop.instance);
+ }
+ else if (currentView == VIEWS_FROM_FILE)
+ {
+ SequenceI userSelectedSeq = ((AssociateSeqOptions) fileChooserAssSeqPanel
+ .getCmb_assSeq().getSelectedItem()).getSequence();
+ if (userSelectedSeq != null)
+ {
+ selectedSequence = userSelectedSeq;
+ }
+ PDBEntry fileEntry = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq(selectedPdbFileName,
+ jalview.io.AppletFormatAdapter.FILE,
+ selectedSequence, true, Desktop.instance);
launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
new SequenceI[] { selectedSequence });
- }
- closeAction();
+ }
+ closeAction(preferredHeight);
}
}).start();
}
if (SiftsSettings.isMapWithSifts())
{
- ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
+ List<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
int p = 0;
// TODO: skip PDBEntry:Sequence pairs where PDBEntry doesn't look like a
// real PDB ID. For moment, we can also safely do this if there is already
{
seqWithoutSrcDBRef[x++] = fSeq;
}
- new DBRefFetcher(seqWithoutSrcDBRef).fetchDBRefs(true);
+ DBRefFetcher dbRefFetcher = new DBRefFetcher(seqWithoutSrcDBRef);
+ dbRefFetcher.fetchDBRefs(true);
}
}
if (pdbEntriesToView.length > 1)
protected JScrollPane scrl_localPDB = new JScrollPane(tbl_local_pdb);
- private JTabbedPane pnl_filter = new JTabbedPane();
+ protected JTabbedPane pnl_filter = new JTabbedPane();
protected FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
PreferenceSource.STRUCTURE_CHOOSER,
@Override
public void actionPerformed(ActionEvent e)
{
- closeAction();
+ closeAction(pnl_filter.getHeight());
}
});
btn_cancel.addKeyListener(new KeyAdapter()
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
- closeAction();
+ closeAction(pnl_filter.getHeight());
}
}
});
@Override
public void internalFrameClosing(InternalFrameEvent e)
{
- closeAction();
+ closeAction(pnl_filter.getHeight());
}
});
mainFrame.setVisible(true);
Desktop.addInternalFrame(mainFrame, frameTitle, width, height);
}
- protected void closeAction()
+ protected void closeAction(int preferredHeight)
{
// System.out.println(">>>>>>>>>> closing internal frame!!!");
// System.out.println("width : " + mainFrame.getWidth());
// System.out.println("x : " + mainFrame.getX());
// System.out.println("y : " + mainFrame.getY());
tempUserPrefs.put("structureChooser.width", pnl_filter.getWidth());
- tempUserPrefs.put("structureChooser.height", pnl_filter.getHeight());
+ tempUserPrefs.put("structureChooser.height", preferredHeight);
tempUserPrefs.put("structureChooser.x", mainFrame.getX());
tempUserPrefs.put("structureChooser.y", mainFrame.getY());
mainFrame.dispose();
}
+
public boolean wantedFieldsUpdated()
{
if (previousWantedFields == null)