-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
danschultz
committed
Mar 8, 2011
1 parent
a052451
commit 47251fc
Showing
12 changed files
with
316 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.CheckBox; | ||
|
||
public class CheckBoxField extends FormField | ||
{ | ||
private var _checkBox:spark.components.CheckBox; | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public function CheckBoxField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @private | ||
*/ | ||
override protected function createChildren():void | ||
{ | ||
super.createChildren(); | ||
|
||
_checkBox = new spark.components.CheckBox(); | ||
addElement(_checkBox); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.ComboBox; | ||
import spark.components.List; | ||
|
||
public class ComboBoxField extends ListField | ||
{ | ||
public function ComboBoxField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
override protected function createList():List | ||
{ | ||
return new ComboBox(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.DropDownList; | ||
import spark.components.List; | ||
|
||
public class DropDownListField extends ListField | ||
{ | ||
public function DropDownListField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
override protected function createList():List | ||
{ | ||
return new DropDownList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import mesh.Entity; | ||
|
||
import spark.components.Form; | ||
|
||
public class Form extends spark.components.Form | ||
{ | ||
/** | ||
* Constructor. | ||
*/ | ||
public function Form() | ||
{ | ||
super(); | ||
} | ||
|
||
private var _entity:Entity; | ||
/** | ||
* | ||
*/ | ||
public function get entity():Entity | ||
{ | ||
return _entity; | ||
} | ||
public function set entity(value:Entity):void | ||
{ | ||
_entity = value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import mesh.core.inflection.humanize; | ||
import mesh.core.string.capitalize; | ||
|
||
import spark.components.FormItem; | ||
|
||
public class FormField extends FormItem | ||
{ | ||
public function FormField() | ||
{ | ||
super(); | ||
} | ||
|
||
private var _property:String; | ||
/** | ||
* The property name on the entity to use. | ||
*/ | ||
public function get property():String | ||
{ | ||
return _property; | ||
} | ||
public function set property(value:String):void | ||
{ | ||
_property = value; | ||
|
||
if (label == null || label.length == 0) { | ||
label = capitalize(humanize(value)); | ||
} | ||
} | ||
|
||
private var _value:Object; | ||
/** | ||
* The value for the control of this field. | ||
*/ | ||
public function get value():Object | ||
{ | ||
return _value; | ||
} | ||
public function set value(value:Object):void | ||
{ | ||
_value = value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.List; | ||
|
||
public class ListField extends FormField | ||
{ | ||
public function ListField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @private | ||
*/ | ||
override protected function createChildren():void | ||
{ | ||
super.createChildren(); | ||
addElement(createList()); | ||
} | ||
|
||
/** | ||
* Creates a list that is configured for this form field. | ||
* | ||
* @return A new lsit. | ||
*/ | ||
protected function createList():List | ||
{ | ||
return new List(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.TextInput; | ||
|
||
public class NumberField extends TextField | ||
{ | ||
public function NumberField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
override protected function createTextField():TextInput | ||
{ | ||
var textField:TextInput = super.createTextField(); | ||
textField.restrict = "0-9.,"; | ||
return textField; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.TextInput; | ||
|
||
public class PasswordField extends TextField | ||
{ | ||
public function PasswordField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
override protected function createTextField():TextInput | ||
{ | ||
var textField:TextInput = super.createTextField(); | ||
textField.displayAsPassword = true; | ||
return textField; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.RadioButton; | ||
|
||
public class RadioButton extends FormField | ||
{ | ||
private var _radioButton:spark.components.RadioButton; | ||
|
||
public function RadioButton() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @private | ||
*/ | ||
override protected function childrenCreated():void | ||
{ | ||
super.createChildren(); | ||
|
||
_radioButton = new spark.components.RadioButton(); | ||
_radioButton.groupName = property; | ||
_radioButton.label = value.toString(); | ||
addElement(_radioButton); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
public class RadioButtonGroupField extends FormField | ||
{ | ||
public function RadioButtonGroupField() | ||
{ | ||
super(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.TextArea; | ||
|
||
public class TextAreaField extends FormField | ||
{ | ||
private var _textArea:spark.components.TextArea | ||
|
||
public function TextAreaField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @private | ||
*/ | ||
override protected function createChildren():void | ||
{ | ||
super.createChildren(); | ||
|
||
_textArea = new spark.components.TextArea(); | ||
addElement(_textArea); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package mesh.view.helpers.form | ||
{ | ||
import spark.components.TextInput; | ||
|
||
public class TextField extends FormField | ||
{ | ||
/** | ||
* Constructor. | ||
*/ | ||
public function TextField() | ||
{ | ||
super(); | ||
} | ||
|
||
/** | ||
* @private | ||
*/ | ||
override protected function createChildren():void | ||
{ | ||
super.createChildren(); | ||
addElement(createTextField()); | ||
} | ||
|
||
/** | ||
* Creates a text input field that is configured for this form field. | ||
* | ||
* @return A new text input. | ||
*/ | ||
protected function createTextField():TextInput | ||
{ | ||
return new TextInput(); | ||
} | ||
} | ||
} |