Skip to content

Commit

Permalink
- LaunchUICommand run w/o dispatching messages
Browse files Browse the repository at this point in the history
- ToolPathValidator trigger resource changes
- Refactored a bit

git-svn-id: https://svn.apache.org/repos/asf/flex/whiteboard@1450334 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
doublefx committed Feb 26, 2013
1 parent da7ae8f commit 40bb74d
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 477 deletions.
Expand Up @@ -23,7 +23,11 @@ limitations under the License.
<parsley:DynamicObject type="{GeneralMenu}"/>

<parsley:MapCommand type="{MenuActionCommand}"/>
<parsley:MapCommand type="{LaunchUICommand}"/>

<parsley:CommandFactory id="launchUICommand">
<parsley:Command type="{LaunchUICommand}"/>
</parsley:CommandFactory>

<parsley:MapCommand type="{ExitUICommand}"/>

<menu:ApplicationMenuPM/>
Expand Down
Expand Up @@ -9,14 +9,14 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBackError;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBackResult;
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ApplicationExitReadyMessage;
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.RequestExitApplicationMessage;
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.ExitApplicationMessage;

public class ExitUICommand extends AbstractDBCommand {

private var _msg:RequestExitApplicationMessage;
private var _msg:ExitApplicationMessage;
private var _terminateCommand:Function;

public function execute(msg:RequestExitApplicationMessage):void {
public function execute(msg:ExitApplicationMessage):void {
log.debug("Executing Command with message: " + ObjectUtil.toString(msg));
this._msg = msg;
executeAsync();
Expand Down
@@ -1,14 +1,15 @@
package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
import mx.logging.ILogger;

import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;
import org.apache.flex.utilities.developerToolSuite.executor.domain.ISettingsModel;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.command.CommandCallBack;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateAntPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateCygwinPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateGitPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateJavaPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateMavenPathMessage;
import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;
import org.apache.flex.utilities.developerToolSuite.infrastructure.message.LaunchUIMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateSvnPathMessage;
import org.apache.flex.utilities.developerToolSuite.presentation.graphic.settings.SettingsWindow;
import org.spicefactory.parsley.core.context.Context;

Expand All @@ -31,29 +32,33 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
private var _antCompleted:Boolean;
private var _mavenCompleted:Boolean;
private var _cygwinCompleted:Boolean;
private var _svnCompleted:Boolean;
private var _gitCompleted:Boolean;

public function execute(msg:LaunchUIMessage):void {
public function execute():void {

dispatch(new ValidateJavaPathMessage(settings.JAVA_HOME));
dispatch(new ValidateAntPathMessage(settings.ANT_HOME));
dispatch(new ValidateMavenPathMessage(settings.MAVEN_HOME));
dispatch(new ValidateCygwinPathMessage(settings.CYGWIN_HOME));
dispatch(new ValidateSvnPathMessage());
dispatch(new ValidateGitPathMessage());
}

[CommandComplete]
public function validateJavaPathCommandError(trigger:ValidateJavaPathMessage):void {
public function validateJavaPathCommandCompleted(trigger:ValidateJavaPathMessage):void {
_javaCompleted = true;
checkValidationsCompleted();
}

[CommandError]
public function validateJavaPathCommand(trigger:ValidateJavaPathMessage):void {
public function validateJavaPathCommandError(trigger:ValidateJavaPathMessage):void {
_javaCompleted = true;
checkValidationsCompleted();
}

[CommandComplete]
public function validateAntPathCommand(trigger:ValidateAntPathMessage):void {
public function validateAntPathCommandCompleted(trigger:ValidateAntPathMessage):void {
_antCompleted = true;
checkValidationsCompleted();
}
Expand All @@ -65,7 +70,7 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
}

[CommandComplete]
public function validateMavenPathCommand(trigger:ValidateMavenPathMessage):void {
public function validateMavenPathCommandCompleted(trigger:ValidateMavenPathMessage):void {
_mavenCompleted = true;
checkValidationsCompleted();
}
Expand All @@ -77,7 +82,7 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
}

[CommandComplete]
public function validateCygwinPathCommand(trigger:ValidateCygwinPathMessage):void {
public function validateCygwinPathCommandCompleted(trigger:ValidateCygwinPathMessage):void {
_cygwinCompleted = true;
checkValidationsCompleted();
}
Expand All @@ -88,20 +93,46 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
checkValidationsCompleted();
}

[CommandComplete]
public function validateSvnPathCommandCompleted(trigger:ValidateSvnPathMessage):void {
_svnCompleted = true;
checkValidationsCompleted();
}

[CommandError]
public function validateSvnPathCommandError(fault:Error, trigger:ValidateSvnPathMessage):void {
_svnCompleted = true;
checkValidationsCompleted();
}

[CommandComplete]
public function validateGitPathCommandCompleted(trigger:ValidateGitPathMessage):void {
_gitCompleted = true;
checkValidationsCompleted();
}

[CommandError]
public function validateGiyPathCommandError(fault:Error, trigger:ValidateGitPathMessage):void {
_gitCompleted = true;
checkValidationsCompleted();
}

private function checkValidationsCompleted():void {
if (_antCompleted && _mavenCompleted && _javaCompleted && _cygwinCompleted)
if (_antCompleted && _mavenCompleted && _javaCompleted && _cygwinCompleted && _svnCompleted && _gitCompleted) {
launchUI();
}
}

private function launchUI():void {
callback(CommandCallBack.DEFAULT_RESULT);

with (settings) {
if (javaEnabled && antEnabled && mavenEnabled && cygwinEnabled) {
if (javaEnabled && antEnabled && mavenEnabled && cygwinEnabled && (_svnCompleted || _gitCompleted)) {
// open last project or create project
} else {
SettingsWindow.show(context);
}
}
callback(CommandCallBack.DEFAULT_RESULT);
}
}
}
@@ -1,12 +1,12 @@
package org.apache.flex.utilities.developerToolSuite.infrastructure.event {
import flash.events.Event;

public class ModalWindowEvent extends Event {
public class SettingsWindowEvent extends Event {

public static const OPENED:String = "opened";
public static const CLOSED:String = "closed";

public function ModalWindowEvent(type:String) {
public function SettingsWindowEvent(type:String) {
super(type);
}
}
Expand Down
@@ -0,0 +1,9 @@
package org.apache.flex.utilities.developerToolSuite.infrastructure.message {
public class ExitApplicationMessage {
public var settings:Object;

public function ExitApplicationMessage(settings:Object) {
this.settings = settings;
}
}
}

This file was deleted.

This file was deleted.

Expand Up @@ -31,21 +31,28 @@ package org.apache.flex.utilities.developerToolSuite.presentation.behavior.valid
//doValidation method should accept an Object type parameter
override protected function doValidation(value:Object):Array {
// create an array to return.
var ValidatorResults:Array = new Array();
var validatorResults:Array = [];
// Call base class doValidation().
ValidatorResults = super.doValidation(value);
validatorResults = super.doValidation(value);
// Return if there are errors.
if (ValidatorResults.length > 0) {
return ValidatorResults;
if (validatorResults.length > 0) {
return validatorResults;
}

if (Boolean(value) == false) {
ValidatorResults.push(new ValidationResult(true, null, "Tool Home Path Error",
validatorResults.push(new ValidationResult(true, null, "Tool Home Path Error",
resourceManager.getString('SettingsWindow', errorStringResourceString)));
return ValidatorResults;
return validatorResults;
}

return ValidatorResults;
return validatorResults;
}

override protected function resourcesChanged():void {
super.resourcesChanged();

// Re-validate to get the localized error string displayed correctly.
validate();
}
}
}
Expand Down

This file was deleted.

Expand Up @@ -16,9 +16,7 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<mx:FlexNativeMenu xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:parsley="http://www.spicefactory.org/parsley">
xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Script><![CDATA[
import mx.events.FlexNativeMenuEvent;
Expand All @@ -40,14 +38,14 @@ limitations under the License.
labelFunction = model.getMenuItemLabel;
dataProvider = model.dataProvider;
addEventListener(FlexNativeMenuEvent.ITEM_CLICK, menu_itemClickHandler);
ResourceManager.getInstance().addEventListener(Event.CHANGE, localeChangeHandler);
ResourceManager.getInstance().addEventListener(Event.CHANGE, resourceManager_changeHandler);
}
private function menu_itemClickHandler(event:FlexNativeMenuEvent):void {
dispatch(new MenuActionMessage(event.item));
}
private function localeChangeHandler(event:Event):void {
private function resourceManager_changeHandler(event:Event):void {
dataProvider = model.dataProvider;
}
]]></fx:Script>
Expand Down
Expand Up @@ -31,8 +31,8 @@ limitations under the License.
</fx:Declarations>

<fx:Metadata>
[Event(name="opened", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent")]
[Event(name="closed", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent")]
[Event(name="opened", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent")]
[Event(name="closed", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent")]
[ManagedEvents("opened,closed")]
</fx:Metadata>

Expand Down Expand Up @@ -62,7 +62,7 @@ limitations under the License.
import mx.events.ResizeEvent;
import mx.managers.PopUpManager;
import org.apache.flex.utilities.developerToolSuite.infrastructure.event.ModalWindowEvent;
import org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent;
import org.spicefactory.parsley.core.context.Context;
private static var __window:SettingsWindow;
Expand All @@ -85,7 +85,7 @@ limitations under the License.
[Init]
public function init():void {
dispatchEvent(new ModalWindowEvent(ModalWindowEvent.OPENED));
dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.OPENED));
}
private function addedToStageHandler(event:Event):void {
Expand All @@ -102,7 +102,7 @@ limitations under the License.
private function closeWindow():void {
PopUpManager.removePopUp(this);
dispatchEvent(new ModalWindowEvent(ModalWindowEvent.CLOSED));
dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.CLOSED));
__window = null;
}
]]></fx:Script>
Expand Down
Expand Up @@ -18,8 +18,7 @@ limitations under the License.
<fx:Object xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:parsley="http://www.spicefactory.org/parsley"
xmlns:database="org.apache.flex.utilities.developerToolSuite.executor.application.database.*"
xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*"
xmlns:nativeprocess="org.apache.flex.utilities.developerToolSuite.executor.application.nativeProcess.*">
xmlns:domain="org.apache.flex.utilities.developerToolSuite.executor.domain.*">

<fx:Declarations>
<database:ApplicationDB/>
Expand Down

0 comments on commit 40bb74d

Please sign in to comment.