Example usage for com.badlogic.gdx.scenes.scene2d Actor setUserObject

List of usage examples for com.badlogic.gdx.scenes.scene2d Actor setUserObject

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d Actor setUserObject.

Prototype

public void setUserObject(Object userObject) 

Source Link

Document

Sets an application specific object for convenience.

Usage

From source file:es.eucm.ead.editor.ui.scenes.ribbon.interaction.BehaviorsSelector.java

License:Open Source License

private void addBehavior(Behavior behavior) {
    Event event = behavior.getEvent();
    Actor actor = null;
    if (event instanceof Touch) {
        actor = add(WidgetsUtils.createIcon("touch48x48", skin)).getActor();
    } else if (event instanceof Timer) {
        actor = add(WidgetsUtils.createIcon("timer48x48", skin)).getActor();
    } else if (event instanceof Init) {
        actor = add(WidgetsUtils.createIcon("init48x48", skin)).getActor();
    } else if (event instanceof Key) {
        actor = add(WidgetsUtils.createIcon("key48x48", skin)).getActor();
    }/*from w  w w. java  2 s  . co m*/

    if (actor != null) {
        actor.setUserObject(behavior);
        actor.addListener(new ActionOnClickListener(controller, SetSelection.class, Selection.SCENE_ELEMENT,
                Selection.BEHAVIOR, behavior));
    }
}

From source file:es.eucm.ead.editor.view.widgets.galleries.CategoryLibrary.java

License:Open Source License

@Override
protected void prepareGalleryItem(Actor actor, Object id) {
    if (id instanceof RepoElement) {
        RepoElement selected = (RepoElement) id;
        if (selected.getCategoryList().contains(RepoCategories.MOKAPS, true)) {
            WidgetBuilder.actionOnClick(actor, Play.class,
                    controller.getLibraryManager().getRepoElementContentsFolder(selected).path());
            actor.setUserObject(selected);
        }/*from   w w  w .j a  v  a  2 s.  c  o  m*/
    }
}

From source file:es.eucm.ead.editor.view.widgets.galleries.gallerieswithcategories.CommunityGallery.java

License:Open Source License

@Override
protected void prepareGalleryItem(Actor actor, Object id) {
    final RepoElement elem = (RepoElement) id;
    if (elem.getCategoryList().contains(RepoCategories.MOKAPS, true)) {
        actor.addListener(new RepoTile.RepoTileListener() {
            @Override/*from  w ww .  ja  v  a  2 s. c o  m*/
            public void clickedInLibrary(RepoTileEvent event) {
                controller.action(Play.class,
                        controller.getLibraryManager().getRepoElementContentsFolder(elem).path());
            }
        });
        actor.setUserObject(elem);
    }
}

From source file:mobi.shad.s3lib.gui.GuiUtil.java

License:Apache License

/**
 * @param source//from   ww w  .j  a v  a 2 s . com
 * @param destination
 */
public static void copyActor(Actor source, Actor destination) {
    destination.setBounds(source.getX(), source.getY(), source.getWidth(), source.getHeight());
    destination.setColor(source.getColor());
    destination.setName(source.getName());
    destination.setOrigin(source.getOriginX(), source.getOriginY());
    destination.setRotation(source.getRotation());
    destination.setScale(source.getScaleX(), source.getScaleY());
    destination.setTouchable(source.getTouchable());
    destination.setUserObject(source.getUserObject());
    destination.setVisible(source.isVisible());
    destination.setZIndex(source.getZIndex());
    destination.getStage();
}