当前位置: 首页>>代码示例>>Java>>正文


Java Globals类代码示例

本文整理汇总了Java中org.luaj.vm2.Globals的典型用法代码示例。如果您正苦于以下问题:Java Globals类的具体用法?Java Globals怎么用?Java Globals使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Globals类属于org.luaj.vm2包,在下文中一共展示了Globals类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LVRefreshScroller

import org.luaj.vm2.Globals; //导入依赖的package包/类
public LVRefreshScroller(Globals globals, LuaValue metaTable, Varargs varargs) {
    super(globals.getContext());

    mLuaUserdata = new UDRefreshScroller(this, globals, metaTable, varargs != null ? varargs.arg1() : null);

    LayoutInflater inflater = (LayoutInflater) globals.getContext().getSystemService( Context.LAYOUT_INFLATER_SERVICE );
    View view = inflater.inflate(R.layout.lv_scroller, null);
    this.addView(view, LuaViewUtil.createRelativeLayoutParamsMM());

    mHeaderContainer = (RelativeLayout) view.findViewById(R.id.header_container);
    mPinnedContainer = (RelativeLayout) view.findViewById(R.id.pinned_container);
    mContentContainer = (RelativeLayout) view.findViewById(R.id.content_container);

    // 测试
    this.setEnabled(false);
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:17,代码来源:LVRefreshScroller.java

示例2: standardGlobals

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
     * Create a standard set of globals for JSE including all the libraries.
     *
     * @return Table of globals initialized with the standard JSE libraries
     * @see #debugGlobals()
     * @see JsePlatform
     * @see JmePlatform
     */
    public static Globals standardGlobals(Globals globals) {
        globals.load(new JseBaseLib());
        globals.load(new PackageLib());
        globals.load(new Bit32Lib());
        globals.load(new TableLib());
        globals.load(new StringLib());
        globals.load(new CoroutineLib());
        globals.load(new JseMathLib());
        globals.load(new JseOsLib());
//		globals.load(new JseIoLib());//安全考虑,删除for LuaView
//		globals.load(new LuajavaLib());//安全考虑,删除for LuaView
        LoadState.install(globals);
        LuaC.install(globals);
        return globals;
    }
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:24,代码来源:JsePlatform.java

示例3: setupCompilerGlobal

import org.luaj.vm2.Globals; //导入依赖的package包/类
private static Globals setupCompilerGlobal() {
	// Create server globals with just enough library support to compile user
	// scripts.
	compiler = new Globals();
	compiler.load(new JseBaseLib());
	compiler.load(new PackageLib());
	compiler.load(new StringLib());

	// To load scripts, we occasionally need a math library in addition to compiler
	// support.
	// To limit scripts using the debug library, they must be closures, so we only
	// install LuaC.
	compiler.load(new JseMathLib());
	LoadState.install(compiler);
	LuaC.install(compiler);

	// Set up the LuaString metatable to be read-only since it is shared across all
	// scripts.
	LuaString.s_metatable = new ReadOnlyLuaTable(LuaString.s_metatable);
	return compiler;
}
 
开发者ID:hamilton-lima,项目名称:robolucha,代码行数:22,代码来源:LuaVM.java

示例4: createView

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * create view
 *
 * @param pos
 * @return
 */
private LuaValue createView(int pos, int currentItem) {
    Globals globals = this.mLuaUserdata.getGlobals();
    //View封装
    final LVViewGroup container = createCellLayout();
    final UDViewGroup cell = new UDViewGroup(container, globals, null);
    //对外数据封装,必须使用LuaTable
    final UDLuaTable cellData = new UDLuaTable(cell);

    //call init

    globals.saveContainer(container);
    this.mLuaUserdata.callCellInit(cellData, pos, currentItem);//初始化
    globals.restoreContainer();

    //set tag
    View view = cellData.getView();
    if (view != null) {
        view.setTag(Constants.RES_LV_TAG, cellData);
    }
    return cellData;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:28,代码来源:LVCustomViewPagerIndicator.java

示例5: main

import org.luaj.vm2.Globals; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    //Globals globals = JsePlatform.standardGlobals();
    Globals globals = new Globals();
    globals.load(new JseBaseLib());
    globals.load(new PackageLib());
    globals.load(new Bit32Lib());
    globals.load(new TableLib());
    globals.load(new StringLib());
    globals.load(new CoroutineLib());
    globals.load(new JseMathLib());
    globals.load(new JseIoLib());
    globals.load(new JseOsLib());
    globals.load(new JavaLibInteractionTest());
    LoadState.install(globals);
    LuaC.install(globals);
    System.out.println(new File(".").getAbsolutePath());
    System.out.println(new File(args[0]).exists());
    LuaValue chunk = globals.loadfile(new File(args[0]).getAbsolutePath());
    chunk.call();
}
 
开发者ID:LukkitPlus,项目名称:Lukkit,代码行数:21,代码来源:JavaLibInteractionTest.java

示例6: preCreateGlobals

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * pre create globals
 *
 * @return
 */
public static synchronized void preCreateGlobals() {
    synchronized (LuaViewManager.class) {
        if (sStaticGlobals == null) {
            new SimpleTask0() {
                @Override
                public void doTask() {
                    synchronized (LuaViewManager.class) {
                        if (sStaticGlobals == null) {
                            sStaticGlobals = setupGlobals(new Globals());
                        }
                    }
                }
            }.executeInPool();
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:22,代码来源:LuaViewManager.java

示例7: createGlobalsAsync

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * 创建Globals
 * 根据是否用lua-to-java bytecode来处理(如果使用LuaJC的话则会使用库bcel 533k)
 *
 * @return
 */
public static Globals createGlobalsAsync() {
    if (sStaticGlobals != null) {
        synchronized (sStaticGlobals) {
            Globals result = sStaticGlobals;
            sStaticGlobals = null;
            return result;
        }
    } else {
        final Globals globals = new Globals();
        new SimpleTask<Globals>() {
            @Override
            public void doTask(Globals... params) {
                setupGlobals(params != null && params.length > 0 ? params[0] : null);
            }
        }.executeSerial(globals);//TODO 这里放到serial线程中执行,而不是executeInPool中执行,为了保证后续的执行时序列
        return globals;
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:25,代码来源:LuaViewManager.java

示例8: setupGlobals

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * setup global values
 *
 * @param globals
 */
private static Globals setupGlobals(Globals globals) {
    if (globals != null) {
        if (LuaViewConfig.isOpenDebugger()) {
            JsePlatform.debugGlobals(globals);
        } else {
            JsePlatform.standardGlobals(globals);//加载系统libs TODO 性能瓶颈
        }

        if (LuaViewConfig.isUseLuaDC()) {
            LuaDC.install(globals);
        }
        loadLuaViewLibs(globals);//加载用户lib TODO 性能瓶颈
        globals.isInited = true;
    }
    return globals;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:22,代码来源:LuaViewManager.java

示例9: newStandard

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * Create a new lua Globals object representing the standard one used in this game
 *
 * @return a new Globals instance
 */
public static Globals newStandard() {
    Globals globals = new Globals();
    globals.load(new JseBaseLib());
    globals.load(new PackageLib());
    globals.load(new Bit32Lib());
    globals.load(new TableLib());
    globals.load(new StringLib());
    globals.load(new JseMathLib());
    LoadState.install(globals);
    LuaC.install(globals);
    LuaJC.install(globals);
    return globals;
}
 
开发者ID:SergeySave,项目名称:SpaceGame,代码行数:19,代码来源:LuaUtils.java

示例10: getActionBar

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * 获得actionbar
 *
 * @param globals
 * @return
 */
public static ActionBar getActionBar(Globals globals) {
    if (globals != null && globals.getContext() instanceof Activity) {
        return ((Activity) (globals.getContext())).getActionBar();
    }
    return null;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:13,代码来源:LuaViewUtil.java

示例11: children

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * 提供View的构造环境,注意,callback里面不能有异步操作,否则操作的时序上会混乱
 *
 * @param callback
 * @return
 */
public UDViewGroup children(LuaFunction callback) {
    if (getView() instanceof ViewGroup) {
        Globals globals = getGlobals();
        if (globals != null) {
            globals.pushContainer(getView());
            LuaUtil.callFunction(callback, this);
            globals.popContainer();
        }
    }
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:18,代码来源:UDViewGroup.java

示例12: init

import org.luaj.vm2.Globals; //导入依赖的package包/类
private void init(Globals globals) {
    globals.saveContainer(mRecyclerView);
    this.addView(mRecyclerView, LuaViewUtil.createRelativeLayoutParamsMM());
    globals.restoreContainer();

    if (!globals.isRefreshContainerEnable) {
        this.setEnabled(false);
    } else {
        ((UDRefreshRecyclerView) getUserdata()).initPullRefresh();
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:12,代码来源:LVRefreshRecyclerView.java

示例13: LVViewGroup

import org.luaj.vm2.Globals; //导入依赖的package包/类
public LVViewGroup(Context context, Globals globals, LuaValue metaTable, Varargs varargs) {
        super(context);
        this.mLuaUserdata = createUserdata(globals, metaTable, varargs);
        //改在UDViewGroup中设置,减少影响面
//        this.setFocusableInTouchMode(true);//需要设置,否则onKeyUp等事件无法监听,排查是否会带来其他问题(点击的时候需要点击两下)
//        this.setDescendantFocusability(FOCUS_BLOCK_DESCENDANTS);
//        this.setClipChildren(false);
    }
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:9,代码来源:LVViewGroup.java

示例14: luaMain

import org.luaj.vm2.Globals; //导入依赖的package包/类
/**
 * Simple wrapper for invoking a lua function with command line arguments.
 * The supplied function is first given a new Globals object,
 * then the program is run with arguments.
 */
public static void luaMain(LuaValue mainChunk, String[] args) {
    Globals g = standardGlobals();
    int n = args.length;
    LuaValue[] vargs = new LuaValue[args.length];
    for (int i = 0; i < n; ++i)
        vargs[i] = LuaValue.valueOf(args[i]);
    LuaValue arg = LuaValue.listOf(vargs);
    arg.set("n", n);
    g.set("arg", arg);
    mainChunk.initupvalue1(g);
    mainChunk.invoke(LuaValue.varargsOf(vargs));
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:18,代码来源:JsePlatform.java

示例15: LVTextView

import org.luaj.vm2.Globals; //导入依赖的package包/类
public LVTextView(Globals globals, LuaValue metaTable, Varargs varargs) {
        super(globals.getContext());
        this.mLuaUserdata = new UDTextView(this, globals, metaTable, varargs);
        this.setIncludeFontPadding(false);//设置默认TextView不包含字体的padding,否则adjustSize的时候拿到的高度有问题
        this.setGravity(Gravity.CENTER_VERTICAL);//默认竖直居中
        this.setLines(1);//默认一行
        this.setTextSize(UDFontSize.FONTSIZE_SMALL);
//        this.setEllipsize(TextUtils.TruncateAt.END);//默认在最后有3个点
    }
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:10,代码来源:LVTextView.java


注:本文中的org.luaj.vm2.Globals类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。