adds RendererPanel default inner size.
label.autoadd_secstr = Add secondary structure annotation to alignment
label.autoadd_temp = Add Temperature Factor annotation to alignment
label.structure_viewer = Default structure viewer
+label.structure_dimensions = Default dimensions
label.double_click_to_browse = Double-click to browse for file
label.chimera_path = Path to Chimera program
label.chimera_path_tip = Jalview will first try any path entered here, else standard installation locations.<br>Double-click to browse for file.
label.chimera_help=Ayuda para Chimera
label.find_tip=Buscar alineamiento, selección o IDs de secuencia para una subsecuencia (sin huecos)
label.structure_viewer=Visualizador por defecto
+label.structure_dimensions=Dimensiones por defecto
label.embbed_biojson=Incrustar BioJSON al exportar HTML
label.transparency_tip=Ajustar la transparencia a "ver a través" los colores de las características.
label.choose_annotations=Escoja anotaciones
import jalview.ws.sifts.SiftsSettings;
import java.awt.Color;
+import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
}
/**
+ * retrieve a dimension, such as for Jmol
+ *
+ * @param property
+ * @param def
+ * @return
+ */
+ public static Dimension getDefaultDim(String property, Dimension def)
+ {
+ String s = getProperty(property);
+ if (s != null)
+ {
+ if (s.indexOf(',') < 0)
+ {
+ s = s.trim().replace(' ', ',');
+ if (s.indexOf(',') < 0)
+ {
+ s += "," + s;
+ }
+ }
+ try
+ {
+ int pt = s.indexOf(",");
+ return new Dimension(Integer.parseInt(s.substring(0, pt)),
+ Integer.parseInt(s.substring(pt + 1)));
+ } catch (NumberFormatException e)
+ {
+ System.out.println("Error parsing Dimension property '" + property
+ + "' with value '" + s + "'");
+ }
+ }
+ return def;
+ }
+
+ /**
* Answers the value of the given property, or the supplied default value if
* the property is not set
*/
// TODO: consider waiting until the structure/view is fully loaded before
// displaying
this.getContentPane().add(renderPanel, java.awt.BorderLayout.CENTER);
+ this.invalidate();
+ this.pack();
jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(),
getBounds().width, getBounds().height);
if (scriptWindow == null)
*
* @param type
*/
+ @Override
public void makePDBImage(ImageMaker.TYPE type)
{
int width = getWidth();
validate();
}
+ @SuppressWarnings("serial")
class RenderPanel extends JPanel
{
final Dimension currentSize = new Dimension();
+ public RenderPanel()
+ {
+ setPreferredSize(
+ Cache.getDefaultDim(Preferences.STRUCTURE_DIMENSIONS,
+ Preferences.DEFAULT_STRUCTURE_DIMENSIONS));
+ // BH 2019.07.12 suggesting 600,600; current is something like 347 x 323
+ }
+
@Override
public void paintComponent(Graphics g)
{
getSize(currentSize);
-
+ // BH: Note that this size could be slightly different from the size set
+ // prior to packing.
if (jmb != null && jmb.hasFileLoadingError())
{
g.setColor(Color.black);
@SuppressWarnings("serial")
public class Preferences extends GPreferences
{
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
public static final String ADD_SS_ANN = "ADD_SS_ANN";
public static final String ADD_TEMPFACT_ANN = "ADD_TEMPFACT_ANN";
public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
+ public static final String STRUCTURE_DIMENSIONS = "STRUCTURE_DIMENSIONS";
+
public static final String UNIPROT_DOMAIN = "UNIPROT_DOMAIN";
public static final String USE_FULL_SO = "USE_FULL_SO";
public static final String SHOW_FULLSCREEN = "SHOW_FULLSCREEN";
+ public static final Dimension DEFAULT_STRUCTURE_DIMENSIONS = new Dimension(
+ 600, 600);
static
{
wsPrefs = new WsPreferences();
wsTab.add(wsPrefs, BorderLayout.CENTER);
}
- int width = 500, height = 450;
+ int width = 500, height = 510; // BH 2019.07.12 added 60 to height
+ // (structure panel was too small anyway, and I added a default dimension
+ // for Jmol
if (Platform.isAMacAndNotJS())
{
width = 570;
- height = 480;
+ height = 540; // BH 2019.07.12 added 30
}
Desktop.addInternalFrame(frame,
addTempFactor.setEnabled(structSelected);
structViewer.setSelectedItem(
Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name()));
+ Dimension d = Cache.getDefaultDim(STRUCTURE_DIMENSIONS,
+ DEFAULT_STRUCTURE_DIMENSIONS);
+ String s = d.width + "," + d.height;
+ structureDimensions.setText(s);
chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, ""));
chimeraPath.addActionListener(new ActionListener()
{
Boolean.toString(structFromPdb.isSelected()));
Cache.setPropertyNoSave(STRUCTURE_DISPLAY,
structViewer.getSelectedItem().toString());
+ Cache.setPropertyNoSave(STRUCTURE_DIMENSIONS,
+ structureDimensions.getText()); // BH 2019.07.12
Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
Cache.setPropertyNoSave(MAP_WITH_SIFTS,
Boolean.toString(siftsMapping.isSelected()));
protected JComboBox<String> structViewer = new JComboBox<>();
+ protected JTextField structureDimensions = new JTextField();
+
protected JTextField chimeraPath = new JTextField();
protected ButtonGroup mappingMethod = new ButtonGroup();
structViewer.addItem(ViewerType.JMOL.name());
structViewer.addItem(ViewerType.CHIMERA.name());
structViewer.addActionListener(new ActionListener()
+
{
@Override
public void actionPerformed(ActionEvent e)
});
structureTab.add(structViewer);
+ // BH 2019.07.12
+ ypos += lineSpacing;
+ JLabel dimLabel = new JLabel();
+ dimLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
+ dimLabel.setHorizontalAlignment(SwingConstants.LEFT);
+ dimLabel.setText(
+ MessageManager.getString("label.structure_dimensions"));
+ dimLabel.setBounds(new Rectangle(10, ypos, 140, height));
+ structureTab.add(dimLabel);
+
+ structureDimensions.setFont(LABEL_FONT);
+ structureDimensions.setBounds(new Rectangle(160, ypos, 120, height));
+ structureTab.add(structureDimensions);
+
ypos += lineSpacing;
JLabel pathLabel = new JLabel();
pathLabel.setFont(new java.awt.Font("SansSerif", 0, 11));
button.setHorizontalAlignment(SwingConstants.CENTER);
this.button.addActionListener(new ActionListener()
{
+ @SuppressWarnings("synthetic-access")
@Override
public void actionPerformed(ActionEvent e)
{
private static final long serialVersionUID = 88L;
@Override
- public Component getListCellRendererComponent(JList list, Object value,
+ public Component getListCellRendererComponent(JList<?> list, Object value,
int index, boolean isSelected, boolean cellHasFocus)
{
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);