package jalview.fts.api;
+import java.util.Map;
+
import javax.swing.JTable;
/**
* @param isEnabled
*/
public void setNextPageButtonEnabled(boolean isEnabled);
+
+ /**
+ * The HashMap used to store user preferences for summary table columns,
+ * window size and position
+ *
+ * @return
+ */
+ public Map<String, Integer> getTempUserPrefs();
}
import jalview.fts.api.FTSDataColumnI;
import java.util.Collection;
+import java.util.Map;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
}
public static void configureTableColumn(JTable tbl_summary,
- Collection<FTSDataColumnI> wantedFields)
+ Collection<FTSDataColumnI> wantedFields,
+ Map<String, Integer> columnPrefs)
{
for (FTSDataColumnI wantedField : wantedFields)
{
wantedField.getMinWidth());
tbl_summary.getColumn(wantedField.getName()).setMaxWidth(
wantedField.getMaxWidth());
+ int prefedWidth = columnPrefs.get(wantedField.getName()) == null ? wantedField
+ .getPreferredWidth() : columnPrefs.get(wantedField
+ .getName());
tbl_summary.getColumn(wantedField.getName()).setPreferredWidth(
- wantedField.getPreferredWidth());
+ prefedWidth);
} catch (Exception e)
{
e.printStackTrace();
if (wantedField.getDataType().getDataTypeClass() == Double.class)
{
DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
- wantedField.getDataType().isFormtted(),
- wantedField.getDataType().getSignificantFigures());
+ wantedField.getDataType().isFormtted(), wantedField
+ .getDataType().getSignificantFigures());
tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
}
else if (wantedField.getDataType().getDataTypeClass() == Integer.class)
{
DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
- wantedField.getDataType().isFormtted(),
- wantedField.getDataType().getSignificantFigures());
+ wantedField.getDataType().isFormtted(), wantedField
+ .getDataType().getSignificantFigures());
tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
}
}
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.event.InternalFrameEvent;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
protected static final DecimalFormat totalNumberformatter = new DecimalFormat(
"###,###");
-
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
&& !inLayout)
{
resizingColumn.setPreferredWidth(resizingColumn.getWidth());
+ String colHeader = resizingColumn.getHeaderValue().toString();
+ getTempUserPrefs().put(colHeader, resizingColumn.getWidth());
}
resizeAndRepaint();
}
*/
private void jbInit() throws Exception
{
+ Integer width = getTempUserPrefs().get("FTSPanel.width") == null ? 800
+ : getTempUserPrefs().get("FTSPanel.width");
+ Integer height = getTempUserPrefs().get("FTSPanel.height") == null ? 400
+ : getTempUserPrefs().get("FTSPanel.height");
lbl_warning.setVisible(false);
lbl_warning.setFont(new java.awt.Font("Verdana", 0, 12));
lbl_loading.setVisible(false);
}
}
});
- scrl_searchResult.setPreferredSize(new Dimension(800, 400));
+ scrl_searchResult.setPreferredSize(new Dimension(width, height));
cmb_searchTarget.setFont(new java.awt.Font("Verdana", 0, 12));
cmb_searchTarget.addActionListener(new ActionListener()
}
};
tabbedPane.addChangeListener(changeListener);
- tabbedPane.setPreferredSize(new Dimension(800, 400));
+ tabbedPane.setPreferredSize(new Dimension(width, height));
tabbedPane.add(searchTabTitle, scrl_searchResult);
tabbedPane.add(configureCols, new FTSDataColumnPreferences(
PreferenceSource.SEARCH_SUMMARY, getFTSRestClient()));
mainFrame.setVisible(true);
mainFrame.setContentPane(this);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), 900, 500);
+ mainFrame
+ .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosing(InternalFrameEvent e)
+ {
+ closeAction();
+ }
+ });
+ mainFrame.setVisible(true);
+ mainFrame.setContentPane(this);
+ mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ Integer x = getTempUserPrefs().get("FTSPanel.x");
+ Integer y = getTempUserPrefs().get("FTSPanel.y");
+ if (x != null && y != null)
+ {
+ mainFrame.setLocation(x, y);
+ }
+ Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), width, height);
}
+ protected void closeAction()
+ {
+ // System.out.println(">>>>>>>>>> closing internal frame!!!");
+ // System.out.println("width : " + this.getWidth());
+ // System.out.println("heigh : " + this.getHeight());
+ // System.out.println("x : " + mainFrame.getX());
+ // System.out.println("y : " + mainFrame.getY());
+ getTempUserPrefs().put("FTSPanel.width", this.getWidth());
+ getTempUserPrefs().put("FTSPanel.height", pnl_results.getHeight());
+ getTempUserPrefs().put("FTSPanel.x", mainFrame.getX());
+ getTempUserPrefs().put("FTSPanel.y", mainFrame.getY());
+ mainFrame.dispose();
+ }
public class DeferredTextInputListener implements DocumentListener
{
private final Timer swingTimer;
protected void btn_back_ActionPerformed()
{
- mainFrame.dispose();
+ closeAction();
new SequenceFetcher(progressIdicator);
}
protected void btn_cancel_ActionPerformed()
{
- mainFrame.dispose();
+ closeAction();
}
/**
import jalview.gui.SequenceFetcher;
import jalview.util.MessageManager;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
@SuppressWarnings("serial")
public class PDBFTSPanel extends GFTSPanel
private String ftsFrameTitle = defaultFTSFrameTitle;
+ private static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
+
public PDBFTSPanel(SequenceFetcher seqFetcher)
{
pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize();
FTSRestResponse.getTableModel(request,
resultList.getSearchSummary()));
FTSRestResponse.configureTableColumn(getResultTable(),
- wantedFields);
+ wantedFields, tempUserPrefs);
getResultTable().setVisible(true);
}
return true;
}
+ @Override
+ public Map<String, Integer> getTempUserPrefs()
+ {
+ return tempUserPrefs;
+ }
+
}
import jalview.gui.SequenceFetcher;
import jalview.util.MessageManager;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
@SuppressWarnings("serial")
public class UniprotFTSPanel extends GFTSPanel
private String ftsFrameTitle = defaultFTSFrameTitle;
-
+ private static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
public UniprotFTSPanel(SequenceFetcher seqFetcher)
{
FTSRestResponse.getTableModel(request,
resultList.getSearchSummary()));
FTSRestResponse.configureTableColumn(getResultTable(),
- wantedFields);
+ wantedFields, tempUserPrefs);
getResultTable().setVisible(true);
}
return ftsFrameTitle;
}
+ @Override
+ public Map<String, Integer> getTempUserPrefs()
+ {
+ return tempUserPrefs;
+ }
+
}
lastPdbRequest, reorderedStructuresSet));
FTSRestResponse.configureTableColumn(getResultTable(),
- wantedFields);
+ wantedFields, tempUserPrefs);
getResultTable().getColumn("Ref Sequence").setPreferredWidth(120);
getResultTable().getColumn("Ref Sequence").setMinWidth(100);
getResultTable().getColumn("Ref Sequence").setMaxWidth(200);
launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
new SequenceI[] { selectedSequence });
}
- mainFrame.dispose();
+ closeAction();
}
}).start();
}
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.event.InternalFrameEvent;
import javax.swing.table.TableColumn;
@SuppressWarnings("serial")
protected FTSDataColumnI[] previousWantedFields;
+ protected static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
+
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
&& !inLayout)
{
resizingColumn.setPreferredWidth(resizingColumn.getWidth());
+ String colHeader = resizingColumn.getHeaderValue().toString();
+ tempUserPrefs.put(colHeader, resizingColumn.getWidth());
}
resizeAndRepaint();
}
*/
private void jbInit() throws Exception
{
+ Integer width = tempUserPrefs.get("structureChooser.width") == null ? 800
+ : tempUserPrefs.get("structureChooser.width");
+ Integer height = tempUserPrefs.get("structureChooser.height") == null ? 400
+ : tempUserPrefs.get("structureChooser.height");
tbl_summary.setAutoCreateRowSorter(true);
tbl_summary.getTableHeader().setReorderingAllowed(false);
tbl_summary.addMouseListener(new MouseAdapter()
@Override
public void actionPerformed(ActionEvent e)
{
- mainFrame.dispose();
+ closeAction();
}
});
btn_cancel.addKeyListener(new KeyAdapter()
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
- mainFrame.dispose();
+ closeAction();
}
}
});
}
});
- scrl_foundStructures.setPreferredSize(new Dimension(800, 400));
+ scrl_foundStructures.setPreferredSize(new Dimension(width, height));
- scrl_localPDB.setPreferredSize(new Dimension(800, 400));
+ scrl_localPDB.setPreferredSize(new Dimension(width, height));
scrl_localPDB
.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
};
pnl_filter.addChangeListener(changeListener);
- pnl_filter.setPreferredSize(new Dimension(800, 400));
+ pnl_filter.setPreferredSize(new Dimension(width, height));
pnl_filter.add(foundStructureSummary, scrl_foundStructures);
pnl_filter.add(configureCols, pdbDocFieldPrefs);
statusPanel.add(statusBar, null);
this.add(pnl_actionsAndStatus, java.awt.BorderLayout.SOUTH);
+ mainFrame
+ .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosing(InternalFrameEvent e)
+ {
+ closeAction();
+ }
+ });
mainFrame.setVisible(true);
mainFrame.setContentPane(this);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Desktop.addInternalFrame(mainFrame, frameTitle, 900, 500);
+ Integer x = tempUserPrefs.get("structureChooser.x");
+ Integer y = tempUserPrefs.get("structureChooser.y");
+ if (x != null && y != null)
+ {
+ mainFrame.setLocation(x, y);
+ }
+ Desktop.addInternalFrame(mainFrame, frameTitle, width, height);
}
+ protected void closeAction()
+ {
+ // System.out.println(">>>>>>>>>> closing internal frame!!!");
+ // System.out.println("width : " + mainFrame.getWidth());
+ // System.out.println("heigh : " + mainFrame.getHeight());
+ // 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.x", mainFrame.getX());
+ tempUserPrefs.put("structureChooser.y", mainFrame.getY());
+ mainFrame.dispose();
+ }
public boolean wantedFieldsUpdated()
{
if (previousWantedFields == null)