public TransformerPanel( final TransformerPanelController controller, IconManager iconManager, TransformerWorker worker) { super(controller, iconManager); setOpaque(false); worker.setView(this); JPanel applyPanel = createApplyPanel(); Component editPanel = createEditPanel(); startWithComboBox = new JComboBox(controller.getStartWithComboBoxModel()); JPanel startWithPanel = createStartWithPanel(); setLayout(new GridBagLayout()); int row = 0; add( namedElementComboBox, new GridBagConstraints( 0, row, 2, 1, 1, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add( optionsButton, new GridBagConstraints( 2, row++, 1, 1, 0, 0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 4), 0, 0)); add( new JSeparator(), new GridBagConstraints( 0, row++, 3, 1, 1, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); add( startWithPanel, new GridBagConstraints( 0, row++, 3, 1, 1, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 4, 0, 0), 0, 0)); add( editPanel, new GridBagConstraints( 0, row++, 3, 1, 1, 1, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); add( applyPanel, new GridBagConstraints( 0, row++, 3, 1, 1, 0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); ComboBoxModel model = controller.getElementComboBoxModel(); TransformerElement element = (TransformerElement) model.getSelectedItem(); createView(element.chain); controller.synchronize(this); }
@SuppressWarnings("unchecked") public TransformerPanel( final TransformerPanelController controller, IconManager iconManager, TransformerWorker worker) { super(controller, iconManager); setOpaque(!isAquaLAF()); worker.setView(this); final JPanel applyPanel = createApplyPanel(); final Component editPanel = createEditPanel(); final JLabel startWithLabel = new JLabel("Start with:"); startWithComboBox = new JComboBox<>(controller.getStartWithComboBoxModel()); startWithComboBox.setRenderer(ViewUtil.createElipsisRenderer(50)); final JSeparator sep = new JSeparator(); final GroupLayout layout = new GroupLayout(this); this.setLayout(layout); layout.setAutoCreateContainerGaps(!isAquaLAF()); layout.setAutoCreateGaps(!isAquaLAF()); layout.setHorizontalGroup( layout .createParallelGroup(Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent(namedElementComboBox, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(optionsButton, PREFERRED_SIZE, 64, PREFERRED_SIZE)) .addComponent(sep, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( layout .createSequentialGroup() .addComponent(startWithLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE) .addComponent(startWithComboBox, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)) .addComponent(editPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(applyPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(Alignment.CENTER, false) .addComponent( namedElementComboBox, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE) .addComponent(optionsButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(sep, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE) .addGroup( layout .createParallelGroup(Alignment.CENTER, false) .addComponent(startWithLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE) .addComponent(startWithComboBox, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)) .addComponent(editPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(applyPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)); DynamicComboBoxModel<TransformerElement> model = controller.getElementComboBoxModel(); TransformerElement element = (TransformerElement) model.getSelectedItem(); createView(element.getChain()); controller.synchronize(this); }