if (Desktop.instance != null)
{
targetView.removeAllItems();
- targetView.addItem(
- new StructureViewer(ap.getStructureSelectionManager()));
if (lastTargetedView != null && !lastTargetedView.isVisible())
{
lastTargetedView = null;
}
- int linkedViewsAt = 1;
+ int linkedViewsAt = 0;
for (StructureViewerBase view : Desktop.instance
.getStructureViewers(null, null))
{
targetView.addItem(viewHandler);
}
}
- targetView.setVisible(targetView.getItemCount() > 1);
-
- // finally, restore last targeted view by default.
- if (lastTargetedView != null)
- {
- targetView.setSelectedItem(lastTargetedView);
+ targetView.setVisible(targetView.getItemCount() > 0);
+ btn_view.setVisible(targetView.isVisible());
+ if (targetView.isVisible()) {
+ // finally, restore last targeted view by default.
+ if (lastTargetedView != null)
+ {
+ targetView.setSelectedItem(lastTargetedView);
+ } else {
+ targetView.setSelectedIndex(0);
+ }
}
}
}
* Handles action event for btn_ok
*/
@Override
- public void ok_ActionPerformed()
+ public void newview_ActionPerformed()
+ {
+ targetView.setSelectedItem(null);
+ showStructures(false);
+ }
+
+ /**
+ * Handles action event for btn_ok
+ */
+ @Override
+ public void view_ActionPerformed()
{
showStructures(false);
}
protected JButton btn_view = new JButton();
+ protected JButton btn_newview = new JButton(
+ MessageManager.getString("label.new_view"));
+
protected JButton btn_cancel = new JButton();
protected JButton btn_pdbFromFile = new JButton();
case KeyEvent.VK_ENTER: // enter key
if (btn_view.isEnabled())
{
- ok_ActionPerformed();
+ view_ActionPerformed();
}
break;
case KeyEvent.VK_TAB: // tab key
case KeyEvent.VK_ENTER: // enter key
if (btn_view.isEnabled())
{
- ok_ActionPerformed();
+ view_ActionPerformed();
}
break;
case KeyEvent.VK_TAB: // tab key
}
}
});
+ btn_newview.setFont(new java.awt.Font("Verdana", 0, 12));
+ btn_newview.setText(MessageManager.getString("action.new_view"));
+ btn_newview.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ newview_ActionPerformed();
+ }
+ });
+ btn_newview.addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyPressed(KeyEvent evt)
+ {
+ if (evt.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ newview_ActionPerformed();
+ }
+ }
+ });
+
btn_view.setFont(new java.awt.Font("Verdana", 0, 12));
- btn_view.setText(MessageManager.getString("action.view"));
+ btn_view.setText(MessageManager.getString("action.add"));
btn_view.addActionListener(new java.awt.event.ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
- ok_ActionPerformed();
+ view_ActionPerformed();
}
});
btn_view.addKeyListener(new KeyAdapter()
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
- ok_ActionPerformed();
+ view_ActionPerformed();
}
}
});
chk_invertFilter.addItemListener(this);
targetView.setVisible(false);
- pnl_actions.add(targetView,"wrap");
- pnl_actions.add(chk_rememberSettings);
- pnl_actions.add(btn_view);
- pnl_actions.add(btn_cancel);
+ pnl_actions.add(targetView, "left");
+ pnl_actions.add(btn_view, "wrap");
pnl_actions.add(chk_superpose, "left");
+ pnl_actions.add(btn_newview);
+ pnl_actions.add(btn_cancel, "right");
+
+ // pnl_actions.add(chk_rememberSettings);
// pnl_filter.add(lbl_result);
pnl_main.add(cmb_filterOption);
JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent
.getSource();
int index = sourceTabbedPane.getSelectedIndex();
- btn_view.setVisible(true);
+ btn_view.setVisible(targetView.isVisible());
+ btn_newview.setVisible(true);
btn_cancel.setVisible(true);
if (sourceTabbedPane.getTitleAt(index).equals(configureCols))
{
btn_view.setEnabled(false);
btn_cancel.setEnabled(false);
btn_view.setVisible(false);
+ btn_newview.setEnabled(false);
btn_cancel.setVisible(false);
previousWantedFields = pdbDocFieldPrefs
.getStructureSummaryFields()
protected abstract void stateChanged(ItemEvent e);
- protected abstract void ok_ActionPerformed();
+ protected abstract void view_ActionPerformed();
+
+ protected abstract void newview_ActionPerformed();
protected abstract void pdbFromFile_actionPerformed();