Skip to content

Commit 19d7996

Browse files
JihoonKim1004JihoonKim1004
authored andcommitted
Made some name changes to files for better reasoning and moved MXMLApplicationBody's content as vm to be dynamically modified by VelocityFileManipulatorTaskRunnerImpl. So unlike the expected other bodyContent [i.e. MXMLScriptRenderer], MXMLApplicationRenderer will create the template to add additional script content to the mxml from other renderers [i.e. MXMLColumnsRenderer].
1 parent 25dd01b commit 19d7996

22 files changed

Lines changed: 438 additions & 242 deletions

File tree

jsf-flex-shared/core/src/main/resources/com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/component/DataGridAsynchronousRequest.as

Lines changed: 0 additions & 54 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
/**
21+
* @author Ji Hoon Kim
22+
*/
23+
package com.googlecode.jsfFlex.communication.component
24+
{
25+
import mx.rpc.events.ResultEvent;
26+
27+
import com.googlecode.jsfFlex.communication.logger.ILogger;
28+
import com.googlecode.jsfFlex.communication.logger.LoggerFactory
29+
30+
import com.googlecode.jsfFlex.communication.services.JsfFlexHttpService;
31+
32+
internal class DataGridColumnServiceRequest {
33+
34+
private static const JSF_FLEX_HTTP_SERVICE_REQUEST_URL:String = "jsfFlexHttpServiceRequest.service";
35+
private static const GET_COLUMN_INFO:String = "getColumnInfo";
36+
37+
private static var _log:ILogger;
38+
39+
private var _columnId:String;
40+
private var _columnEntries:XMLList;
41+
42+
private var _dataGridServiceRequest:DataGridServiceRequest;
43+
private var _jsfFlexHttpServiceRequest:JsfFlexHttpService;
44+
45+
{
46+
_log = LoggerFactory.newJSLoggerInstance(DataGridColumnServiceRequest);
47+
}
48+
49+
public function DataGridColumnServiceRequest(columnId:String, dataGridServiceRequest:DataGridServiceRequest) {
50+
super();
51+
_columnId = columnId;
52+
_dataGridServiceRequest = dataGridServiceRequest;
53+
_jsfFlexHttpServiceRequest = new JsfFlexHttpService();
54+
}
55+
56+
public function getDataColumnInfo():void {
57+
var dataRequestParameters:Object = new Object();
58+
dataRequestParameters.componentId = _columnId;
59+
dataRequestParameters.methodToInvoke = GET_COLUMN_INFO;
60+
61+
_jsfFlexHttpServiceRequest.sendHttpRequest(JSF_FLEX_HTTP_SERVICE_REQUEST_URL, dataRequestParameters,
62+
this, function(lastResult:Object, event:ResultEvent):void {
63+
_log.logInfo("Returned from service request : " + JSF_FLEX_HTTP_SERVICE_REQUEST_URL);
64+
_log.logInfo("Data returned from servlet : " + lastResult);
65+
66+
}, JsfFlexHttpService.GET_METHOD, JsfFlexHttpService.OBJECT_RESULT_FORMAT, null);
67+
68+
}
69+
70+
public function get columnId():String {
71+
return _columnId;
72+
}
73+
74+
}
75+
76+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
/**
21+
* TODO : Implement better later
22+
* Unfortunately ActionScript doesn't currently implement inner classes, so currently implemented so
23+
* @author Ji Hoon Kim
24+
*/
25+
package com.googlecode.jsfFlex.communication.component
26+
{
27+
import mx.core.UIComponent;
28+
29+
import com.googlecode.jsfFlex.communication.logger.ILogger;
30+
import com.googlecode.jsfFlex.communication.logger.LoggerFactory
31+
32+
public class DataGridServiceRequest {
33+
34+
private static var _log:ILogger;
35+
36+
private var _refApp:UIComponent;
37+
38+
private var _dataGridId:String;
39+
private var _dataGridColumnRequests:Array;
40+
41+
{
42+
_log = LoggerFactory.newJSLoggerInstance(DataGridServiceRequest);
43+
}
44+
45+
public function DataGridServiceRequest(dataGridId:String, refApp:UIComponent) {
46+
super();
47+
_dataGridId = dataGridId;
48+
_dataGridColumnRequests = new Array();
49+
_refApp = refApp;
50+
}
51+
52+
public function addDataGridColumServiceRequest(dataGridStringId:String):void {
53+
_dataGridColumnRequests.push(new DataGridColumnServiceRequest(dataGridStringId, this));
54+
}
55+
56+
public function getDataGridColumnInfo():void {
57+
58+
for each(var dataGridColumnRequest:DataGridColumnServiceRequest in _dataGridColumnRequests){
59+
dataGridColumnRequest.getDataColumnInfo();
60+
_log.logInfo("Sent message to " + dataGridColumnRequest.columnId);
61+
}
62+
63+
}
64+
65+
public function get dataGridId():String {
66+
return _dataGridId;
67+
}
68+
public function get refApp():UIComponent {
69+
return _refApp;
70+
}
71+
72+
}
73+
74+
}

jsf-flex-shared/core/src/main/resources/com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/core/ComponentValueMapper.as

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ package com.googlecode.jsfFlex.communication.core
7373
}
7474
}
7575

76-
public function ComponentValueMapper(refApp:UIComponent){
76+
public function ComponentValueMapper(refApp:UIComponent) {
7777
super();
7878
_refApp = refApp;
7979
}
@@ -190,7 +190,7 @@ package com.googlecode.jsfFlex.communication.core
190190
return valueToReturn;
191191
}
192192

193-
private function getAttributeValue(attribute:XML, objectRef:Object):Object{
193+
private function getAttributeValue(attribute:XML, objectRef:Object):Object {
194194

195195
var attributeValue:String;
196196
var attributeId:String;

jsf-flex-shared/core/src/main/resources/com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/services/JSONHttpService.as

Lines changed: 0 additions & 65 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
/**
21+
* This class is a simple wrapper to HTTPService for JsfFlex.
22+
* In future it is considered to improve the implementation by adding caching and etcetera.
23+
* @author Ji Hoon Kim
24+
*/
25+
package com.googlecode.jsfFlex.communication.services
26+
{
27+
import mx.rpc.events.ResultEvent;
28+
import mx.rpc.http.HTTPService;
29+
30+
public class JsfFlexHttpService {
31+
32+
public static const ARRAY_RESULT_FORMAT:String = "array";
33+
public static const E4X_RESULT_FORMAT:String = "e4x";
34+
public static const FLASH_VARS_RESULT_FORMAT:String = "flashvars";
35+
public static const OBJECT_RESULT_FORMAT:String = "object";
36+
public static const TEXT_RESULT_FORMAT:String = "text";
37+
public static const XML_RESULT_FORMAT:String = "xml";
38+
39+
public static const DELETE_METHOD:String = "DELETE";
40+
public static const GET_METHOD:String = "GET";
41+
public static const POST_METHOD:String = "POST";
42+
public static const PUT_METHOD:String = "PUT";
43+
44+
private static const SERVLET_NAME_VALUE_RESULT_FORMAT:String = "nameValue";
45+
private static const SERVLET_RAW_RESULT_FORMAT:String = "raw";
46+
private static const SERVLET_XML_RESULT_FORMAT:String = "xml";
47+
48+
private static const SERVLET_RETURN_METHOD:String = "servletReturnMethod";
49+
50+
public function JsfFlexHttpService() {
51+
super();
52+
}
53+
54+
public function sendHttpRequest(serviceUrl:String, parameters:Object, thisObject:Object, callBack:Function, method:String,
55+
resultFormatMethod:String, rootUrl:String):void {
56+
//NOTE : rootUrl is only to specify absolute URL, if not specified the path to SWF is used
57+
var httpRequest:HTTPService = rootUrl == null ? new HTTPService() : new HTTPService(rootUrl);
58+
httpRequest.url = serviceUrl;
59+
httpRequest.method = method == null ? GET_METHOD : method;
60+
61+
var servletResultFormat:String;
62+
switch(resultFormatMethod){
63+
case FLASH_VARS_RESULT_FORMAT : servletResultFormat = SERVLET_NAME_VALUE_RESULT_FORMAT; break;
64+
case TEXT_RESULT_FORMAT : servletResultFormat = SERVLET_RAW_RESULT_FORMAT; break;
65+
case ARRAY_RESULT_FORMAT :
66+
case E4X_RESULT_FORMAT :
67+
case FLASH_VARS_RESULT_FORMAT :
68+
default : servletResultFormat = XML_RESULT_FORMAT; break;
69+
}
70+
71+
parameters = parameters == null ? {} : parameters;
72+
parameters[SERVLET_RETURN_METHOD] = servletResultFormat;
73+
74+
httpRequest.resultFormat = resultFormatMethod;
75+
httpRequest.addEventListener(ResultEvent.RESULT, function(event:ResultEvent):void{
76+
callBack.call(thisObject, httpRequest.lastResult, event);
77+
}, false, 0, false);
78+
79+
httpRequest.send(parameters);
80+
}
81+
82+
}
83+
84+
}

jsf-flex-shared/core/src/main/resources/com/googlecode/jsfFlex/shared/util/mxmlConstants.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
<plugins-page>http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash</plugins-page>
1212
</swf-html-attibute>
1313
<swc-source-files>
14-
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/component/DataGridAsynchronousRequest.as</source-file>
15-
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/component/DataGridColumnBean.as</source-file>
14+
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/component/DataGridColumnServiceRequest.as</source-file>
15+
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/component/DataGridServiceRequest.as</source-file>
1616
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/core/ComponentValueMapper.as</source-file>
1717
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/logger/JavaScriptLogger.as</source-file>
1818
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/logger/ILogger.as</source-file>
1919
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/logger/LoggerFactory.as</source-file>
20-
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/services/JSONHttpService.as</source-file>
20+
<source-file>com/googlecode/jsfFlex/shared/actionScript/com/googlecode/jsfFlex/communication/services/JsfFlexHttpService.as</source-file>
2121
</swc-source-files>
2222
<swf-source-files>
2323
<source-file>com/googlecode/jsfFlex/shared/swfSourceFiles/componentValueMapper.xml</source-file>

0 commit comments

Comments
 (0)