asproject 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.txt +0 -0
- data/History.txt +0 -0
- data/MIT-LICENSE.txt +20 -0
- data/Manifest.txt +16 -0
- data/README.txt +3 -0
- data/TODO.txt +10 -0
- data/bin/asclass +16 -0
- data/bin/asproject +16 -0
- data/lib/asclass.rb +254 -0
- data/lib/asclass_arguments.rb +147 -0
- data/lib/asproject.rb +248 -0
- data/lib/asproject/version.rb +9 -0
- data/lib/asproject_arguments.rb +175 -0
- data/lib/asproject_base.rb +43 -0
- data/lib/asproject_utils.rb +57 -0
- data/lib/eclipse_project.rb +32 -0
- data/lib/path_finder.rb +286 -0
- data/lib/platform.rb +107 -0
- data/lib/project.rb +82 -0
- data/lib/template_resolver.rb +144 -0
- data/lib/test_suite_generator.rb +128 -0
- data/rakefile.rb +85 -0
- data/setup.rb +1585 -0
- data/templates/asclass/as2/Class.as +11 -0
- data/templates/asclass/as2/Component.as +8 -0
- data/templates/asclass/as2/Interface.as +3 -0
- data/templates/asclass/as2/TestCase.as +30 -0
- data/templates/asclass/as2/TestSuite.as +15 -0
- data/templates/asclass/as3/Class.as +9 -0
- data/templates/asclass/as3/Component.as +9 -0
- data/templates/asclass/as3/Component.mxml +1 -0
- data/templates/asclass/as3/Interface.as +6 -0
- data/templates/asclass/as3/TestCase.as +30 -0
- data/templates/asclass/as3/TestSuite.as +18 -0
- data/templates/asproject/as2/project/rakefile.rb +18 -0
- data/templates/asproject/as2/project/src/AsProject.as +13 -0
- data/templates/asproject/as2/project/test/AsProjectRunner.as +12 -0
- data/templates/asproject/as3/project/rakefile.rb +18 -0
- data/templates/asproject/as3/project/src/AsProject.as +9 -0
- data/templates/asproject/as3/project/src/AsProjectRunner.as +11 -0
- data/templates/asproject/asunit2/project/lib/asunit/AsUnitUi.swf +0 -0
- data/templates/asproject/asunit2/project/lib/asunit/Sys.as +70 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanel.as +182 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTest.as +84 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTextArea.as +111 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTextAreaTest.as +26 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/LocalOutputPanelTitleBar.as +81 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ResizeHandle.as +35 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollArrow.as +34 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollHandle.as +43 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/ScrollListener.as +10 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/TextScroller.as +169 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/shapes/Rectangle.as +29 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/controls/shapes/Triangle.as +27 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/AsUnit.as +19 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Assert.as +408 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Assertion.as +27 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Reflection.as +68 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/Test.as +3 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestCase.as +191 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestCaseXml.as +31 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestFailure.as +15 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestResult.as +15 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestRunner.as +41 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestSetup.as +19 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/framework/TestSuite.as +22 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/Main.as +325 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/RemoteVersion.as +24 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/ui/SuccessMeter.as +32 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/Comparable.as +7 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/EventListener.as +29 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/EventSource.as +89 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnClient.as +42 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnGateway.as +47 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalConnServer.as +61 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/LocalMessageBroker.as +58 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/Observable.as +11 -0
- data/templates/asproject/asunit2/project/lib/asunit/com/asunit/util/TextFile.as +30 -0
- data/templates/asproject/asunit25/project/lib/asunit/AsUnitTestRunner.as +13 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/AssertionFailedError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/AssertionPassedError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/ClassNotFoundError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/IllegalOperationError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/InstanceNotFoundError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/InvocationTargetError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/errors/UnimplementedFeatureError.as +7 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/Assert.as +376 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/AssertMock.as +15 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/AssertTest.as +59 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/ITestListener.as +13 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/Test.as +11 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCase.as +277 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseMock.as +23 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseTest.as +29 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestCaseXml.as +38 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestFailure.as +47 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestResult.as +168 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/framework/TestSuite.as +102 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/runner/BaseTestRunner.as +101 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/runner/IResultPrinter.as +8 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/ResultPrinter.as +254 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/SuccessBar.as +41 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/textui/TestRunner.as +17 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/util/ArrayIterator.as +24 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/util/ArrayIteratorTest.as +52 -0
- data/templates/asproject/asunit25/project/lib/asunit/asunit/util/Iterator.as +5 -0
- data/templates/asproject/asunit3/project/lib/asunit/AsUnitTestRunner.as +10 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/AbstractMemberCalledError.as +10 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/AssertionFailedError.as +10 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/ClassNotFoundError.as +10 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/InstanceNotFoundError.as +10 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/errors/UnimplementedFeatureError.as +10 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/Assert.as +271 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCase.as +52 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/AsynchronousTestCaseExample.as +71 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/Test.as +15 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestCase.as +351 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestCaseExample.as +73 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestFailure.as +47 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestListener.as +22 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestResult.as +158 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/framework/TestSuite.as +115 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/BaseTestRunner.as +15 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/TestSuiteLoader.as +9 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/runner/Version.as +11 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/FlexRunner.as +19 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/FlexTestRunner.as +55 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/ResultPrinter.as +245 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/textui/TestRunner.as +121 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/util/ArrayIterator.as +26 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/util/Iterator.as +9 -0
- data/templates/asproject/asunit3/project/lib/asunit/asunit/util/Properties.as +30 -0
- data/templates/asproject/asunit3/project/lib/asunit/mx/managers/LayoutManager.as +945 -0
- data/templates/asproject/config/project/config/asclass_config.rb +58 -0
- data/templates/asproject/fb2as/project/.actionScriptProperties +21 -0
- data/templates/asproject/fb2as/project/.project +29 -0
- data/templates/asproject/fdt/project/.as2_classpath +6 -0
- data/templates/asproject/fdt/project/.project +19 -0
- data/templates/ide/mate/Create Class.tmCommand +37 -0
- data/templates/ide/mate/Rebuild Test Suites.tmCommand +33 -0
- data/templates/ide/mate/Run Rake Task.tmCommand +127 -0
- metadata +266 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
class <%=package_name%>.<%=class_name%> {
|
|
3
|
+
public static var linkageId:String = "<%=package_name%>.<%=class_name%>";
|
|
4
|
+
public static var classRef:Function = <%=class_name%>;
|
|
5
|
+
|
|
6
|
+
public function <%=class_name%>() {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public static var serializable:Boolean = Object.registerClass(linkageId, classRef);
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import asunit.framework.TestCase;
|
|
3
|
+
import <%=package_name%>.<%=class_name%>;
|
|
4
|
+
|
|
5
|
+
class <%=package_name%>.<%=test_case_name%> extends TestCase {
|
|
6
|
+
private var className:String = "<%=package_name%>.<%=test_case_name%>";
|
|
7
|
+
private var <%=instance_name%>:<%=class_name%>;
|
|
8
|
+
|
|
9
|
+
public function <%=test_case_name%>(testMethod:String) {
|
|
10
|
+
super(testMethod);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public function setUp():Void {
|
|
14
|
+
super.setUp();
|
|
15
|
+
<%=instance_name%> = new <%=class_name%>();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public function tearDown():Void {
|
|
19
|
+
super.tearDown();
|
|
20
|
+
delete <%=instance_name%>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public function testInstantiated():Void {
|
|
24
|
+
assertTrue("<%=instance_name%> instanceof <%=class_name%>", <%=instance_name%> instanceof <%=class_name%>);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public function testFailure():Void {
|
|
28
|
+
assertTrue("Failing test", false);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file has been automatically created using
|
|
3
|
+
* #!/usr/bin/ruby asclass -s
|
|
4
|
+
* If you modify it and run this script, your
|
|
5
|
+
* modifications will be lost!
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import asunit.framework.TestSuite;
|
|
9
|
+
|
|
10
|
+
class <%=full_suite_name%> extends TestSuite {
|
|
11
|
+
|
|
12
|
+
public function AllTests() {<% test_cases.each do |test_case| %>
|
|
13
|
+
addTest(new <%=test_case%>());<% end %>
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// TODO: Add base component template here...
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
package <%=package_name%> {
|
|
2
|
+
|
|
3
|
+
import asunit.framework.TestCase;
|
|
4
|
+
|
|
5
|
+
public class <%=test_case_name %> extends TestCase {
|
|
6
|
+
private var <%=instance_name%>:<%=class_name%>;
|
|
7
|
+
|
|
8
|
+
public function <%=test_case_name%>(methodName:String=null) {
|
|
9
|
+
super(methodName)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
override protected function setUp():void {
|
|
13
|
+
super.setUp();
|
|
14
|
+
<%=instance_name%> = new <%=class_name%>();<%=add_child_line%>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override protected function tearDown():void {
|
|
18
|
+
super.tearDown();
|
|
19
|
+
<%=remove_child_line%><%=instance_name%> = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public function testInstantiated():void {
|
|
23
|
+
assertTrue("<%=instance_name%> is <%=class_name%>", <%=instance_name%> is <%=class_name%>);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public function testFailure():void {
|
|
27
|
+
assertTrue("Failing test", false);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package <%=package_name%> {
|
|
2
|
+
/**
|
|
3
|
+
* This file has been automatically created using
|
|
4
|
+
* #!/usr/bin/ruby asclass -s
|
|
5
|
+
* If you modify it and run this script, your
|
|
6
|
+
* modifications will be lost!
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import asunit.framework.TestSuite;<% test_cases.each do |test_case| %>
|
|
10
|
+
import <%=test_case%>;<% end %>
|
|
11
|
+
|
|
12
|
+
public class AllTests extends TestSuite {
|
|
13
|
+
|
|
14
|
+
public function AllTests() {<% test_cases.each do |test_case| %>
|
|
15
|
+
addTest(new <%=test_case%>());<% end %>
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#! rake
|
|
2
|
+
#
|
|
3
|
+
# Rakefile for MXMLC development
|
|
4
|
+
# execute rake -T anywhere forward of this directory to see available tasks
|
|
5
|
+
# Tasks are executed from the command prompt like:
|
|
6
|
+
# rake deploy
|
|
7
|
+
# rake clean
|
|
8
|
+
|
|
9
|
+
# The test task accepts additional optional arguments as follows:
|
|
10
|
+
#
|
|
11
|
+
# rake test / Create TestSuites and run AllTests
|
|
12
|
+
# rake test SomeClass / Run only the specified TestCase
|
|
13
|
+
# rake test SomeClass.testSomeMethod / Run only the specified TestCase and test method
|
|
14
|
+
|
|
15
|
+
require_gem 'asproject'
|
|
16
|
+
load 'asproject'
|
|
17
|
+
|
|
18
|
+
load_rake_tasks
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
class <%=project_name%> extends MovieClip {
|
|
3
|
+
private static var instance:<%=project_name%>
|
|
4
|
+
|
|
5
|
+
public function <%=project_name%>() {
|
|
6
|
+
trace("<%=project_name%> Instantiated");
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public static function main():Void {
|
|
10
|
+
instance = _root.attachMovie('<%=project_name%>', '<%=instance_name%>', 1);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import asunit.textui.TestRunner;
|
|
2
|
+
|
|
3
|
+
class <%=project_name%>Runner extends TestRunner {
|
|
4
|
+
|
|
5
|
+
public function <%=project_name%>Runner() {
|
|
6
|
+
start(AllTests);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
public static function main():Void {
|
|
10
|
+
var runner:<%=project_name%>Runner = new <%=project_name%>Runner();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#! rake
|
|
2
|
+
#
|
|
3
|
+
# Rakefile for MXMLC development
|
|
4
|
+
# execute rake -T anywhere forward of this directory to see available tasks
|
|
5
|
+
# Tasks are executed from the command prompt like:
|
|
6
|
+
# rake deploy
|
|
7
|
+
# rake clean
|
|
8
|
+
|
|
9
|
+
# The test task accepts additional optional arguments as follows:
|
|
10
|
+
#
|
|
11
|
+
# rake test / Create TestSuites and run AllTests
|
|
12
|
+
# rake test SomeClass / Run only the specified TestCase
|
|
13
|
+
# rake test SomeClass.testSomeMethod / Run only the specified TestCase and test method
|
|
14
|
+
|
|
15
|
+
require_gem 'asproject'
|
|
16
|
+
load 'asproject'
|
|
17
|
+
|
|
18
|
+
load_rake_tasks
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
import com.asunit.util.*;
|
|
3
|
+
|
|
4
|
+
/************************************************
|
|
5
|
+
|
|
6
|
+
Copyright (C) 2004 Luke Bayes and Ali Mills
|
|
7
|
+
|
|
8
|
+
This library is free software; you can redistribute it and/or
|
|
9
|
+
modify it under the terms of the GNU Lesser General Public
|
|
10
|
+
License as published by the Free Software Foundation; either
|
|
11
|
+
version 2.1 of the License, or (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
This library is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
16
|
+
Lesser General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU Lesser General Public
|
|
19
|
+
License along with this library; if not, write to the Free Software
|
|
20
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
21
|
+
|
|
22
|
+
Any questions related to this code should be directed to :
|
|
23
|
+
lukebayes@users.sourceforge.net
|
|
24
|
+
or
|
|
25
|
+
alimills@users.sourceforge.net
|
|
26
|
+
|
|
27
|
+
************************************************/
|
|
28
|
+
|
|
29
|
+
class Sys {
|
|
30
|
+
private static var localConn:LocalConnection;
|
|
31
|
+
public static var CONN_ID:String = "_outputLineLc";
|
|
32
|
+
private static var isUsingExternalOutput:Boolean = true;
|
|
33
|
+
private static var localMsgBrkr:LocalMessageBroker;
|
|
34
|
+
|
|
35
|
+
private function Sys() {
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public static function useExternalOutput(useExtOut:Boolean):Void {
|
|
39
|
+
isUsingExternalOutput = useExtOut;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static function println(msg:String, category:String):String {
|
|
43
|
+
if(isUsingExternalOutput) {
|
|
44
|
+
var lc:LocalConnection = getLocalConn();
|
|
45
|
+
lc.send(CONN_ID, "execResolve", "onShowEcho", escape(msg), category);
|
|
46
|
+
} else {
|
|
47
|
+
var lmb:LocalMessageBroker = LocalMessageBroker.getInstance();
|
|
48
|
+
lmb.send(msg, category);
|
|
49
|
+
}
|
|
50
|
+
return msg;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public static function getLocalConn():LocalConnection {
|
|
54
|
+
if(localConn == undefined) {
|
|
55
|
+
localConn = new LocalConnection();
|
|
56
|
+
}
|
|
57
|
+
return localConn;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public static function getFileSeparator():String {
|
|
61
|
+
var os:String = System.capabilities.os;
|
|
62
|
+
if(os.indexOf("Win") > -1) {
|
|
63
|
+
return "\\";
|
|
64
|
+
} else if(os.indexOf("Mac") > -1) {
|
|
65
|
+
return ":";
|
|
66
|
+
} else if(os.indexOf("Linux") > -1) {
|
|
67
|
+
return "/";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
|
|
2
|
+
import com.asunit.controls.*;
|
|
3
|
+
import com.asunit.util.*;
|
|
4
|
+
|
|
5
|
+
class com.asunit.controls.LocalOutputPanel extends MovieClip implements ScrollListener {
|
|
6
|
+
public static var linkageId:String = "__Packages.com.asunit.controls.LocalOutputPanel";
|
|
7
|
+
public static var classRef:Function = LocalOutputPanel;
|
|
8
|
+
private var version:String = "2.0.0";
|
|
9
|
+
private var isVisible:Boolean;
|
|
10
|
+
private var broker:LocalMessageBroker;
|
|
11
|
+
private var message:LocalOutputPanelTextArea;
|
|
12
|
+
private var scroller:TextScroller;
|
|
13
|
+
private var resize:ResizeHandle;
|
|
14
|
+
private var title:LocalOutputPanelTitleBar;
|
|
15
|
+
private var titleHeight:Number = 15;
|
|
16
|
+
private var scrollerWidth:Number = 15;
|
|
17
|
+
private var width:Number = 400;
|
|
18
|
+
private var height:Number = 300;
|
|
19
|
+
private var minWidth:Number = 100;
|
|
20
|
+
private var minHeight:Number = 100;
|
|
21
|
+
private var eventSrc:EventSource;
|
|
22
|
+
|
|
23
|
+
public function LocalOutputPanel() {
|
|
24
|
+
eventSrc = new EventSource();
|
|
25
|
+
createAssets();
|
|
26
|
+
init();
|
|
27
|
+
Sys.println("---------------------");
|
|
28
|
+
Sys.println(">> LocalOutput Panel Instantiated");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public function onConstruct():Void {
|
|
32
|
+
Sys.println(">> whatup onConstruct? at :" + this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static function getInstance(parent:MovieClip, depth:Number):LocalOutputPanel {
|
|
36
|
+
Sys.println(">> lcop getting instance with : " + parent + " depth : " + depth);
|
|
37
|
+
if(parent.localOutputPanelInstance == undefined) {
|
|
38
|
+
Sys.println(">> there is not another instance yet");
|
|
39
|
+
// Sys.println("--------------");
|
|
40
|
+
// for(var i in parent) {
|
|
41
|
+
// Sys.println(">> " + i + " : " + parent[i]);
|
|
42
|
+
// }
|
|
43
|
+
// Sys.println("--------------");
|
|
44
|
+
if(parent.createChild != undefined) {
|
|
45
|
+
Sys.println(">> creating child now with : " + LocalOutputPanel.linkageId);
|
|
46
|
+
return LocalOutputPanel(parent.createChild(LocalOutputPanel, "localOutputPanelInstance"));
|
|
47
|
+
} else {
|
|
48
|
+
return LocalOutputPanel(parent.attachMovie(LocalOutputPanel.linkageId, "localOutputPanelInstance", depth));
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
Sys.println(">> there is already another instance");
|
|
52
|
+
trace(">> A Script has attempted to instantiate the com.asunit.controls.LocalOutputPanel after one instance already exists.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public function init():Void {
|
|
57
|
+
isVisible = true;
|
|
58
|
+
broker = LocalMessageBroker.getInstance();
|
|
59
|
+
broker.addListener(this);
|
|
60
|
+
Sys.useExternalOutput(false);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public function onUnLoad():Void {
|
|
64
|
+
broker.removeListener(this);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public function createAssets():Void {
|
|
68
|
+
var initObj:Object = new Object();
|
|
69
|
+
initObj.width = width;
|
|
70
|
+
initObj.height = titleHeight;
|
|
71
|
+
initObj.controller = this;
|
|
72
|
+
initObj._y = 0;
|
|
73
|
+
title = LocalOutputPanelTitleBar(attachMovie(LocalOutputPanelTitleBar.linkageId, "title", 3, initObj));
|
|
74
|
+
|
|
75
|
+
initObj = new Object();
|
|
76
|
+
initObj.width = width;
|
|
77
|
+
initObj.height = height - titleHeight;
|
|
78
|
+
initObj._y = titleHeight;
|
|
79
|
+
message = LocalOutputPanelTextArea(attachMovie(LocalOutputPanelTextArea.linkageId, "message", 1, initObj));
|
|
80
|
+
|
|
81
|
+
initObj = new Object();
|
|
82
|
+
initObj.controller = this;
|
|
83
|
+
initObj.width = scrollerWidth;
|
|
84
|
+
initObj.height = message._height - scrollerWidth;
|
|
85
|
+
initObj._y = titleHeight;
|
|
86
|
+
initObj._x = width - scrollerWidth;
|
|
87
|
+
scroller = TextScroller(attachMovie(TextScroller.linkageId, "scroller", 2, initObj));
|
|
88
|
+
scroller.addListener(this);
|
|
89
|
+
|
|
90
|
+
initObj = new Object();
|
|
91
|
+
initObj.controller = this;
|
|
92
|
+
initObj.width = scrollerWidth;
|
|
93
|
+
initObj.height = scrollerWidth;
|
|
94
|
+
initObj._x = width - scrollerWidth;
|
|
95
|
+
initObj._y = height - scrollerWidth;
|
|
96
|
+
resize = ResizeHandle(attachMovie(ResizeHandle.linkageId, "resize", 4, initObj));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public function getVersion():String {
|
|
100
|
+
return version;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public function getScrolledTextField():TextField {
|
|
104
|
+
return message.getTextField();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
public function onResizeHandleMoved():Void {
|
|
108
|
+
setWidth(_xmouse+5);
|
|
109
|
+
setHeight(_ymouse+5);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public function onMessageSent(evnt:Object):Void {
|
|
113
|
+
println(evnt.message);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public function beginDrag():Void {
|
|
117
|
+
startDrag(this);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public function endDrag():Void {
|
|
121
|
+
stopDrag();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public function toggleVisible():Void {
|
|
125
|
+
isVisible = !isVisible;
|
|
126
|
+
_visible = isVisible;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
public function onScrollUp(event:Object):Void {
|
|
130
|
+
message.scroll -= 1;
|
|
131
|
+
eventSrc.broadcastMessage("onScrollChanged", {event:"onScrollChanged", source:this});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public function onScrollDown(event:Object):Void {
|
|
135
|
+
message.scroll += 1;
|
|
136
|
+
eventSrc.broadcastMessage("onScrollChanged", {event:"onScrollChanged", source:this});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public function println(str:String):Void {
|
|
140
|
+
message.println(str);
|
|
141
|
+
eventSrc.broadcastMessage("onScrollChanged", {event:"onScrollChanged", source:this});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
public function getTextField():TextField {
|
|
145
|
+
return message.getTextField();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public function setWidth(num:Number):Number {
|
|
149
|
+
width = Math.round(Math.max(num, minWidth));
|
|
150
|
+
title.setWidth(width);
|
|
151
|
+
scroller._x = width - scrollerWidth;
|
|
152
|
+
resize._x = scroller._x;
|
|
153
|
+
message.setWidth(width);
|
|
154
|
+
return width;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public function setHeight(num:Number):Number {
|
|
158
|
+
height = Math.round(Math.max(num, minHeight));
|
|
159
|
+
scroller.setHeight(height - (titleHeight + scrollerWidth));
|
|
160
|
+
resize._y = height - resize._height;
|
|
161
|
+
message.setHeight(height - titleHeight);
|
|
162
|
+
return height;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
public function addEventListener(event:String, observer:Object, scope:Object):Void {
|
|
166
|
+
eventSrc.addEventListener(event, observer, scope);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
public function addListener(observer:Object, scope:Object):Void {
|
|
170
|
+
eventSrc.addListener(observer, scope);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
public function removeEventListener(event:String, observer:Object):Boolean {
|
|
174
|
+
return eventSrc.removeEventListener(event, observer);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public function removeListener(observer:Object):Boolean {
|
|
178
|
+
return eventSrc.removeListener(observer);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public static var serializable:Boolean = Object.registerClass(linkageId, classRef);
|
|
182
|
+
}
|