 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.dialog.gameobjectattributes;
22 import java.awt.Container;
23 import java.awt.GridLayout;
24 import java.awt.event.ActionEvent;
25 import javax.swing.AbstractAction;
26 import javax.swing.JCheckBox;
27 import javax.swing.JOptionPane;
28 import javax.swing.JPanel;
29 import javax.swing.event.ChangeEvent;
30 import javax.swing.event.ChangeListener;
38 import org.jetbrains.annotations.NotNull;
39 import org.jetbrains.annotations.Nullable;
83 public void stateChanged(
final ChangeEvent e) {
95 public void stateChanged(
final ChangeEvent e) {
122 gridPanel =
new JPanel(
new GridLayout(0, 2, 3, 3));
124 final int number = attributeBitmask.
getNumber();
127 for (
int i = 0; i < number; i++) {
136 if (
gridPanel.getComponentCount() % 2 != 0) {
147 if (newValue !=
null) {
158 }
catch (
final CloneNotSupportedException ex) {
159 throw new AssertionError(ex);
172 final String title =
"Choose " + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
185 final int number = attributeBitmask.
getNumber();
187 for (
int i = 0; i < number; i++) {
201 for (
int i = 0; i < number; i++) {
214 final int number = attributeBitmask.
getNumber();
215 for (
int i = 0; i < number; i++) {
230 final int number = attributeBitmask.
getNumber();
232 for (i = 0; i < number; i++) {
240 final boolean state =
checkbox[i++].isSelected();
257 private static boolean isActive(
final int index,
final int mask) {
258 final int bit = 1 << (index - 1);
259 return (mask & bit) == bit;
Defines types of GameObjects with corresponding attributes.
int getNumber()
Returns the number of bitmask entries (not counting zero).
Implements TristateCheckBox, a JCheckBox variant that supports three states: deselected,...
AttributeBitmask getBitmask()
int getValue()
Returns the currently selected values.
Base package of all Gridarta classes.
A JCheckBox that supports three states: deselected, indeterminate, selected.
final TristateCheckBox allCheckbox
The all-bits check box.
void setValue(final int value)
Set the active bitmask value.
final Container gridPanel
The top-level container of the dialog.
void setValue()
Sets the currently selected values to the default values.
final ChangeListener allChangeListener
The ChangeListener attached to the "All" check box.
Reflects a game object (object on a map).
Graphical User Interface of Gridarta.
String getBitName(final int index)
Returns the name of a bitmask value.
A TristateCheckBox that skips the indeterminate state when activated.
void setAllBits(final boolean state)
Sets all bit-value check boxes to the given state.
Integer showBitmaskDialog()
Open a popup frame to select bitmask-entries via choose boxes.
GameObjects are the objects based on Archetypes found on maps.
MaskChangeAL< G, A, R > clone()
ActionListener for the change buttons of bitmasks.
final DialogAttributeBitmask< G, A, R > dialogAttributeBitmask
The DialogAttributeBitmask where this change button belongs to.
This class manages bitmask values which appear in Gridarta archetype attributes.
static final long serialVersionUID
The serial version UID.
int getValue()
Get the active bitmask value.
Interface for MapArchObjects.
static boolean isActive(final int index, final int mask)
Check whether the given bit-index is an active bit in the bitmask.
TristateState getBitState()
Returns the TristateState that reflects the current state of all bit-value check boxes.
Possible states for TristateButtonModels.
final ChangeListener singleChangeListener
The ChangeListener attached to all single-bit check boxes.
static TristateState getTristateState(final boolean state)
Returns the tristate state for a boolean state.
final JCheckBox[] checkbox
The single-bit check boxes.
TristateButtonModel getTristateModel()
Returns the model as a TristateButtonModel.
MaskChangeAL(@NotNull final String label, @NotNull final DialogAttributeBitmask< G, A, R > dialogAttributeBitmask)
Constructor.
void actionPerformed(@NotNull final ActionEvent e)
Component getInput()
Returns the input ui component for editing the value.