📄 detailsaddcommentpanel.mxml
字号:
<?xml version="1.0" encoding="utf-8"?>
<sharedcomponents:FlexDotOrgWindow
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:sharedcomponents="com.flexShowcase.panels.*"
label="Add A Comment"
width="464"
height="256"
creationComplete="creationCompleteHandler(event)">
<mx:Script>
<![CDATA[
//////////////////////////////////////////////////
//import
import mx.events.ValidationResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.validators.ValidationResult;
//import org.flex.engine.managers.ServiceManager;
import com.flexShowcase.data.*;
import com.flexShowcase.events.*;
//import org.flex.textrestrict.TextRestrictConstants;
//import com.flexShowcase.net.remote.FlexShowcaseServiceConfig;
//////////////////////////////////////////////////
//private variables
//[Bindable] private flexShowcaseServiceConfig:FlexShowcaseServiceConfig;
[Bindable] public var project:Project;
[Bindable]
private var allValid:Boolean;
private var nameValid:Boolean;
private var emailValid:Boolean;
private var commentValid:Boolean;
//////////////////////////////////////////////////
//initialize function
private function creationCompleteHandler(event:Event):void {
//flexEngine = FlexEngine.getInstance();
}
//general----------------------------------------------------------------------------
public function populatePanelWithUserInfo():void {
/* clearAllFields();
if (user.currentUser != null) {
var user:User = user.currentUser;
nameText_mc.text = user.firstName + " " + user.lastName;
emailText_mc.text = user.email;
validateName();
validateEmail();
}
*/
}
private function closePanel():void {
dispatchEvent(new Event(Event.CLOSE));
}
private function clearAllFields():void {
/*
nameValid = false;
emailValid = false;
commentValid = false;
allValid = false;
nameText_mc.text = "";
emailText_mc.text = "";
commentsText_mc.text = "";
nameText_mc.errorString = "";
emailText_mc.errorString = "";
commentsText_mc.errorString = "";
focusManager.setFocus(nameText_mc);
*/
}
//comments--------------------------------------------------------------------
private function saveComment():void {
/*
var res0:ValidationResultEvent = nameValidator.validate();
var res1:ValidationResultEvent = emailValidator.validate();
var res2:ValidationResultEvent = messageValidator.validate();
if (res0.results == null && res1.results == null && res2.results == null) {
postComment();
closePanel();
}
*/
}
private function postComment():void {
//var flexEngine:FlexEngine = FlexEngine.getInstance();
//var serviceManager:ServiceManager = flexEngine.serviceManager;
/*
var comment:Comment = new Comment();
comment.project = user.currentProject;
comment.projectID = user.currentProject.id;
comment.name = nameText_mc.text;
comment.email = emailText_mc.text;
comment.body = commentsText_mc.text;
comment.save();
*/
}
//validation----------------------------------------------------------------------
private function fieldChange(event:Event):void {
/*
var validationResultEvent:ValidationResultEvent;
if (event.target == nameText_mc) {
validateName();
} else if(event.target == emailText_mc) {
validateEmail();
} else if(event.target == commentsText_mc) {
validateComment();
}
checkAllValid();
*/
}
private function validateName():void {
/*
var validationResultEvent:ValidationResultEvent = nameValidator.validate();
if (validationResultEvent.type == "valid") {
nameValid = true;
} else {
nameValid = false;
}
*/
}
private function validateEmail():void {
/*
var validationResultEvent:ValidationResultEvent = emailValidator.validate();
if (validationResultEvent.type == "valid") {
emailValid = true;
} else {
emailValid = false;
}
*/
}
private function validateComment():void {
/*
var validationResultEvent:ValidationResultEvent = messageValidator.validate();
if (validationResultEvent.type == "valid") {
commentValid = true;
} else {
commentValid = false;
}
*/
}
private function checkAllValid():void {
if (nameValid == true && emailValid == true && commentValid == true) {
allValid = true;
} else {
allValid = false;
}
}
]]>
</mx:Script>
<!--
<mx:StringValidator id="nameValidator" minLength="1" source="{nameText_mc}" property="text" required="true" />
<mx:StringValidator id="messageValidator" minLength="1" source="{commentsText_mc}" property="text" required="true" />
<mx:EmailValidator id="emailValidator" source="{emailText_mc}" property="text" required="true" />
-->
<mx:VBox width="100%">
<mx:HBox width="100%">
<mx:HBox width="47" horizontalAlign="right">
<mx:Label text="Name" styleName="flexDarkLabel"/>
</mx:HBox>
<mx:HBox width="100%">
<!--<mx:TextInput id="nameText_mc" styleName="flexDarkTextBox" maxChars="{TextRestrictConstants.SMALL}"
change="fieldChange(event)" width="100%" />-->
</mx:HBox>
</mx:HBox>
<mx:HBox width="100%">
<mx:HBox width="47" horizontalAlign="right">
<mx:Label text="Email" styleName="flexDarkLabel"/>
</mx:HBox>
<mx:HBox width="100%">
<!--<mx:TextInput id="emailText_mc" styleName="flexDarkTextBox" maxChars="{TextRestrictConstants.SMALL}"
change="fieldChange(event)" width="100%" />-->
</mx:HBox>
</mx:HBox>
<mx:HBox width="100%">
<mx:HBox width="47" horizontalAlign="right">
<mx:Label text="Comment" styleName="flexDarkLabel"/>
</mx:HBox>
<mx:HBox width="100%">
<!--<mx:TextArea id="commentsText_mc" styleName="flexDarkTextBox" maxChars="{TextRestrictConstants.LARGE}"
change="fieldChange(event)" width="100%" height="64" editable="true" />-->
</mx:HBox>
</mx:HBox>
<mx:HBox horizontalAlign="center" width="100%" paddingTop="10">
<mx:Button id="saveBut_mc" styleName="flexButton" width="90" label="Save"
click="saveComment()" enabled="{allValid}" buttonMode="{allValid}"/>
<mx:Button id="cancelBut_mc" styleName="flexButton" width="90" label="Cancel"
click="closePanel()" buttonMode="true" mouseDown="this.clearAllFields()"/>
</mx:HBox>
</mx:VBox>
<!--<remote:CommentService
id="commentService"
flexShowcaseServiceConfig="{flexShowcaseServiceConfig}"/>-->
</sharedcomponents:FlexDotOrgWindow>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -