/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
package jalview.fts.core;
import jalview.fts.api.FTSDataColumnI;
-import jalview.fts.api.FTSRestClientI;
+import jalview.fts.api.GFTSPanelI;
import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
-import jalview.fts.service.pdb.PDBFTSRestClient;
import jalview.gui.Desktop;
import jalview.gui.IProgressIndicator;
import jalview.gui.JvSwingUtils;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.table.DefaultTableModel;
/**
- * GUI layout for PDB Fetch Panel
+ * This class provides the swing GUI layout for FTS Panel and implements most of
+ * the contracts defined in GFSPanelI
*
* @author tcnofoegbu
*
*/
@SuppressWarnings("serial")
-public abstract class GFTSPanel extends JPanel
+public abstract class GFTSPanel extends JPanel implements GFTSPanelI
{
protected JInternalFrame mainFrame = new JInternalFrame(
getFTSFrameTitle());
protected Collection<FTSDataColumnI> wantedFields;
- protected JTable tbl_summary = new JTable()
+ private JTable tbl_summary = new JTable()
{
@Override
public String getToolTipText(MouseEvent evt)
case KeyEvent.VK_ENTER: // enter key
if (btn_ok.isEnabled())
{
- btn_ok_ActionPerformed();
+ okAction();
}
evt.consume();
break;
@Override
public void actionPerformed(ActionEvent e)
{
- btn_ok_ActionPerformed();
+ okAction();
}
});
btn_ok.addKeyListener(new KeyAdapter()
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
- btn_ok_ActionPerformed();
+ okAction();
}
}
});
}
txt_search.setToolTipText(JvSwingUtils.wrapTooltip(true,
tooltipText));
- txt_search_ActionPerformed();
+ searchAction();
}
});
@Override
public void insertUpdate(DocumentEvent e)
{
- txt_search_ActionPerformed();
+ searchAction();
}
@Override
public void removeUpdate(DocumentEvent e)
{
- txt_search_ActionPerformed();
+ searchAction();
}
@Override
public void changedUpdate(DocumentEvent e)
{
- txt_search_ActionPerformed();
+ searchAction();
}
});
btn_back.setEnabled(false);
btn_cancel.setEnabled(false);
btn_ok.setEnabled(false);
- previousWantedFields = PDBFTSRestClient.getInstance()
+ previousWantedFields = getFTSRestClient()
.getAllDefaulDisplayedDataColumns()
.toArray(new Object[0]);
}
btn_cancel.setEnabled(true);
if (wantedFieldsUpdated())
{
- txt_search_ActionPerformed();
+ searchAction();
}
else
{
return true;
}
- return Arrays.equals(PDBFTSRestClient.getInstance()
+ return Arrays.equals(getFTSRestClient()
.getAllDefaulDisplayedDataColumns()
.toArray(new Object[0]), previousWantedFields) ? false
: true;
worker.start();
}
- public abstract String getFTSFrameTitle();
+ @Override
+ public String getTypedText()
+ {
+ return txt_search.getText().trim();
+ }
- public abstract FTSRestClientI getFTSRestClient();
+ @Override
+ public JTable getResultTable()
+ {
+ return tbl_summary;
+ }
- public abstract void txt_search_ActionPerformed();
+ public void reset()
+ {
+ lbl_loading.setVisible(false);
+ errorWarning.setLength(0);
+ lbl_warning.setVisible(false);
+ btn_ok.setEnabled(false);
+ mainFrame.setTitle(getFTSFrameTitle());
+ referesh();
+ tbl_summary.setModel(new DefaultTableModel());
+ tbl_summary.setVisible(false);
+ }
- public abstract void btn_ok_ActionPerformed();
+ @Override
+ public void setErrorMessage(String message)
+ {
+ errorWarning.append(message);
+ }
+
+ @Override
+ public void updateSearchFrameTitle(String title)
+ {
+ mainFrame.setTitle(title);
+ }
+
+ @Override
+ public void setSearchInProgress(Boolean isSearchInProgress)
+ {
+ lbl_loading.setVisible(isSearchInProgress);
+ }
+ public void referesh()
+ {
+ mainFrame.setTitle(getFTSFrameTitle());
+ }
}