1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc., Jonathan Rajotte-Julien
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.ui
.views
;
12 import java
.util
.function
.Predicate
;
14 import org
.eclipse
.jdt
.annotation
.Nullable
;
15 import org
.eclipse
.swt
.widgets
.Button
;
16 import org
.eclipse
.tracecompass
.internal
.provisional
.analysis
.lami
.core
.aspect
.LamiTableEntryAspect
;
19 * Basic representation of a check box option for dialog.
21 * @author Jonathan Rajotte-Julien
23 class LamiAxisCheckBoxOption
{
25 private final String fName
;
26 private final boolean fDefaultValue
;
27 private @Nullable Button fButton
;
28 private boolean fValue
;
29 private final Predicate
<LamiTableEntryAspect
> fAppliesToAspect
;
35 * The name of the check box. The actual string shown to user.
37 * The default value of the check box.
38 * @param validationPredicate
39 * The predicate to check if an option can be applied to an aspect
41 public LamiAxisCheckBoxOption(String name
, boolean defaultValue
, Predicate
<LamiTableEntryAspect
> validationPredicate
) {
43 this.fDefaultValue
= defaultValue
;
44 this.fValue
= defaultValue
;
46 fAppliesToAspect
= validationPredicate
;
49 public String
getName() {
53 public boolean getDefaultValue() {
57 public void setButton(Button button
) {
61 public boolean getValue() {
65 public void updateValue() {
66 if (fButton
!= null) {
67 fValue
= fButton
.getSelection();
71 public void setButtonEnabled(boolean enabled
) {
72 @Nullable Button button
= fButton
;
74 /* Only change state when necessary */
75 if (button
.getEnabled() != enabled
) {
76 button
.setEnabled(enabled
);
77 button
.setSelection(fDefaultValue
);
82 public boolean getButtonEnabled() {
83 if (fButton
!= null) {
84 return fButton
.getEnabled();
89 public Predicate
<LamiTableEntryAspect
> getPredicate() {
90 return fAppliesToAspect
;
This page took 0.034248 seconds and 5 git commands to generate.