+ }
+
+ /**
+ * Handles action event for btn_pdbFromFile
+ */
+ @Override
+ public void pdbFromFile_actionPerformed()
+ {
+ jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+ chooser.setFileView(new jalview.io.JalviewFileView());
+ chooser.setDialogTitle(MessageManager.formatMessage(
+ "label.select_pdb_file_for",
+ selectedSequence.getDisplayId(false)));
+ chooser.setToolTipText(MessageManager.formatMessage(
+ "label.load_pdb_file_associate_with_sequence",
+ selectedSequence.getDisplayId(false)));
+
+ int value = chooser.showOpenDialog(null);
+ if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ {
+ selectedPdbFileName = chooser.getSelectedFile().getPath();
+ jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedPdbFileName);
+ validateSelections();
+ }
+ }
+
+ /**
+ * Populates the filter combo-box options dynamically depending on discovered
+ * structures
+ */
+ @Override
+ protected void populateFilterComboBox()
+ {
+ if (isStructuresDiscovered())
+ {
+ cmb_filterOption.addItem(new FilterOption("Best Quality",
+ "overall_quality", VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Most UniProt Coverage",
+ "uniprot_coverage", VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Best Resolution",
+ "resolution", VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Most Protein Chain",
+ "number_of_protein_chains", VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Most Bound Molecules",
+ "number_of_bound_molecules", VIEWS_FILTER));
+ cmb_filterOption.addItem(new FilterOption("Most Polymer Residues",
+ "number_of_polymer_residues", VIEWS_FILTER));
+ }
+ cmb_filterOption.addItem(new FilterOption("Enter PDB Id", "-",
+ VIEWS_ENTER_ID));
+ cmb_filterOption.addItem(new FilterOption("From File", "-",
+ VIEWS_FROM_FILE));
+ cmb_filterOption.addItem(new FilterOption("Cached PDB Entries", "-",
+ VIEWS_LOCAL_PDB));
+ }
+
+ /**
+ * Updates the displayed view based on the selected filter option
+ */
+ @Override
+ protected void updateCurrentView()
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ layout_switchableViews.show(pnl_switchableViews,
+ selectedFilterOpt.getView());
+ String filterTitle = mainFrame.getTitle();
+ mainFrame.setTitle(frameTitle);
+ chk_invertFilter.setVisible(false);
+ if (selectedFilterOpt.getView() == VIEWS_FILTER)
+ {
+ mainFrame.setTitle(filterTitle);
+ chk_invertFilter.setVisible(true);
+ filterResultSet(selectedFilterOpt.getValue());
+ }
+ else if (selectedFilterOpt.getView() == VIEWS_ENTER_ID
+ || selectedFilterOpt.getView() == VIEWS_FROM_FILE)
+ {
+ mainFrame.setTitle(MessageManager
+ .getString("label.structure_chooser_manual_association"));
+ idInputAssSeqPanel.loadCmbAssSeq();
+ fileChooserAssSeqPanel.loadCmbAssSeq();
+ }
+ validateSelections();
+ }
+
+ /**
+ * Validates user selection and activates the view button if all parameters
+ * are correct
+ */
+ @Override
+ public void validateSelections()
+ {
+ FilterOption selectedFilterOpt = ((FilterOption) cmb_filterOption
+ .getSelectedItem());
+ btn_view.setEnabled(false);
+ String currentView = selectedFilterOpt.getView();
+ if (currentView == VIEWS_FILTER)
+ {
+ if (tbl_summary.getSelectedRows().length > 0)
+ {
+ btn_view.setEnabled(true);
+ }
+ }
+ else if (currentView == VIEWS_LOCAL_PDB)
+ {
+ if (tbl_local_pdb.getSelectedRows().length > 0)
+ {
+ btn_view.setEnabled(true);
+ }
+ }
+ else if (currentView == VIEWS_ENTER_ID)
+ {
+ validateAssociationEnterPdb();
+ }
+ else if (currentView == VIEWS_FROM_FILE)
+ {
+ validateAssociationFromFile();
+ }
+ }
+
+ /**
+ * Validates inputs from the Manual PDB entry panel
+ */
+ public void validateAssociationEnterPdb()
+ {
+ AssociateSeqOptions assSeqOpt = (AssociateSeqOptions) idInputAssSeqPanel
+ .getCmb_assSeq().getSelectedItem();
+ lbl_pdbManualFetchStatus.setIcon(errorImage);
+ lbl_pdbManualFetchStatus.setToolTipText("");
+ if (txt_search.getText().length() > 0)
+ {
+ lbl_pdbManualFetchStatus
+ .setToolTipText(JvSwingUtils.wrapTooltip(true, MessageManager
+ .formatMessage("info.no_pdb_entry_found_for",
+ txt_search.getText())));
+ }
+
+ if (errorWarning.length() > 0)
+ {
+ lbl_pdbManualFetchStatus.setIcon(warningImage);
+ lbl_pdbManualFetchStatus.setToolTipText(JvSwingUtils.wrapTooltip(
+ true, errorWarning.toString()));
+ }
+
+ if (selectedSequences.length == 1
+ || !assSeqOpt.getName().equalsIgnoreCase(
+ "-Select Associated Seq-"))
+ {
+ txt_search.setEnabled(true);
+ if (isValidPBDEntry)
+ {
+ btn_view.setEnabled(true);
+ lbl_pdbManualFetchStatus.setToolTipText("");
+ lbl_pdbManualFetchStatus.setIcon(goodImage);
+ }
+ }
+ else
+ {
+ txt_search.setEnabled(false);
+ lbl_pdbManualFetchStatus.setIcon(errorImage);
+ }
+ }