summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/FloatPropertyEditor.java
blob: 90a6099503c13783f4f5b99435deedaf47b69665 (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
27
28
29
30
31
32
33
34
35
package NET.worlds.scape;

import NET.worlds.console.PolledDialog;

public class FloatPropertyEditor extends PropEditor {
   boolean rangeLimits = false;
   float minVal;
   float maxVal;

   private FloatPropertyEditor(Property property) {
      super(property);
   }

   private FloatPropertyEditor(Property property, float minVal, float maxVal) {
      super(property);
      this.rangeLimits = true;
      this.minVal = minVal;
      this.maxVal = maxVal;
   }

   @Override
   public PolledDialog edit(EditTile parent, String title) {
      return new FloatFieldEditorDialog(parent, title, this.property, this);
   }

   public static Property make(Property property) {
      property.setPropertyType(2);
      return property.setEditor(new FloatPropertyEditor(property));
   }

   public static Property make(Property property, float minVal, float maxVal) {
      property.setPropertyType(2);
      return property.setEditor(new FloatPropertyEditor(property, minVal, maxVal));
   }
}