summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/BooleanPropertyEditor.java
blob: 83db2633921887eed425980ebaade4e184bc87ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package NET.worlds.scape;

import NET.worlds.console.PolledDialog;

public class BooleanPropertyEditor extends PropEditor {
   private String[] choices;
   private String falseName;
   private String trueName;

   private BooleanPropertyEditor(Property property, String falseName, String trueName) {
      super(property);
      this.falseName = falseName;
      this.trueName = trueName;
   }

   @Override
   public PolledDialog edit(EditTile parent, String title) {
      String[] choices = new String[]{this.falseName, this.trueName};
      return new BooleanFieldEditorDialog(parent, title, this.property, choices);
   }

   public static Property make(Property property, String falseName, String trueName) {
      property.setPropertyType(0);
      return property.setEditor(new BooleanPropertyEditor(property, falseName, trueName));
   }
}