/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.autoplot; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; /** * * @author jbf */ public class FixLayoutPanel extends javax.swing.JPanel { /** * Creates new form FixLayoutPanel */ public FixLayoutPanel() { initComponents(); } public void setOptions( Map options ) { for ( Entry e: options.entrySet() ) { switch ( e.getKey() ) { case "hideTitles": hideTitlesCheckBox.setSelected(Boolean.valueOf(e.getValue())); break; case "hideTimeAxes": hideTimeAxesCheckBox.setSelected(Boolean.valueOf(e.getValue())); break; case "verticalSpacing": verticalSpacingCheckBox.setSelected(true); verticalSpacingComboBox.setSelectedItem(e.getValue()); break; case "moveLegendsToOutsideNE": moveLegendsToOutsideNECheckBox.setSelected(Boolean.valueOf(e.getValue())); break; } } } public Map getOptions() { HashMap result= new HashMap<>(); if ( hideTitlesCheckBox.isSelected() ) { result.put( "hideTitles", "true" ); } if ( hideTimeAxesCheckBox.isSelected() ) { result.put( "hideTimeAxes", "true" ); } if ( verticalSpacingCheckBox.isSelected() ) { result.put( "verticalSpacing", verticalSpacingComboBox.getSelectedItem().toString() ); } if ( moveLegendsToOutsideNECheckBox.isSelected() ) { result.put( "moveLegendsToOutsideNE", "true" ); } return result; } /** * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of * this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { bindingGroup = new org.jdesktop.beansbinding.BindingGroup(); jLabel1 = new javax.swing.JLabel(); verticalSpacingCheckBox = new javax.swing.JCheckBox(); verticalSpacingComboBox = new javax.swing.JComboBox<>(); moveLegendsToOutsideNECheckBox = new javax.swing.JCheckBox(); hideTimeAxesCheckBox = new javax.swing.JCheckBox(); hideTitlesCheckBox = new javax.swing.JCheckBox(); jLabel1.setText("Fix Layout"); verticalSpacingCheckBox.setText("Vertical spacing between plots:"); verticalSpacingComboBox.setEditable(true); verticalSpacingComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0em", "0.5em", "1em", "2em", " " })); org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, verticalSpacingCheckBox, org.jdesktop.beansbinding.ELProperty.create("${selected}"), verticalSpacingComboBox, org.jdesktop.beansbinding.BeanProperty.create("enabled")); bindingGroup.addBinding(binding); moveLegendsToOutsideNECheckBox.setText("Move legends to outside NE"); hideTimeAxesCheckBox.setText("Hide time (X) axes"); hideTitlesCheckBox.setText("Hide Titles"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(moveLegendsToOutsideNECheckBox) .addGroup(layout.createSequentialGroup() .addComponent(verticalSpacingCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(verticalSpacingComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(hideTimeAxesCheckBox) .addComponent(hideTitlesCheckBox)))) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(verticalSpacingCheckBox) .addComponent(verticalSpacingComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hideTitlesCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(hideTimeAxesCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(moveLegendsToOutsideNECheckBox) .addGap(0, 184, Short.MAX_VALUE)) ); bindingGroup.bind(); }// //GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JCheckBox hideTimeAxesCheckBox; private javax.swing.JCheckBox hideTitlesCheckBox; private javax.swing.JLabel jLabel1; private javax.swing.JCheckBox moveLegendsToOutsideNECheckBox; private javax.swing.JCheckBox verticalSpacingCheckBox; private javax.swing.JComboBox verticalSpacingComboBox; private org.jdesktop.beansbinding.BindingGroup bindingGroup; // End of variables declaration//GEN-END:variables }