43ef060972a6ee14830f7b90a26c3c0ce936ccb5
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / colors / ColorsView.java
1 /*******************************************************************************
2 * Copyright (c) 2010, 2015 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Patrick Tasse - Initial API and implementation
11 * Bernd Hufmann - Updated to use RGB for the tick color
12 *******************************************************************************/
13
14 package org.eclipse.tracecompass.tmf.ui.views.colors;
15
16 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
17
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.List;
21
22 import org.eclipse.jdt.annotation.NonNull;
23 import org.eclipse.jface.action.Action;
24 import org.eclipse.jface.action.IToolBarManager;
25 import org.eclipse.jface.action.Separator;
26 import org.eclipse.jface.dialogs.MessageDialog;
27 import org.eclipse.jface.resource.ImageDescriptor;
28 import org.eclipse.jface.window.Window;
29 import org.eclipse.swt.SWT;
30 import org.eclipse.swt.custom.ScrolledComposite;
31 import org.eclipse.swt.events.MouseAdapter;
32 import org.eclipse.swt.events.MouseEvent;
33 import org.eclipse.swt.events.MouseListener;
34 import org.eclipse.swt.events.PaintEvent;
35 import org.eclipse.swt.events.PaintListener;
36 import org.eclipse.swt.events.SelectionAdapter;
37 import org.eclipse.swt.events.SelectionEvent;
38 import org.eclipse.swt.graphics.Color;
39 import org.eclipse.swt.graphics.GC;
40 import org.eclipse.swt.graphics.Image;
41 import org.eclipse.swt.graphics.Point;
42 import org.eclipse.swt.graphics.RGB;
43 import org.eclipse.swt.graphics.Rectangle;
44 import org.eclipse.swt.layout.GridData;
45 import org.eclipse.swt.layout.GridLayout;
46 import org.eclipse.swt.widgets.Button;
47 import org.eclipse.swt.widgets.Canvas;
48 import org.eclipse.swt.widgets.ColorDialog;
49 import org.eclipse.swt.widgets.Composite;
50 import org.eclipse.swt.widgets.Control;
51 import org.eclipse.swt.widgets.Display;
52 import org.eclipse.swt.widgets.FileDialog;
53 import org.eclipse.swt.widgets.Label;
54 import org.eclipse.swt.widgets.Shell;
55 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
56 import org.eclipse.tracecompass.internal.tmf.ui.Messages;
57 import org.eclipse.tracecompass.tmf.core.filter.ITmfFilter;
58 import org.eclipse.tracecompass.tmf.ui.views.TmfView;
59 import org.eclipse.tracecompass.tmf.ui.views.filter.FilterDialog;
60 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphColorScheme;
61 import org.eclipse.ui.IActionBars;
62
63 /**
64 * Color view implementation. This view provides support for managing color settings for filters.
65 *
66 * @version 1.0
67 * @author Patrick Tasse
68 *
69 */
70 public class ColorsView extends TmfView {
71
72 /** ID for the color view */
73 public static final @NonNull String ID = "org.eclipse.linuxtools.tmf.ui.views.colors"; //$NON-NLS-1$
74
75 private static final Image ADD_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/add_button.gif"); //$NON-NLS-1$
76 private static final Image DELETE_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/delete_button.gif"); //$NON-NLS-1$
77 private static final Image MOVE_UP_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/moveup_button.gif"); //$NON-NLS-1$
78 private static final Image MOVE_DOWN_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/movedown_button.gif"); //$NON-NLS-1$
79 private static final Image IMPORT_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/import_button.gif"); //$NON-NLS-1$
80 private static final Image EXPORT_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/export_button.gif"); //$NON-NLS-1$
81
82 // ------------------------------------------------------------------------
83 // Main data structures
84 // ------------------------------------------------------------------------
85
86 /**
87 * The composite shell.
88 */
89 protected Shell fShell;
90 /**
91 * The main composite (scrolled composite)
92 */
93 protected ScrolledComposite fScrolledComposite;
94 /**
95 * The list composite.
96 */
97 protected Composite fListComposite;
98 /**
99 * The filler composite.
100 */
101 protected Composite fFillerComposite;
102 /**
103 * The selected color settings row
104 */
105 protected ColorSettingRow fSelectedRow = null;
106 /**
107 * The color scheme instance for managing colors
108 */
109 protected TimeGraphColorScheme traceColorScheme = new TimeGraphColorScheme();
110 /**
111 * An action to add a color settings row
112 */
113 protected Action fAddAction;
114 /**
115 * An action to delete a color settings row
116 */
117 protected Action fDeleteAction;
118 /**
119 * An action to move up a color settings row in the list.
120 */
121 protected Action fMoveUpAction;
122 /**
123 * An action to move down a color settings row in the list.
124 */
125 protected Action fMoveDownAction;
126 /**
127 * An action to import color settings from file.
128 */
129 protected Action fImportAction;
130 /**
131 * An action to export color settings from file.
132 */
133 protected Action fExportAction;
134 /**
135 * The list of existing color settings
136 */
137 protected List<ColorSetting> fColorSettings;
138
139 // ------------------------------------------------------------------------
140 // Constructor
141 // ------------------------------------------------------------------------
142
143 /**
144 * Default Constructor
145 */
146 public ColorsView() {
147 super("Colors"); //$NON-NLS-1$
148 }
149
150 @Override
151 public void createPartControl(Composite parent) {
152 fShell = parent.getShell();
153
154 fScrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
155 fScrolledComposite.setExpandHorizontal(true);
156 fScrolledComposite.setExpandVertical(true);
157 fListComposite = new Composite(fScrolledComposite, SWT.NONE);
158 fScrolledComposite.setContent(fListComposite);
159
160 GridLayout gl = new GridLayout();
161 gl.marginHeight = 0;
162 gl.marginWidth = 0;
163 gl.verticalSpacing = 1;
164 fListComposite.setLayout(gl);
165
166 fColorSettings = new ArrayList<>(Arrays.asList(ColorSettingsManager.getColorSettings()));
167 for (ColorSetting colorSetting : fColorSettings) {
168 new ColorSettingRow(fListComposite, colorSetting);
169 }
170
171 fFillerComposite = new Composite(fListComposite, SWT.NONE);
172 GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
173 gd.heightHint = 0;
174 fFillerComposite.setLayoutData(gd);
175 gl = new GridLayout();
176 gl.marginHeight = 1;
177 gl.marginWidth = 1;
178 fFillerComposite.setLayout(gl);
179 Label fillerLabel = new Label(fFillerComposite, SWT.NONE);
180 fillerLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
181 fillerLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
182
183 fFillerComposite.addPaintListener(new PaintListener() {
184 @Override
185 public void paintControl(PaintEvent e) {
186 if (fSelectedRow == null) {
187 Color lineColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
188 Point p = fFillerComposite.getSize();
189 GC gc = e.gc;
190 gc.setForeground(lineColor);
191 gc.drawLine(0, 0, p.x - 1, 0);
192 }
193 }
194 });
195
196 MouseListener mouseListener = new MouseAdapter() {
197 @Override
198 public void mouseDown(MouseEvent e) {
199 fSelectedRow = null;
200 refresh();
201 }
202 };
203 fillerLabel.addMouseListener(mouseListener);
204
205 fScrolledComposite.setMinSize(fListComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
206
207 fillToolBar();
208 }
209
210 @Override
211 public void setFocus() {
212 fScrolledComposite.setFocus();
213 }
214
215 /**
216 * Refreshes the view display and updates the view actions enablements.
217 */
218 public void refresh() {
219 fListComposite.layout();
220 fScrolledComposite.setMinSize(fListComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
221 fListComposite.redraw(0, 0, fListComposite.getBounds().width, fListComposite.getBounds().height, true);
222 if (fSelectedRow == null) {
223 fDeleteAction.setEnabled(false);
224 fMoveUpAction.setEnabled(false);
225 fMoveDownAction.setEnabled(false);
226 } else {
227 fDeleteAction.setEnabled(true);
228 fMoveUpAction.setEnabled(true);
229 fMoveDownAction.setEnabled(true);
230 }
231 }
232
233 private void fillToolBar() {
234
235 fAddAction = new AddAction();
236 fAddAction.setImageDescriptor(ImageDescriptor.createFromImage(ADD_IMAGE));
237 fAddAction.setToolTipText(Messages.ColorsView_AddActionToolTipText);
238
239 fDeleteAction = new DeleteAction();
240 fDeleteAction.setImageDescriptor(ImageDescriptor.createFromImage(DELETE_IMAGE));
241 fDeleteAction.setToolTipText(Messages.ColorsView_DeleteActionToolTipText);
242 fDeleteAction.setEnabled(false);
243
244 fMoveUpAction = new MoveUpAction();
245 fMoveUpAction.setImageDescriptor(ImageDescriptor.createFromImage(MOVE_UP_IMAGE));
246 fMoveUpAction.setToolTipText(Messages.ColorsView_MoveUpActionToolTipText);
247 fMoveUpAction.setEnabled(false);
248
249 fMoveDownAction = new MoveDownAction();
250 fMoveDownAction.setImageDescriptor(ImageDescriptor.createFromImage(MOVE_DOWN_IMAGE));
251 fMoveDownAction.setToolTipText(Messages.ColorsView_MoveDownActionToolTipText);
252 fMoveDownAction.setEnabled(false);
253
254 fExportAction = new ExportAction();
255 fExportAction.setImageDescriptor(ImageDescriptor.createFromImage(EXPORT_IMAGE));
256 fExportAction.setToolTipText(Messages.ColorsView_ExportActionToolTipText);
257
258 fImportAction = new ImportAction();
259 fImportAction.setImageDescriptor(ImageDescriptor.createFromImage(IMPORT_IMAGE));
260 fImportAction.setToolTipText(Messages.ColorsView_ImportActionToolTipText);
261
262 IActionBars bars = getViewSite().getActionBars();
263 IToolBarManager manager = bars.getToolBarManager();
264 manager.add(fAddAction);
265 manager.add(fDeleteAction);
266 manager.add(fMoveUpAction);
267 manager.add(fMoveDownAction);
268 manager.add(new Separator());
269 manager.add(fExportAction);
270 manager.add(fImportAction);
271 }
272
273 private class AddAction extends Action {
274 @Override
275 public void run() {
276 ColorSetting colorSetting = new ColorSetting(
277 checkNotNull(Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()),
278 checkNotNull(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()),
279 checkNotNull(Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()),
280 null);
281 ColorSettingRow row = new ColorSettingRow(fListComposite, colorSetting);
282 if (fSelectedRow == null) {
283 fColorSettings.add(colorSetting);
284 row.moveAbove(fFillerComposite);
285 } else {
286 fColorSettings.add(fColorSettings.indexOf(fSelectedRow.getColorSetting()), colorSetting);
287 row.moveAbove(fSelectedRow);
288 }
289 fSelectedRow = row;
290 refresh();
291 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
292 }
293 }
294
295 private class DeleteAction extends Action {
296
297 @Override
298 public void run() {
299 if (fSelectedRow != null) {
300 int index = fColorSettings.indexOf(fSelectedRow.getColorSetting());
301 fColorSettings.remove(index);
302 fSelectedRow.fColorSetting.dispose();
303 fSelectedRow.dispose();
304 if (index < fColorSettings.size()) {
305 fSelectedRow = (ColorSettingRow) fListComposite.getChildren()[index];
306 } else {
307 fSelectedRow = null;
308 }
309 refresh();
310 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
311 }
312 }
313 }
314
315 private class MoveUpAction extends Action {
316 @Override
317 public void run() {
318 if (fSelectedRow != null) {
319 int index = fColorSettings.indexOf(fSelectedRow.getColorSetting());
320 if (index > 0) {
321 fColorSettings.add(index - 1, fColorSettings.remove(index));
322 fSelectedRow.moveAbove(fListComposite.getChildren()[index - 1]);
323 refresh();
324 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
325 }
326 }
327 }
328 }
329
330 private class MoveDownAction extends Action {
331 @Override
332 public void run() {
333 if (fSelectedRow != null) {
334 int index = fColorSettings.indexOf(fSelectedRow.getColorSetting());
335 if (index < fColorSettings.size() - 1) {
336 fColorSettings.add(index + 1, fColorSettings.remove(index));
337
338 fSelectedRow.moveBelow(fListComposite.getChildren()[index + 1]);
339 refresh();
340 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
341 }
342 }
343 }
344 }
345
346 private class ExportAction extends Action {
347 @Override
348 public void run() {
349 FileDialog fileDialog = new FileDialog(fShell, SWT.SAVE);
350 fileDialog.setFilterExtensions(new String[] {"*.xml"}); //$NON-NLS-1$
351 fileDialog.setOverwrite(true);
352 String pathName = fileDialog.open();
353 if (pathName != null) {
354 ColorSettingsXML.save(pathName, fColorSettings.toArray(new ColorSetting[0]));
355 }
356 }
357 }
358
359 private class ImportAction extends Action {
360 @Override
361 public void run() {
362 FileDialog fileDialog = new FileDialog(fShell, SWT.OPEN);
363 fileDialog.setFilterExtensions(new String[] {"*.xml"}); //$NON-NLS-1$
364 String pathName = fileDialog.open();
365 if (pathName != null) {
366 ColorSetting[] colorSettings = ColorSettingsXML.load(pathName);
367 if (colorSettings.length > 0) {
368 if (fColorSettings.size() > 0) {
369 boolean overwrite = MessageDialog.openQuestion(fShell,
370 Messages.ColorsView_ImportOverwriteDialogTitle,
371 Messages.ColorsView_ImportOverwriteDialogMessage1 +
372 Messages.ColorsView_ImportOverwriteDialogMessage2);
373 if (overwrite) {
374 for (Control control : fListComposite.getChildren()) {
375 if (control instanceof ColorSettingRow) {
376 ((ColorSettingRow) control).fColorSetting.dispose();
377 control.dispose();
378 }
379 }
380 fColorSettings = new ArrayList<>();
381 fSelectedRow = null;
382 }
383 }
384 for (ColorSetting colorSetting : colorSettings) {
385 ColorSettingRow row = new ColorSettingRow(fListComposite, colorSetting);
386 if (fSelectedRow == null) {
387 fColorSettings.add(colorSetting);
388 row.moveAbove(fFillerComposite);
389 } else {
390 fColorSettings.add(fColorSettings.indexOf(fSelectedRow.getColorSetting()), colorSetting);
391 row.moveAbove(fSelectedRow);
392 }
393 }
394 refresh();
395 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
396 }
397 }
398 }
399 }
400
401 private class ColorSettingRow extends Composite {
402
403 ColorSetting fColorSetting;
404
405 public ColorSettingRow(final Composite parent, final ColorSetting colorSetting) {
406 super(parent, SWT.NONE);
407 fColorSetting = colorSetting;
408
409 setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
410
411 setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
412 GridLayout gl = new GridLayout(7, false);
413 gl.marginHeight = 1;
414 gl.marginWidth = 1;
415 gl.horizontalSpacing = 1;
416 gl.verticalSpacing = 0;
417 setLayout(gl);
418
419 final Button fgButton = new Button(this, SWT.PUSH);
420 fgButton.setText(Messages.ColorsView_ForegroundButtonText);
421 fgButton.setSize(fgButton.computeSize(SWT.DEFAULT, 19));
422 fgButton.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
423
424 final Button bgButton = new Button(this, SWT.PUSH);
425 bgButton.setText(Messages.ColorsView_BackgroundButtonText);
426 bgButton.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
427
428 final Composite labelComposite = new Composite(this, SWT.NONE);
429 labelComposite.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false));
430 gl = new GridLayout();
431 gl.marginHeight = 0;
432 gl.marginWidth = 0;
433 labelComposite.setLayout(gl);
434 labelComposite.setBackground(colorSetting.getBackgroundColor());
435
436 final Label label = new Label(labelComposite, SWT.NONE);
437 label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, true));
438 label.setText(" Text "); //$NON-NLS-1$
439 label.setForeground(colorSetting.getForegroundColor());
440 label.setBackground(colorSetting.getBackgroundColor());
441
442 fgButton.addSelectionListener(new SelectionAdapter() {
443 @Override
444 public void widgetSelected(SelectionEvent e) {
445 fSelectedRow = ColorSettingRow.this;
446 refresh();
447 ColorDialog dialog = new ColorDialog(fShell);
448 dialog.setRGB(colorSetting.getForegroundRGB());
449 dialog.setText(Messages.ColorsView_ForegroundDialogText);
450 dialog.open();
451 RGB rgb = dialog.getRGB();
452 if (rgb != null) {
453 colorSetting.setForegroundRGB(rgb);
454 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
455 label.setForeground(colorSetting.getForegroundColor());
456 }
457 }});
458
459 bgButton.addSelectionListener(new SelectionAdapter() {
460 @Override
461 public void widgetSelected(SelectionEvent e) {
462 fSelectedRow = ColorSettingRow.this;
463 refresh();
464 ColorDialog dialog = new ColorDialog(fShell);
465 dialog.setRGB(colorSetting.getBackgroundRGB());
466 dialog.setText(Messages.ColorsView_BackgroundDialogText);
467 dialog.open();
468 RGB rgb = dialog.getRGB();
469 if (rgb != null) {
470 colorSetting.setBackgroundRGB(rgb);
471 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
472 labelComposite.setBackground(colorSetting.getBackgroundColor());
473 label.setBackground(colorSetting.getBackgroundColor());
474 }
475 }});
476
477 final Button tickButton = new Button(this, SWT.PUSH);
478 tickButton.setText(Messages.ColorsView_TickButtonText);
479 tickButton.setSize(tickButton.computeSize(SWT.DEFAULT, 19));
480 tickButton.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
481
482 final Canvas tickCanvas = new Canvas(this, SWT.NONE);
483 GridData gd = new GridData(SWT.CENTER, SWT.FILL, false, false);
484 gd.widthHint = 12;
485 gd.heightHint = bgButton.getSize().y;
486 tickCanvas.setLayoutData(gd);
487 tickCanvas.setBackground(traceColorScheme.getBkColor(false, false, false));
488 tickCanvas.addPaintListener(new PaintListener() {
489 @Override
490 public void paintControl(PaintEvent e) {
491 Rectangle bounds = tickCanvas.getBounds();
492 e.gc.setForeground(traceColorScheme.getColor(TimeGraphColorScheme.MID_LINE));
493 int midy = bounds.y + bounds.height / 2 - 1;
494 //int midy = e.y + e.height / 2;
495 e.gc.drawLine(e.x, midy, e.x + e.width, midy);
496 Rectangle rect = new Rectangle(e.x + 1, bounds.y + 2, 0, bounds.height - 6);
497 for (int i = 1; i <= 3; i++) {
498 rect.x += i;
499 rect.width = i;
500 e.gc.setBackground(fColorSetting.getTickColor());
501 e.gc.fillRectangle(rect);
502 }
503 }});
504
505 tickButton.addSelectionListener(new SelectionAdapter() {
506 @Override
507 public void widgetSelected(SelectionEvent e) {
508 fSelectedRow = ColorSettingRow.this;
509 ColorDialog dialog = new ColorDialog(fShell);
510 dialog.setRGB(colorSetting.getTickColorRGB());
511 dialog.setText(Messages.TickColorDialog_TickColorDialogTitle);
512 dialog.open();
513 RGB rgb = dialog.getRGB();
514 if (rgb != null) {
515 colorSetting.setTickColorRGB(rgb);
516 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
517 refresh();
518 }
519 }});
520
521 final Button filterButton = new Button(this, SWT.PUSH);
522 filterButton.setText(Messages.ColorsView_FilterButtonText);
523 filterButton.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
524
525 final Label filterText = new Label(this, SWT.NONE);
526 ITmfFilter filter = colorSetting.getFilter();
527 if (filter != null) {
528 filterText.setText(filter.toString());
529 filterText.setToolTipText(filter.toString());
530 }
531 filterText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
532 filterText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
533
534 filterButton.addSelectionListener(new SelectionAdapter() {
535 @Override
536 public void widgetSelected(SelectionEvent e) {
537 fSelectedRow = ColorSettingRow.this;
538 refresh();
539 FilterDialog dialog = new FilterDialog(fShell);
540 dialog.setFilter(colorSetting.getFilter());
541 dialog.open();
542 if (dialog.getReturnCode() == Window.OK) {
543 if (dialog.getFilter() != null) {
544 colorSetting.setFilter(dialog.getFilter());
545 filterText.setText(dialog.getFilter().toString());
546 filterText.setToolTipText(dialog.getFilter().toString());
547 } else {
548 colorSetting.setFilter(null);
549 filterText.setText(""); //$NON-NLS-1$
550 filterText.setToolTipText(""); //$NON-NLS-1$
551 }
552 ColorSettingsManager.setColorSettings(fColorSettings.toArray(new ColorSetting[0]));
553 refresh();
554 }
555 }});
556
557 addPaintListener(new PaintListener() {
558 @Override
559 public void paintControl(PaintEvent e) {
560 if (fSelectedRow == ColorSettingRow.this) {
561 Color borderColor = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
562 Point p = ColorSettingRow.this.getSize();
563 Rectangle rect = new Rectangle(0, 0, p.x - 1, p.y - 1);
564 GC gc = e.gc;
565 gc.setForeground(borderColor);
566 gc.drawRectangle(rect);
567 }
568 }
569 });
570
571 MouseListener mouseListener = new MouseAdapter() {
572 @Override
573 public void mouseDown(MouseEvent e) {
574 fSelectedRow = ColorSettingRow.this;
575 refresh();
576 }
577 };
578 addMouseListener(mouseListener);
579 label.addMouseListener(mouseListener);
580 tickCanvas.addMouseListener(mouseListener);
581 filterText.addMouseListener(mouseListener);
582 }
583
584 /**
585 * @return the ColorSetting
586 */
587 public ColorSetting getColorSetting() {
588 return fColorSetting;
589 }
590
591 }
592 }
This page took 0.044666 seconds and 4 git commands to generate.