/** Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the * group. */ public <T extends Actor> T findActor (String name) { Array<Actor> children = this.children; for (int i = 0, n = children.size; i < n; i++) if (name.equals(children.get(i).getName())) return (T)children.get(i); for (int i = 0, n = children.size; i < n; i++) { Actor child = children.get(i); if (child instanceof Group) { Actor actor = ((Group)child).findActor(name); if (actor != null) return (T)actor; } } return null; }
/** Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the * group. */ public <T extends Actor> T findActor (String name) { Array<Actor> children = this.children; for (int i = 0, n = children.size; i < n; i++) if (name.equals(children.get(i).getName())) return (T)children.get(i); for (int i = 0, n = children.size; i < n; i++) { Actor child = children.get(i); if (child instanceof Group) { Actor actor = ((Group)child).findActor(name); if (actor != null) return (T)actor; } } return null; }
public static <T extends Actor> T findActorSafe(Group group, String name) { if (name == null) return null; return (T) group.findActor(name); } }
@Override public Actor findActor(String name) { return ui.getRoot().findActor(name); }
@Override public Actor findActor(String name) { return ui.getRoot().findActor(name); }
public Actor findActor(String name) { return stage.getRoot().findActor(name); }
public TextButton findTextButton(String name) { return (TextButton) stage.getRoot().findActor(name); }
public Group getRoot() { return (Group) stage.getRoot().findActor(StageBuilder.ROOT_GROUP_NAME); }
public ToggleWidget findToggleWidget(String name) { return (ToggleWidget) stage.getRoot().findActor(name); }
public static Label findAndSetLabelText(Group root, String name, String text, boolean autoScale) { final Label label = root.findActor(name); if (label == null) return null; label.setText(text); if (autoScale) GdxUtils.autoScaleLabel(label); return label; }
public void textFieldFocusChanged(final String actorName) { if (keyboardEventService != null) { keyboardEventService.focusChanged(); } focusedActorName = actorName; if(isKeyboardOpen() && !ignoreFocusChangeActorsList.contains(focusedActorName)) { Actor focusedActor = stage.getRoot().findActor(focusedActorName); updateStagePosition(focusedActor); } }
@Override public Actor getActor(int position, Actor reusableActor) { if (reusableActor == null) { try { Group group = stageBuilder.buildGroup("listwidget/list_item_simple.xml"); String value = getItem(position); Label label = group.findActor("list_item_label"); label.setText(value); return group; } catch (Exception e) { e.printStackTrace(); } } else { String value = getItem(position); Label label = ((Group)reusableActor).findActor("list_item_label"); label.setText(value); return reusableActor; } return null; }
/** Returns the first actor found with the specified name. Note this recursively compares the name of every actor in the * group. */ public <T extends Actor> T findActor (String name) { Array<Actor> children = this.children; for (int i = 0, n = children.size; i < n; i++) if (name.equals(children.get(i).getName())) return (T)children.get(i); for (int i = 0, n = children.size; i < n; i++) { Actor child = children.get(i); if (child instanceof Group) { Actor actor = ((Group)child).findActor(name); if (actor != null) return (T)actor; } } return null; }
public InfoPanel(LmlParser parser) { align(Align.top); fillX(); // Workaround of parser's only single parsing operation limitation LmlParser localParser = new DefaultLmlParser(parser.getData()); localParser.setSyntax(parser.getSyntax()); Group root = (Group) (localParser.parseTemplate(Gdx.files.internal("lml/canvasInfoPanel.lml")).first()); setActor(root); lblPages = root.findActor("lblPages"); lblZoom = root.findActor("lblZoom"); lblPageDimens = root.findActor("lblPageDimens"); lblFileSize = root.findActor("lblFileSize"); updatePagesText(); setZoomLevel(100f); }
private void updateActor(final int position, Group group) { Label nameLabel = group.findActor("name"); Label chipsLabel = group.findActor("chips"); ListItem item = items.get(position); nameLabel.setText(item.getName()); chipsLabel.setText(item.getChips() + ""); Image logo = group.findActor("logo"); Drawable drawable = drawableCache.get(item.getFrame()); if (drawable == null) { TextureAtlas.AtlasRegion atlasRegion = stageBuilder.getAssets().getTextureAtlas("common.atlas").findRegion(item.getFrame()); drawable = new TextureRegionDrawable(atlasRegion); drawableCache.put(item.getFrame(), drawable); } logo.setDrawable(drawable); }
private void updateActor(final int position, Group group) { ListItem item = items.get(position); Image logo = group.findActor("logo"); group.setName(item.getFrame()); Drawable drawable = drawableCache.get(item.getFrame()); if (drawable == null) { TextureAtlas.AtlasRegion atlasRegion = stageBuilder.getAssets().getTextureAtlas("common.atlas").findRegion(item.getFrame()); drawable = new TextureRegionDrawable(atlasRegion); drawableCache.put(item.getFrame(), drawable); } logo.setDrawable(drawable); }
@Override public void expandGuiComponent(String name) { IGui gui = GaiaSky.instance.mainGui; ControlsWindow controls = (ControlsWindow) gui.getGuiStage().getRoot() .findActor(I18n.bundle.get("gui.controlpanel")); controls.getCollapsiblePane(name).expandPane(); }
@Override public void collapseGuiComponent(String name) { IGui gui = GaiaSky.instance.mainGui; ControlsWindow controls = (ControlsWindow) gui.getGuiStage().getRoot() .findActor(I18n.bundle.get("gui.controlpanel")); controls.getCollapsiblePane(name).collapsePane(); }
@Override public float[] getPositionAndSizeGui(String name) { IGui gui = GaiaSky.instance.mainGui; Actor actor = gui.getGuiStage().getRoot().findActor(name); if (actor != null) { float x = actor.getX(); float y = actor.getY(); // x and y relative to parent, so we need to add coordinates of // parents up to top Group parent = actor.getParent(); while (parent != null) { x += parent.getX(); y += parent.getY(); parent = parent.getParent(); } return new float[] { x, y, actor.getWidth(), actor.getHeight() }; } else { return null; } }