/** * Update the dialog contents. * * @param jheader The job portion of the dialog header. * @param job The queue job. * @param info The current job status information. */ public void updateContents( String jheader, QueueJob job, QueueJobInfo info, SubProcessExecDetails details) { ActionAgenda agenda = job.getActionAgenda(); QueueJobResults results = info.getResults(); String dir = "-"; if ((agenda != null) && (info.getOsType() != null)) dir = agenda.getTargetPath(info.getOsType()).toString(); String hostname = ""; if (info.getHostname() != null) hostname = (" [" + info.getHostname() + "]"); String command = "-"; if (details != null) command = details.getCommand(); TreeMap<String, String> env = new TreeMap<String, String>(); if (details != null) env = details.getEnvironment(); setHeader("Execution Details -" + jheader + hostname); pWorkingDirField.setText(dir); BaseAction action = job.getAction(); pCommandLineLabel.setText( "Action Command: " + action.getName() + " (v" + action.getVersionID() + ")"); pCommandLineArea.setText(command); { Component comps[] = UIFactory.createTitledPanels(); { JPanel tpanel = (JPanel) comps[0]; JPanel vpanel = (JPanel) comps[1]; if (!env.isEmpty()) { String last = env.lastKey(); for (String key : env.keySet()) { String value = env.get(key); JTextField field = UIFactory.createTitledTextField(tpanel, key + ":", sTSize, vpanel, value, sVSize); field.setHorizontalAlignment(JLabel.LEFT); if (!key.equals(last)) UIFactory.addVerticalSpacer(tpanel, vpanel, 3); } } else { tpanel.add(Box.createRigidArea(new Dimension(sTSize, 0))); vpanel.add(Box.createHorizontalGlue()); } } pEnvLabel.setText("Toolset Environment: " + agenda.getToolset()); pEnvScroll.setViewportView(comps[2]); } }
/** The constructor sets up the listeners to update values appropriately. */ Row() { hoursTF.addCaretListener(ReviewDialog.this); hoursTF.setHorizontalAlignment(SwingConstants.RIGHT); }
private void setupUI() { JPanel batchInputPanel = new JPanel(); batchInputPanel.setLayout(new GridLayoutManager(7, 2, new Insets(0, 0, 0, 0), -1, -1)); batchInputPanel.setEnabled(true); this.add( batchInputPanel, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); batchInputPanel.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), null)); final Spacer spacer3 = new Spacer(); batchInputPanel.add( spacer3, new GridConstraints( 6, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(195, 14), null, 0, false)); dpiXLabel = new JLabel("DPI X: "); batchInputPanel.add( dpiXLabel, new GridConstraints( 2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); dpiYLabel = new JLabel("DPI Y: "); batchInputPanel.add( dpiYLabel, new GridConstraints( 3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); startDepthLabel = new JLabel("Start Depth (meter): "); batchInputPanel.add( startDepthLabel, new GridConstraints( 4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); depthIncLabel = new JLabel("Depth Increment (meter): "); batchInputPanel.add( depthIncLabel, new GridConstraints( 5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); dpiXField = new JTextField(); dpiXField.setEnabled(false); dpiXField.setHorizontalAlignment(11); dpiYField = new JTextField(); dpiYField.setEnabled(false); dpiYField.setHorizontalAlignment(11); batchInputPanel.add( dpiXField, new GridConstraints( 2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); batchInputPanel.add( dpiYField, new GridConstraints( 3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); startDepthField = new JTextField(); startDepthField.setEnabled(false); startDepthField.setHorizontalAlignment(11); batchInputPanel.add( startDepthField, new GridConstraints( 4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); depthIncField = new JTextField(); depthIncField.setEnabled(false); depthIncField.setHorizontalAlignment(11); batchInputPanel.add( depthIncField, new GridConstraints( 5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(100, -1), null, 0, false)); final JPanel applyPanel = new JPanel(); applyPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); batchInputPanel.add( applyPanel, new GridConstraints( 6, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); applyToAllButton = new JButton("Apply to All Rows"); applyToAllButton.setEnabled(false); applyPanel.add( applyToAllButton, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); applyToSelectedButton = new JButton("Apply to Selected Rows"); applyToSelectedButton.setEnabled(false); applyPanel.add( applyToSelectedButton, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); // final Spacer spacer4 = new Spacer(); // applyPanel.add(spacer4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, // GridConstraints.FILL_HORIZONTAL, // GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); orientationComboBox = new JComboBox(); orientationComboBox.setEnabled(false); final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); defaultComboBoxModel1.addElement("Horizontal"); defaultComboBoxModel1.addElement("Vertical"); defaultComboBoxModel1.addElement("[Blank]"); orientationComboBox.setModel(defaultComboBoxModel1); orientationComboBox.setSelectedIndex(2); // [Blank] batchInputPanel.add( orientationComboBox, new GridConstraints( 0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lengthLabel = new JLabel("Length (meter): "); batchInputPanel.add( lengthLabel, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); lengthField = new JTextField(); lengthField.setEnabled(false); lengthField.setHorizontalAlignment(11); batchInputPanel.add( lengthField, new GridConstraints( 1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); orientationLabel = new JLabel("Orientation: "); batchInputPanel.add( orientationLabel, new GridConstraints( 0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(195, 16), null, 0, false)); useBatchInputCheckbox = new JCheckBox(); useBatchInputCheckbox.setText("Batch input: blank fields will not be applied"); this.add( useBatchInputCheckbox, new GridConstraints( 1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); onBatch(); }
public void setHorizontalAlignment(int h) { textField.setHorizontalAlignment(h); }