易截截图软件、单文件、免安装、纯绿色、仅160KB

JAVA和Flex敏捷调用(二)

    Flex在和java调用过程中,其实有更加灵活的办法来提高系统的敏捷度,极大提高系统的耦合和开发效率。在这里我继续给大家介绍一下,敏捷调用中的java动态代码调用。
    先看java的类(BeanShell)这里主要是接收java代码来动态调用的
    package com.shine.framework.beanShell;
import bsh.Interpreter;
public class BeanShell {
public Object executBeanShell(String code) {
try {
Interpreter inter = new Interpreter();
inter.eval(code);
return inter.get("result");
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
   然后把该类配置到remoting-config.xml
  <destination id="beanShell">
<properties>
<source>com.shine.framework.beanShell.BeanShell</source>
</properties>
</destination>
  再写一个静态的beanShell在actionscript,以单例模式
  package com.shine.framework.beanShell
{
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.mxml.RemoteObject;
import mx.controls.Alert;
public class BeanShell
{
private static var _instance:BeanShell;
private var method:Function;
public function BeanShell(enforcer:SingletonEnforcer)
{
}
public static function getInstance():BeanShell
{
if (BeanShell._instance == null)
{
BeanShell._instance=new BeanShell(new SingletonEnforcer());
}
return BeanShell._instance;
}
public function beanShell(code:String, method:Function=null):void
{
this.method=method;
var beanShell:RemoteObject=new RemoteObject;
beanShell.destination="beanShell";
beanShell.addEventListener(FaultEvent.FAULT, error);
beanShell.endpoint="messagebroker/amf";
beanShell.executBeanShell(code);
beanShell.addEventListener(ResultEvent.RESULT, getRomoteHelloRes);
}
private function getRomoteHelloRes(e:ResultEvent):void
{
if(this.method!=null){
this.method.call(this, e.result);
}
}


相关文档:

理解 flex component

component就是一个AS class 或者是MXML component文件在manifest文件中映射的标签.分可视和不可视
可视化component包括Containers 和 UI controls
Containers(Appliction, Panel...)
UI controls(Button, Label)
可以通过3种方式设置component的属性
1.tag attributers
Java代码
<mx:Application xmln ......

Flex Chart 技巧 移除浮水印

Flex Chart 虽然有提供完整的试用功能
不过编译完成的图表会加上水印
 “Flex Data Visualization Trial”的字样。
既然是 AS,那事情就简单了
只要在 Flex Project 內加上以下 Class:
一定要创建mx.charts.chartClasses,覆盖FLEX自带的ChartLicenseHandler
package mx.charts.chartClasses { ......

JAVA程序员的钱途

      清华大学出版社《Java程序员,上班那点事儿》作者:钟声 章节:1.1小节
      我们刚刚进入本书的正题就拿出一个俗不可耐“钱”字来和大家大谈特谈,未免不雅。但是,我还是要在一开始就要说这个问题,因为这是很多朋友关心的问题,为什么不先说 ......

Java线程之yeild()理解

测试中发现如果几个处于可运行状态的线程的优先级都小于或者等于6时,yield()方法可将运行机会让给优先级为6和优先级为5的线程。
而如果调用了yield()方法的线程的优先级大于或等于7时,则不会将运行机会让给其他线程。 ......

myeclipse注册机,java写的适用于所有版本


import java.io.*;
public class Test {
    public static String convert(String s) {
        if (s == null || s.length() == 0)
            return s;
        ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号