Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 231105
Collapse All | Expand All

(-)a/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/support/TermOptions.java (-55 / +33 lines)
 Lines 76-81    Link Here 
76
	resetToDefault();
76
	resetToDefault();
77
    }
77
    }
78
78
79
    // Copy constructor
80
    private TermOptions(TermOptions orig) {
81
        assign(orig);
82
    }
83
79
    public final void resetToDefault() {
84
    public final void resetToDefault() {
80
	final Font controlFont = UIManager.getFont("controlFont");// NOI18N
85
	final Font controlFont = UIManager.getFont("controlFont");// NOI18N
81
	fontSize = (controlFont == null)? 12: controlFont.getSize();
86
	fontSize = (controlFont == null)? 12: controlFont.getSize();
 Lines 97-102    Link Here 
97
	scrollOnOutput = true;
102
	scrollOnOutput = true;
98
	lineWrap = true;
103
	lineWrap = true;
99
        ignoreKeymap = false;
104
        ignoreKeymap = false;
105
        markDirty();
100
    }
106
    }
101
107
102
    public synchronized static TermOptions getDefault(Preferences prefs) {
108
    public synchronized static TermOptions getDefault(Preferences prefs) {
 Lines 111-130    Link Here 
111
     * Make a copy of 'this'.
117
     * Make a copy of 'this'.
112
     */
118
     */
113
    public TermOptions makeCopy() {
119
    public TermOptions makeCopy() {
114
	TermOptions copy = new TermOptions();
120
        return new TermOptions(this);
115
	copy.font= this.font;
116
	copy.fontSize = this.fontSize;
117
	copy.tabSize = this.tabSize;
118
	copy.historySize = this.historySize;
119
	copy.foreground = new Color(this.foreground.getRGB());
120
	copy.background = new Color(this.background.getRGB());
121
	copy.selectionBackground = new Color(this.selectionBackground.getRGB());
122
	copy.clickToType = this.clickToType;
123
	copy.scrollOnInput = this.scrollOnInput;
124
	copy.scrollOnOutput = this.scrollOnOutput;
125
	copy.lineWrap = this.lineWrap;
126
        copy.ignoreKeymap = this.ignoreKeymap;
127
	return copy;
128
    }
121
    }
129
122
130
    /**
123
    /**
 Lines 235-249    Link Here 
235
    }
228
    }
236
229
237
    public void setFont(Font font) {
230
    public void setFont(Font font) {
238
	if (this.font!= font) {
231
        this.font = font;
239
	    this.font = font;
232
        // recalculate fontSize as well.
240
	    dirty = true;
233
        fontSize = this.font.getSize();
241
234
        markDirty();
242
	    // recalculate fontSize as well.
243
	    fontSize = this.font.getSize();
244
245
	    pcs.firePropertyChange(null, null, null);
246
	}
247
    }
235
    }
248
236
249
    /*
237
    /*
 Lines 258-273    Link Here 
258
    }
246
    }
259
247
260
    public void setFontSize(int fontSize) {
248
    public void setFontSize(int fontSize) {
261
	if (this.fontSize != fontSize) {
249
        this.fontSize = fontSize;
262
	    this.fontSize = fontSize;
263
250
264
	    // recalculate font as well.
251
        // recalculate font as well.
265
	    font = new Font(font.getFamily(),
252
        font = new Font(font.getFamily(),
266
		            font.getStyle(),
253
                        font.getStyle(),
267
			    this.fontSize);
254
                        this.fontSize);
268
	    dirty = true;
255
        markDirty();
269
	    pcs.firePropertyChange(null, null, null);
270
	} 
271
    }
256
    }
272
257
273
    /*
258
    /*
 Lines 282-289    Link Here 
282
    } 
267
    } 
283
    public void setForeground(Color foreground) {
268
    public void setForeground(Color foreground) {
284
	this.foreground = foreground;
269
	this.foreground = foreground;
285
	dirty = true;
270
        markDirty();
286
	pcs.firePropertyChange(null, null, null);
287
    } 
271
    } 
288
272
289
    /*
273
    /*
 Lines 298-305    Link Here 
298
    } 
282
    } 
299
    public void setBackground(Color background) {
283
    public void setBackground(Color background) {
300
	this.background = background;
284
	this.background = background;
301
	dirty = true;
285
        markDirty();
302
	pcs.firePropertyChange(null, null, null);
303
    } 
286
    } 
304
287
305
    /*
288
    /*
 Lines 315-322    Link Here 
315
    } 
298
    } 
316
    public void setSelectionBackground(Color selectionBackground) {
299
    public void setSelectionBackground(Color selectionBackground) {
317
	this.selectionBackground = selectionBackground;
300
	this.selectionBackground = selectionBackground;
318
	dirty = true;
301
        markDirty();
319
	pcs.firePropertyChange(null, null, null);
320
    } 
302
    } 
321
303
322
    /*
304
    /*
 Lines 330-340    Link Here 
330
	return historySize;
312
	return historySize;
331
    } 
313
    } 
332
    public void setHistorySize(int historySize) {
314
    public void setHistorySize(int historySize) {
333
	if (this.historySize != historySize) {
315
        this.historySize = historySize;
334
	    dirty = true;
316
        markDirty();
335
	    this.historySize = historySize;
336
	    pcs.firePropertyChange(null, null, null);
337
	} 
338
    } 
317
    } 
339
318
340
    /*
319
    /*
 Lines 349-356    Link Here 
349
    } 
328
    } 
350
    public void setTabSize(int tabSize) {
329
    public void setTabSize(int tabSize) {
351
	this.tabSize = tabSize;
330
	this.tabSize = tabSize;
352
	dirty = true;
331
        markDirty();
353
	pcs.firePropertyChange(null, null, null);
354
    } 
332
    } 
355
333
356
    /*
334
    /*
 Lines 365-372    Link Here 
365
    } 
343
    } 
366
    public void setClickToType(boolean clickToType) {
344
    public void setClickToType(boolean clickToType) {
367
	this.clickToType = clickToType;
345
	this.clickToType = clickToType;
368
	dirty = true;
346
        markDirty();
369
	pcs.firePropertyChange(null, null, null);
370
    } 
347
    } 
371
348
372
    /*
349
    /*
 Lines 382-389    Link Here 
382
    } 
359
    } 
383
    public void setScrollOnInput(boolean scrollOnInput) {
360
    public void setScrollOnInput(boolean scrollOnInput) {
384
	this.scrollOnInput = scrollOnInput;
361
	this.scrollOnInput = scrollOnInput;
385
	dirty = true;
362
        markDirty();
386
	pcs.firePropertyChange(null, null, null);
387
    } 
363
    } 
388
364
389
365
 Lines 400-407    Link Here 
400
    } 
376
    } 
401
    public void setScrollOnOutput(boolean scrollOnOutput) {
377
    public void setScrollOnOutput(boolean scrollOnOutput) {
402
	this.scrollOnOutput = scrollOnOutput;
378
	this.scrollOnOutput = scrollOnOutput;
403
	dirty = true;
379
        markDirty();
404
	pcs.firePropertyChange(null, null, null);
405
    } 
380
    } 
406
381
407
    /*
382
    /*
 Lines 416-423    Link Here 
416
    } 
391
    } 
417
    public void setLineWrap(boolean lineWrap) {
392
    public void setLineWrap(boolean lineWrap) {
418
	this.lineWrap = lineWrap;
393
	this.lineWrap = lineWrap;
419
	dirty = true;
394
        markDirty();
420
	pcs.firePropertyChange(null, null, null);
421
    } 
395
    } 
422
    
396
    
423
    /*
397
    /*
 Lines 432-438    Link Here 
432
    } 
406
    } 
433
    public void setIgnoreKeymap(boolean ignoreKeymap) {
407
    public void setIgnoreKeymap(boolean ignoreKeymap) {
434
	this.ignoreKeymap = ignoreKeymap;
408
	this.ignoreKeymap = ignoreKeymap;
435
	dirty = true;
409
        markDirty();
436
	pcs.firePropertyChange(null, null, null);
437
    } 
410
    } 
411
412
    private void markDirty() {
413
        this.dirty = true;
414
        pcs.firePropertyChange(null, null, null);
415
    }
438
}
416
}
(-)a/lib.terminalemulator/src/org/netbeans/lib/terminalemulator/support/TermOptionsPanel.java (-23 / +41 lines)
 Lines 45-51    Link Here 
45
45
46
import java.awt.BorderLayout;
46
import java.awt.BorderLayout;
47
import java.awt.Color;
47
import java.awt.Color;
48
import java.awt.Component;
49
import java.awt.Font;
48
import java.awt.Font;
50
import java.beans.PropertyChangeEvent;
49
import java.beans.PropertyChangeEvent;
51
import java.beans.PropertyChangeListener;
50
import java.beans.PropertyChangeListener;
 Lines 100-105    Link Here 
100
    private static final int MNM_WrapLines = Catalog.mnemonic("MNM_WrapLines"); //NOI18N
99
    private static final int MNM_WrapLines = Catalog.mnemonic("MNM_WrapLines"); //NOI18N
101
    private static final int MNM_IgnoreKeymap = Catalog.mnemonic("MNM_IgnoreKeymap"); //NOI18N
100
    private static final int MNM_IgnoreKeymap = Catalog.mnemonic("MNM_IgnoreKeymap"); //NOI18N
102
    private static final int MNM_Preview = Catalog.mnemonic("MNM_Preview"); //NOI18N
101
    private static final int MNM_Preview = Catalog.mnemonic("MNM_Preview"); //NOI18N
102
    private boolean inApplyingModel;
103
103
104
    /** Creates new form TermOptionsPanel */
104
    /** Creates new form TermOptionsPanel */
105
    public TermOptionsPanel() {
105
    public TermOptionsPanel() {
 Lines 169-188    Link Here 
169
     * Transfer model values to view widgets.
169
     * Transfer model values to view widgets.
170
     */
170
     */
171
    private void applyTermOptions() {
171
    private void applyTermOptions() {
172
        fontSizeSpinner.setValue(termOptions.getFontSize());
172
        inApplyingModel = true;
173
        fontText.setText(termOptions.getFont().getFamily() +
173
        try {
174
		         " " +					// NOI18N
174
            fontSizeSpinner.setValue(termOptions.getFontSize());
175
			 termOptions.getFont().getSize());
175
            fontText.setText(termOptions.getFont().getFamily()
176
        ColorComboBox.setColor(foregroundComboBox, termOptions.getForeground());
176
                    + " " + // NOI18N
177
        ColorComboBox.setColor(backgroundComboBox, termOptions.getBackground());
177
                    termOptions.getFont().getSize());
178
        ColorComboBox.setColor(selectionComboBox, termOptions.getSelectionBackground());
178
            ColorComboBox.setColor(foregroundComboBox, termOptions.getForeground());
179
        historySizeSpinner.setValue(termOptions.getHistorySize());
179
            ColorComboBox.setColor(backgroundComboBox, termOptions.getBackground());
180
        tabSizeSpinner.setValue(termOptions.getTabSize());
180
            ColorComboBox.setColor(selectionComboBox, termOptions.getSelectionBackground());
181
        clickToTypeCheckBox.setSelected(termOptions.getClickToType());
181
            historySizeSpinner.setValue(termOptions.getHistorySize());
182
        scrollOnInputCheckBox.setSelected(termOptions.getScrollOnInput());
182
            tabSizeSpinner.setValue(termOptions.getTabSize());
183
        scrollOnOutputCheckBox.setSelected(termOptions.getScrollOnOutput());
183
            clickToTypeCheckBox.setSelected(termOptions.getClickToType());
184
        lineWrapCheckBox.setSelected(termOptions.getLineWrap());
184
            scrollOnInputCheckBox.setSelected(termOptions.getScrollOnInput());
185
        ignoreKeymapCheckBox.setSelected(termOptions.getIgnoreKeymap());
185
            scrollOnOutputCheckBox.setSelected(termOptions.getScrollOnOutput());
186
            lineWrapCheckBox.setSelected(termOptions.getLineWrap());
187
            ignoreKeymapCheckBox.setSelected(termOptions.getIgnoreKeymap());
188
        } finally {
189
            inApplyingModel = false;
190
        }
186
    }
191
    }
187
192
188
    /**
193
    /**
 Lines 558-589    Link Here 
558
563
559
    private void restoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restoreActionPerformed
564
    private void restoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_restoreActionPerformed
560
        termOptions.resetToDefault();
565
        termOptions.resetToDefault();
561
	refreshView();
562
    }//GEN-LAST:event_restoreActionPerformed
566
    }//GEN-LAST:event_restoreActionPerformed
563
567
564
    private void fontSizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_fontSizeSpinnerStateChanged
568
    private void fontSizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_fontSizeSpinnerStateChanged
565
        int fontSize = termOptions.getFontSize();
569
        if (inApplyingModel) {
570
            return;
571
        }
566
        Object fontSizeObj = fontSizeSpinner.getValue();
572
        Object fontSizeObj = fontSizeSpinner.getValue();
567
        if (fontSizeObj instanceof Integer) {
573
        if (fontSizeObj instanceof Integer) {
568
            fontSize = ((Integer) fontSizeObj).intValue();
574
            int fontSize = ((Integer) fontSizeObj).intValue();
569
            termOptions.setFontSize(fontSize);
575
            termOptions.setFontSize(fontSize);
570
        }
576
        }
571
    }//GEN-LAST:event_fontSizeSpinnerStateChanged
577
    }//GEN-LAST:event_fontSizeSpinnerStateChanged
572
578
573
    private void historySizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_historySizeSpinnerStateChanged
579
    private void historySizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_historySizeSpinnerStateChanged
574
        int historySize = termOptions.getHistorySize();
580
        if (inApplyingModel) {
581
            return;
582
        }
575
        Object historySizeObj = historySizeSpinner.getValue();
583
        Object historySizeObj = historySizeSpinner.getValue();
576
        if (historySizeObj instanceof Integer) {
584
        if (historySizeObj instanceof Integer) {
577
            historySize = ((Integer) historySizeObj).intValue();
585
            int historySize = ((Integer) historySizeObj).intValue();
578
            termOptions.setHistorySize(historySize);
586
            termOptions.setHistorySize(historySize);
579
        }
587
        }
580
}//GEN-LAST:event_historySizeSpinnerStateChanged
588
}//GEN-LAST:event_historySizeSpinnerStateChanged
581
589
582
    private void tabSizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tabSizeSpinnerStateChanged
590
    private void tabSizeSpinnerStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tabSizeSpinnerStateChanged
583
        int tabSize = termOptions.getTabSize();
591
        if (inApplyingModel) {
592
            return;
593
        }
584
        Object tabSizeObj = tabSizeSpinner.getValue();
594
        Object tabSizeObj = tabSizeSpinner.getValue();
585
        if (tabSizeObj instanceof Integer) {
595
        if (tabSizeObj instanceof Integer) {
586
            tabSize = ((Integer) tabSizeObj).intValue();
596
            int tabSize = ((Integer) tabSizeObj).intValue();
587
            termOptions.setTabSize(tabSize);
597
            termOptions.setTabSize(tabSize);
588
        }
598
        }
589
}//GEN-LAST:event_tabSizeSpinnerStateChanged
599
}//GEN-LAST:event_tabSizeSpinnerStateChanged
 Lines 615-621    Link Here 
615
625
616
626
617
    private void chooseFont(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseFont
627
    private void chooseFont(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseFont
618
619
        /*
628
        /*
620
        PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
629
        PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
621
        JOptionPane.showOptionDialog(previewPanel,
630
        JOptionPane.showOptionDialog(previewPanel,
 Lines 641-646    Link Here 
641
    }//GEN-LAST:event_ignoreKeymapCheckBoxActionPerformed
650
    }//GEN-LAST:event_ignoreKeymapCheckBoxActionPerformed
642
651
643
    private void foregroundComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_foregroundComboBoxActionPerformed
652
    private void foregroundComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_foregroundComboBoxActionPerformed
653
        if (inApplyingModel) {
654
            return;
655
        }
644
        Color c = ColorComboBox.getColor(foregroundComboBox);
656
        Color c = ColorComboBox.getColor(foregroundComboBox);
645
	if (c != null) {
657
	if (c != null) {
646
	    termOptions.setForeground(c);
658
	    termOptions.setForeground(c);
 Lines 648-653    Link Here 
648
    }//GEN-LAST:event_foregroundComboBoxActionPerformed
660
    }//GEN-LAST:event_foregroundComboBoxActionPerformed
649
661
650
    private void backgroundComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backgroundComboBoxActionPerformed
662
    private void backgroundComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backgroundComboBoxActionPerformed
663
        if (inApplyingModel) {
664
            return;
665
        }
651
        Color c = ColorComboBox.getColor(backgroundComboBox);
666
        Color c = ColorComboBox.getColor(backgroundComboBox);
652
	if (c != null) {
667
	if (c != null) {
653
	    termOptions.setBackground(c);
668
	    termOptions.setBackground(c);
 Lines 655-660    Link Here 
655
    }//GEN-LAST:event_backgroundComboBoxActionPerformed
670
    }//GEN-LAST:event_backgroundComboBoxActionPerformed
656
671
657
    private void selectionComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectionComboBoxActionPerformed
672
    private void selectionComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectionComboBoxActionPerformed
673
        if (inApplyingModel) {
674
            return;
675
        }
658
        Color c = ColorComboBox.getColor(selectionComboBox);
676
        Color c = ColorComboBox.getColor(selectionComboBox);
659
	if (c != null) {
677
	if (c != null) {
660
	    termOptions.setSelectionBackground(c);
678
	    termOptions.setSelectionBackground(c);
(-)a/terminal/src/org/netbeans/modules/terminal/TermAdvancedOption.java (-2 / +1 lines)
 Lines 84-90    Link Here 
84
	termOptions = TermOptions.getDefault(prefs);
84
	termOptions = TermOptions.getDefault(prefs);
85
	clonedTermOptions = termOptions.makeCopy();
85
	clonedTermOptions = termOptions.makeCopy();
86
	panel.setTermOptions(clonedTermOptions);
86
	panel.setTermOptions(clonedTermOptions);
87
88
    }
87
    }
89
88
90
    // implement OptionsPanelController
89
    // implement OptionsPanelController
 Lines 130-136    Link Here 
130
	    // update wasn't called => no changes
129
	    // update wasn't called => no changes
131
	    return false;
130
	    return false;
132
	}
131
	}
133
	clonedTermOptions = termOptions.makeCopy();
132
134
	if (clonedTermOptions == null) {
133
	if (clonedTermOptions == null) {
135
	    return false;
134
	    return false;
136
	} else {
135
	} else {

Return to bug 231105
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo