Crossfire JXClient, Trunk
CheckBoxOption.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff
19  * Copyright (C) 2006-2017,2019-2023 Andreas Kirschbaum
20  * Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21  */
22 
23 package com.realtime.crossfire.jxclient.settings.options;
24 
25 import org.jetbrains.annotations.NotNull;
26 
32 public abstract class CheckBoxOption extends Option {
33 
37  @NotNull
38  private final String tooltipText;
39 
43  private boolean checked;
44 
49  protected CheckBoxOption(@NotNull final String tooltipText) {
50  this.tooltipText = tooltipText;
51  }
52 
57  public boolean isChecked() {
58  return checked;
59  }
60 
65  public void setChecked(final boolean checked) {
66  if (this.checked == checked) {
67  return;
68  }
69 
70  this.checked = checked;
72  }
73 
77  public void toggleChecked() {
79  }
80 
86  protected abstract void execute(final boolean checked);
87 
88  @Override
89  protected void fireStateChangedEvent() {
91  super.fireStateChangedEvent();
92  }
93 
98  public abstract boolean isDefaultChecked();
99 
104  @NotNull
105  public String getTooltipText() {
106  return tooltipText;
107  }
108 
109 }
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.execute
abstract void execute(final boolean checked)
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.setChecked
void setChecked(final boolean checked)
Definition: CheckBoxOption.java:65
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.checked
boolean checked
Definition: CheckBoxOption.java:43
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.CheckBoxOption
CheckBoxOption(@NotNull final String tooltipText)
Definition: CheckBoxOption.java:49
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.toggleChecked
void toggleChecked()
Definition: CheckBoxOption.java:77
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.fireStateChangedEvent
void fireStateChangedEvent()
Definition: CheckBoxOption.java:89
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.isChecked
boolean isChecked()
Definition: CheckBoxOption.java:57
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.tooltipText
final String tooltipText
Definition: CheckBoxOption.java:38
com.realtime.crossfire.jxclient.settings.options.Option
Definition: Option.java:33
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.isDefaultChecked
abstract boolean isDefaultChecked()
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption
Definition: CheckBoxOption.java:32
com.realtime.crossfire.jxclient.settings.options.CheckBoxOption.getTooltipText
String getTooltipText()
Definition: CheckBoxOption.java:105