Skip to content
Permalink
Browse files
-Revisited the event flow for the db part
-start to track and save the window position on exit
-refactored a bit
-DB autoupdate on going

git-svn-id: https://svn.apache.org/repos/asf/flex/whiteboard@1448510 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
doublefx committed Feb 21, 2013
1 parent e7686b3 commit 1b0b1367b16a6c2413c079075c910417bde1890a
Showing 19 changed files with 228 additions and 120 deletions.
@@ -7,7 +7,7 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.ValidateCygwinPathMessage;
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.infrastructure.util.LogUtil;
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.presentation.graphic.settings.SettingsWindow;
import org.spicefactory.parsley.core.context.Context;
@@ -43,28 +43,53 @@ package org.apache.flex.utilities.developerToolSuite.infrastructure.command {
[CommandComplete]
public function validateJavaPathCommandError(trigger:ValidateJavaPathMessage):void {
_javaCompleted = true;
if(_antCompleted && _mavenCompleted && _cygwinCompleted)
launchUI();
checkValidationsCompleted();
}

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

[CommandComplete]
public function validateAntPathCommand(trigger:ValidateAntPathMessage):void {
_antCompleted = true;
checkValidationsCompleted();
}

[CommandError]
public function validateAntPathCommandError(trigger:ValidateAntPathMessage):void {
_antCompleted = true;
if (_javaCompleted && _mavenCompleted && _cygwinCompleted)
launchUI();
checkValidationsCompleted();
}

[CommandComplete]
public function validateMavenPathCommandError(trigger:ValidateMavenPathMessage):void {
public function validateMavenPathCommand(trigger:ValidateMavenPathMessage):void {
_mavenCompleted = true;
if (_antCompleted && _javaCompleted && _cygwinCompleted)
launchUI();
checkValidationsCompleted();
}

[CommandError]
public function validateMavenPathCommandError(fault:Error, trigger:ValidateMavenPathMessage):void {
_mavenCompleted = true;
checkValidationsCompleted();
}

[CommandComplete]
public function validateCygwinPathCommandError(trigger:ValidateCygwinPathMessage):void {
public function validateCygwinPathCommand(trigger:ValidateCygwinPathMessage):void {
_cygwinCompleted = true;
checkValidationsCompleted();
}

[CommandError]
public function validateCygwinPathCommandError(fault:Error, trigger:ValidateCygwinPathMessage):void {
_cygwinCompleted = true;
if (_antCompleted && _mavenCompleted && _javaCompleted)
checkValidationsCompleted();
}

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

@@ -53,10 +53,12 @@ limitations under the License.
</s:VGroup>
</s:helpContent>
<fx:Script><![CDATA[
import flash.filesystem.File;
import mx.events.FlexEvent;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.message.SaveSettingMessage;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess.NativeShellHelper;
import org.apache.flex.utilities.developerToolSuite.executor.application.nativeProcess.NativeShellHelper;
import spark.events.TextOperationEvent;
@@ -72,7 +74,7 @@ limitations under the License.
[Bindable]
public var helpLabelResourcesString:String;
[Bindable]
public var helpUrlText:String
public var helpUrlText:String;
[Bindable]
public var helpUrl:String;
[Bindable]
@@ -6,6 +6,8 @@ package org.apache.flex.utilities.developerToolSuite.executor.domain {
[Bindable]
public interface ISettingsModel {

function get dbVersion():uint;

function get appBounds():String;

function get appDisplayState():String;
@@ -23,16 +23,10 @@ package org.apache.flex.utilities.developerToolSuite.executor.domain {

public class SettingModel implements ISettingsModel {

public function get availableLanguages():ArrayCollection {
return new ArrayCollection(LocaleUtil.AVAILABLE_LANGUAGES);
}

public function get currentLanguage():Object {
return LocaleUtil.getDefaultLanguage(_locale);
}

private var _environmentVariables:Dictionary;

private var _dbVersion:uint;

private var _locale:String;

private var _JAVA_HOME:String;
@@ -51,6 +45,23 @@ package org.apache.flex.utilities.developerToolSuite.executor.domain {
private var _appBounds:String;
private var _appDisplayState:String;

public function get availableLanguages():ArrayCollection {
return new ArrayCollection(LocaleUtil.AVAILABLE_LANGUAGES);
}

public function get currentLanguage():Object {
return LocaleUtil.getDefaultLanguage(_locale);
}

public function get dbVersion():uint {
return _dbVersion;
}

[Bindable]
public function set dbVersion(value:uint):void {
_dbVersion = value;
}

public function get environmentVariables():Dictionary {
return _environmentVariables;
}
@@ -18,13 +18,12 @@ package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.com
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.errors.SQLError;
import flash.net.Responder;

import mx.logging.ILogger;
import mx.utils.ObjectUtil;

import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.database.ApplicationDB;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
import org.apache.flex.utilities.developerToolSuite.executor.application.database.ApplicationDB;
import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;

public class AbstractDBCommand {

@@ -42,28 +41,27 @@ package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.com
protected var stmt:SQLStatement = new SQLStatement();

protected function executeAsync():void {
if (!db.DBReady) {
db.connect();
}

prepareSql();
db.connect(prepareSql);
}

protected function prepareSql():void {
var responder:Responder = new Responder(result, error);
stmt.text = sql;
db.executeSqlStatement(stmt, responder);
db.executeSqlStatement(stmt, result, error);
}

protected function result(result:SQLResult):void {
protected function result(result:SQLResult, terminateCommand:Boolean = true):void {
var resultMessage:String = (result.data != null) ? ObjectUtil.toString(result.data) : result.rowsAffected + " affected row(s)";
log.debug("Successfully executed shell: " + resultMessage);
callback(new CommandCallBackResult(result));
log.debug("Successfully executed DB Command: {0}", resultMessage);
if (terminateCommand) {
callback(new CommandCallBackResult(result));
}
}

protected function error(error:SQLError):void {
log.error("Error executing shell: " + ObjectUtil.toString(error));
callback(new CommandCallBackError(error.message, error.detailID));
protected function error(error:SQLError, terminateCommand:Boolean = true):void {
log.error("Error executing DB Command: {0}", ObjectUtil.toString(error));
if (terminateCommand) {
callback(new CommandCallBackError(error.message, error.detailID));
}
}
}
}
@@ -21,8 +21,8 @@ package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.com

import mx.logging.ILogger;

import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.nativeProcess.NativeShellHelper;
import org.apache.flex.utilities.developerToolSuite.executor.infrastructure.util.LogUtil;
import org.apache.flex.utilities.developerToolSuite.executor.application.nativeProcess.NativeShellHelper;
import org.apache.flex.utilities.developerToolSuite.executor.application.util.LogUtil;

public class AbstractShellCommand {

@@ -38,7 +38,7 @@ package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.com
override protected function prepareSql():void {
ResourceManager.getInstance().localeChain = LocaleUtil.getOrderedLocalChain(_msg.locale);
settings.locale = _msg.locale;
sql = "UPDATE settings SET value='" + _msg.locale + "' WHERE name='locale';";
sql = "UPDATE setting SET value='" + _msg.locale + "' WHERE name='locale';";

super.prepareSql();
}
@@ -35,11 +35,11 @@ package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.com
}

override protected function prepareSql():void {
sql = "SELECT name, value FROM settings;";
sql = "SELECT name, value FROM setting;";
super.prepareSql();
}

override protected function result(result:SQLResult):void {
override protected function result(result:SQLResult, terminateCommand:Boolean = true):void {
var row:Object;

if (result.data) {
@@ -56,10 +56,11 @@ package org.apache.flex.utilities.developerToolSuite.executor.infrastructure.com
ResourceManager.getInstance().localeChain = LocaleUtil.getOrderedLocalChain(settings.locale);
dispatch(new ApplicationReadyMessage());

var resultMessage:String = (result.data != null) ? ObjectUtil.toString(result.data) : result.rowsAffected + " affected row(s)";
log.debug("Successfully executed shell: " + resultMessage);
log.debug("Got settings: {0}", ObjectUtil.toString(result.data));

callback(new CommandCallBackResult(settings));
if (terminateCommand) {
callback(new CommandCallBackResult(settings));
}
}
}
}

0 comments on commit 1b0b136

Please sign in to comment.