Skip to content

Commit

Permalink
Merge pull request apache#6660 from mbien/output-options-ui-cleanup
Browse files Browse the repository at this point in the history
Terminal, Output and Syntax Coloring options UI cleanup.
  • Loading branch information
mbien authored Nov 10, 2023
2 parents 1be2163 + fb9b95d commit 73237de
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 312 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
</Component>
<Component class="javax.swing.JTextField" name="fontText">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.netbeans.lib.terminalemulator.LineDiscipline;
import org.netbeans.lib.terminalemulator.Term;

// TODO seems to be the older copy of ide/terminal.nb/src/org/netbeans/modules/terminal/nb/TermOptionsPanel.java
// public via friend dependencies.
public final class TermOptionsPanel extends javax.swing.JPanel {

private TermOptions termOptions;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="previewPanel" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="fontLabel" alignment="0" min="-2" max="-2" attributes="0"/>
Expand All @@ -50,7 +49,7 @@
</Group>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="foregroundComboBox" alignment="0" pref="252" max="32767" attributes="0"/>
<Component id="foregroundComboBox" alignment="0" max="32767" attributes="0"/>
<Component id="backgroundComboBox" alignment="0" max="32767" attributes="0"/>
<Component id="selectionComboBox" alignment="0" max="32767" attributes="0"/>
<Component id="selectByWordTextField" alignment="0" max="32767" attributes="0"/>
Expand All @@ -75,34 +74,38 @@
<Component id="tabSizeLabel" min="-2" max="-2" attributes="0"/>
<Component id="previewLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="selectByWordLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="ignoreKeymapCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="86" max="-2" attributes="0"/>
<Component id="altSendsEscapeCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="scrollOnInputCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="scrollOnOutputCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="clickToTypeCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
<Component id="lineWrapCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="scrollOnInputCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="clickToTypeCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lineWrapCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="scrollOnOutputCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="ignoreKeymapCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="altSendsEscapeCheckBox" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Component id="previewPanel" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="descriptionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="restoreButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="restoreButton" min="-2" max="-2" attributes="0"/>
<Component id="descriptionLabel" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="fontLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fontButton" alignment="3" min="-2" max="-2" attributes="0"/>
Expand Down Expand Up @@ -143,25 +146,22 @@
<Component id="selectByWordLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="selectByWordTextField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="ignoreKeymapCheckBox" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="altSendsEscapeCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="clickToTypeCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lineWrapCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="ignoreKeymapCheckBox" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="scrollOnInputCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="scrollOnOutputCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="altSendsEscapeCheckBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="previewLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="previewPanel" pref="45" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="previewPanel" pref="67" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Font;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
Expand Down Expand Up @@ -58,12 +59,9 @@ public final class TermOptionsPanel extends JPanel {
"FontChooser.defaultFont.label=Default Font"
})
public TermOptionsPanel() {
propertyListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
refreshView();
}
};
propertyListener = (PropertyChangeEvent e) -> {
refreshView();
};

initComponents();
initCustomComponents();
Expand Down Expand Up @@ -170,7 +168,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {

org.openide.awt.Mnemonics.setLocalizedText(fontSizeLabel, org.openide.util.NbBundle.getMessage(TermOptionsPanel.class, "TermOptionsPanel.fontSizeLabel.text")); // NOI18N

fontSizeSpinner.setModel(new SpinnerNumberModel(12, TermOptions.MIN_FONT_SIZE, TermOptions.MAX_FONT_SIZE, 1));
fontSizeSpinner.setModel(new SpinnerNumberModel(12, termOptions.MIN_FONT_SIZE, termOptions.MAX_FONT_SIZE, 1));
fontSizeSpinner.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
fontSizeSpinnerStateChanged(evt);
Expand Down Expand Up @@ -278,7 +276,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fontLabel)
Expand All @@ -290,7 +287,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(descriptionLabel))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(foregroundComboBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)
.addComponent(foregroundComboBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(backgroundComboBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(selectionComboBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(selectByWordTextField, javax.swing.GroupLayout.Alignment.LEADING)
Expand All @@ -309,28 +306,31 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tabSizeLabel)
.addComponent(previewLabel)
.addComponent(selectByWordLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(ignoreKeymapCheckBox)
.addGap(86, 86, 86)
.addComponent(altSendsEscapeCheckBox))
.addGroup(layout.createSequentialGroup()
.addComponent(scrollOnInputCheckBox)
.addGap(18, 18, 18)
.addComponent(scrollOnOutputCheckBox))
.addGroup(layout.createSequentialGroup()
.addComponent(clickToTypeCheckBox)
.addGap(31, 31, 31)
.addComponent(lineWrapCheckBox)))
.addComponent(selectByWordLabel))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(scrollOnInputCheckBox)
.addComponent(clickToTypeCheckBox))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lineWrapCheckBox)
.addComponent(scrollOnOutputCheckBox))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ignoreKeymapCheckBox)
.addComponent(altSendsEscapeCheckBox))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(descriptionLabel)
.addComponent(restoreButton))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(restoreButton)
.addComponent(descriptionLabel, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(fontLabel)
.addComponent(fontButton)
Expand Down Expand Up @@ -363,22 +363,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(selectByWordLabel)
.addComponent(selectByWordTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ignoreKeymapCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(altSendsEscapeCheckBox))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(clickToTypeCheckBox)
.addComponent(lineWrapCheckBox))
.addComponent(lineWrapCheckBox)
.addComponent(ignoreKeymapCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(scrollOnInputCheckBox)
.addComponent(scrollOnOutputCheckBox))
.addComponent(scrollOnOutputCheckBox)
.addComponent(altSendsEscapeCheckBox))
.addGap(18, 18, 18)
.addComponent(previewLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(previewPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
Expand All @@ -389,7 +387,7 @@ private void fontSizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//G
}
Object fontSizeObj = fontSizeSpinner.getValue();
if (fontSizeObj instanceof Integer) {
int fontSize = ((Integer) fontSizeObj).intValue();
int fontSize = (Integer) fontSizeObj;
termOptions.setFontSize(fontSize);
}
}//GEN-LAST:event_fontSizeSpinnerStateChanged
Expand All @@ -400,7 +398,7 @@ private void historySizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {
}
Object historySizeObj = historySizeSpinner.getValue();
if (historySizeObj instanceof Integer) {
int historySize = ((Integer) historySizeObj).intValue();
int historySize = (Integer) historySizeObj;
termOptions.setHistorySize(historySize);
}
}//GEN-LAST:event_historySizeSpinnerStateChanged
Expand All @@ -411,7 +409,7 @@ private void tabSizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GE
}
Object tabSizeObj = tabSizeSpinner.getValue();
if (tabSizeObj instanceof Integer) {
int tabSize = ((Integer) tabSizeObj).intValue();
int tabSize = (Integer) tabSizeObj;
termOptions.setTabSize(tabSize);
}
}//GEN-LAST:event_tabSizeSpinnerStateChanged
Expand All @@ -425,7 +423,9 @@ private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
String defaultFontString = FontChooser_defaultFont_label();
dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
defaultFontString, DialogDescriptor.CANCEL_OPTION}); //NOI18N
DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
Dialog dialog = DialogDisplayer.getDefault().createDialog(dd);
dialog.setSize(460, 380);
dialog.setVisible(true);
if (dd.getValue() == DialogDescriptor.OK_OPTION) {
Font f = (Font) pe.getValue();
termOptions.setFont(f);
Expand Down
Loading

0 comments on commit 73237de

Please sign in to comment.