Flex cron expression Generator

Source: Internet
Author: User
Tags ming

Let's see the interface!

Cron. mxml:

<? XML version = "1.0" encoding = "UTF-8"?> <S: Application xmlns: FX = "http://ns.adobe.com/mxml/2009" xmlns: S = "Library: // ns.adobe.com/flex/spark" xmlns: MX = "Library: // ns.adobe.com/flex/mx "width =" 50% "Height =" 80% "creationcomplete =" Start () "> <s: layout> <s: verticallayout/> </s: layout> <FX: SCRIPT> <! [CDATA [import MX. controls. alert; import MX. events. flexevent; import MX. utils. stringutil; import spark. components. checkbox; private var check: extendscheckbox; protected function start (): void {} [Bindable] public var minarr: array = new array (); Private function initmin (): void {for (var I: Int = 0; I <60; I ++) {check = new extendscheckbox (); check. id = "min" + I; check. label = "" + I; check. selected = false; check. value = "" + I; Mi Narr. push (check); mintimes. addelement (check) ;}} [Bindable] public var hourarr: array = new array (); Private function inithour (): void {for (var I: Int = 0; I <24; I ++) {check = new extendscheckbox (); check. id = "Hour" + I; check. label = "" + I; check. selected = false; check. value = "" + I; hourarr. push (check); hourtimes. addelement (check) ;}} [Bindable] public var dayarr: array = new array (); Private function initday (): void {for (VA R I: Int = 1; I <= 31; I ++) {check = new extendscheckbox (); check. id = "day" + I; check. label = "" + I; check. selected = false; check. value = "" + I; dayarr. push (check); daytimes. addelement (check) ;}} [Bindable] public var montharr: array = new array (); Private function initmonth (): void {for (var I: Int = 1; I <= 12; I ++) {check = new extendscheckbox (); check. id = "day" + I; check. label = "" + I; check. selected = false; check. value = "" + I; month Arr. push (check); monthtimes. addelement (check) ;}} [Bindable] public var weekarr: array = new array (); Private function initweek (): void {for (var I: Int = 1; I <= 7; I ++) {check = new extendscheckbox (); check. id = "day" + I; check. label = "Week" + getweek (I); check. selected = false; check. value = "" + I; weekarr. push (check); weektimes. addelement (check) ;}} private function getweek (W: INT): String {Switch (w) {case (1): Return "1"; Case (2): Return "2"; Case (3): Return "3"; Case (4): Return "4"; Case (5): Return "5 "; case (6): Return "6"; Case (7): Return "day";} return NULL;} protected function getneratecron (Event: mouseevent): void {var RS: string = "0"; // 0 seconds // minute if (mincycle. selected) {Rs + = starttime. text + "/" + cycletime. text + "";} else {Rs + = gettime (minarr) + "";} // hour if (hourcycle = NULL | hourcycle. selected) {Rs + = "*" ;}else {Rs + = gettime (hourarr) + ";}// day note That is, as long as week works, day does not work? If (isuseweek = NULL | isuseweek. Selected) {Rs + = "? ";} Elseif (daycycle = NULL | daycycle. selected) {Rs + = "*";} else {Rs + = gettime (dayarr) + ";} // month if (monthcycle = NULL | monthcycle. selected) {Rs + = "*" ;}else {Rs + = gettime (montharr) + ";}// week note that day does not work as long as week works? If (isuseweek = NULL | isuseweek. selected) {If (weekcycle = NULL | weekcycle. selected) {Rs + = "*";} else {Rs + = gettime (weekarr) + "" ;}} else {Rs + = "? ";} Resultstr. TEXT = stringutil. trim (RS);} // get the checkbox time setting private function gettime (RR: array): String {var RS: String = "" For (var I: Int = 0; I <RR. length; I ++) {var check: extendscheckbox = extendscheckbox (RR [I]); If (check. selected) {Rs + = check. value + "," ;}} if (RS. length! = 0) {rs = Rs. substring (0, Rs. Length-1);} else {// alert. Show ("select a time! "," Prompt "); RS + =" * "} Return Rs;}]> </FX: SCRIPT> <FX: declarations> <! -- Place non-visual elements (such as services and value objects) Here --> </FX: declarations> <mx: tabnavigator left = "10" Top = "10" width = "100%" Height = "80%"> <mx: vbox id = "min" label = "min" paddingleft = "5" paddingtop = "5"> <mx: hbox> <s: radiobutton id = "mincycle" label = "loop" groupname = "Ming" selected = "true"/> <s: radiobutton label = "timed" groupname = "Ming"/> </MX: hbox> <mx: hbox id = "cyclebox" width = "100%" visible = "{mincycle. selected} "> <s: Label text =" "/> <s: textinp Ut id = "starttime" maxchars = "2" visible = "true" width = "100" text = "{starttimespinner. value} "/> <s: spinner id =" starttimespinner "allowvaluewrap =" true "Maximum =" 60 "minimum =" 0 "stepsize =" 1 "/> <s: label text = "Start, every"/> <s: textinput id = "cycletime" maxchars = "50" visible = "true" text = "{cycletimespinner. value} "/> <s: spinner id =" cycletimespinner "allowvaluewrap =" true "Maximum =" 60 "minimum =" 1 "stepsize =" 1 "/> <s: Labe L text = "Run Once"/> </MX: hbox> <s: tilegroup id = "mintimes" visible = "{! Mincycle. selected} "creationcomplete =" initmin () "> </S: tilegroup> </MX: vbox> <mx: vbox label =" Hour "> <mx: hbox> <s: radiobutton id = "hourcycle" label = "every hour" groupname = "hourg" selected = "true"/> <s: radiobutton label = "timed" groupname = "hourg"/> </MX: hbox> <s: tilegroup id = "hourtimes" visible = "{! Hourcycle. selected} "creationcomplete =" inithour () "> </S: tilegroup> </MX: vbox> <mx: vbox label =" day "> <mx: hbox> <s: radiobutton id = "daycycle" label = "everyday" groupname = "dayg" selected = "true"/> <s: radiobutton label = "timed" groupname = "dayg"/> </MX: hbox> <s: tilegroup id = "daytimes" visible = "{! Daycycle. selected} "creationcomplete =" initday () "> </S: tilegroup> </MX: vbox> <mx: vbox label =" month "> <mx: hbox> <s: radiobutton id = "monthcycle" label = "group" groupname =" monthg "selected =" true "/> <s: radiobutton label = "timed" groupname = "monthg"/> </MX: hbox> <s: tilegroup id = "monthtimes" visible = "{! Monthcycle. selected} "creationcomplete =" initmonth () "/> </MX: vbox> <mx: vbox label =" Week "> <s: checkbox id = "isuseweek" label = "whether week is used" selected = "false"/> <mx: vbox visible = "{isuseweek. selected} "> <mx: hbox> <s: radiobutton id =" weekcycle "label =" Weekly "groupname =" weekg "selected =" true "/> <s: radiobutton label = "timed" groupname = "weekg"/> </MX: hbox> <s: tilegroup id = "weektimes" visible = "{! Weekcycle. selected} "creationcomplete =" initweek () "/> </MX: vbox> </MX: tabnavigator> <mx: vbox width = "100%" Height = "50"> <mx: hbox width = "100%" Height = "100%"> <s: Label text = "cronvalue: "/> <s: textinput id =" resultstr "width =" 100% "/> </MX: hbox> <mx: hbox> <s: button label = "generate" Click = "getneratecron (event)"/> <s: button label = "save"/> </MX: hbox> </MX: vbox> </S: Application>

Extendscheckbox.:

package com.gzhdi.backup.cron{import spark.components.CheckBox;public class ExtendsCheckBox extends CheckBox{private var _value:String;public function ExtendsCheckBox(){super();}public function get value():String{return _value;}public function set value(value:String):void{_value = value;}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.