private void focusChanged (FocusEvent event) { Stage stage = getStage(); if (isModal && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this) && !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus))) event.cancel(); } } };
private void focusChanged (FocusEvent event) { Stage stage = getStage(); if (isModal && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this) && !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus))) event.cancel(); } } };
private void setLayoutEnabled (Group parent, boolean enabled) { SnapshotArray<Actor> children = parent.getChildren(); for (int i = 0, n = children.size; i < n; i++) { Actor actor = children.get(i); if (actor instanceof Layout) ((Layout)actor).setLayoutEnabled(enabled); else if (actor instanceof Group) // setLayoutEnabled((Group)actor, enabled); } }
private void setLayoutEnabled (Group parent, boolean enabled) { SnapshotArray<Actor> children = parent.getChildren(); for (int i = 0, n = children.size; i < n; i++) { Actor actor = children.get(i); if (actor instanceof Layout) ((Layout)actor).setLayoutEnabled(enabled); else if (actor instanceof Group) // setLayoutEnabled((Group)actor, enabled); } }
/** @return May be null. */ private TextField findNextTextField (Array<Actor> actors, TextField best, Vector2 bestCoords, Vector2 currentCoords, boolean up) { for (int i = 0, n = actors.size; i < n; i++) { Actor actor = actors.get(i); if (actor instanceof TextField) { if (actor == this) continue; TextField textField = (TextField)actor; if (textField.isDisabled() || !textField.focusTraversal || !textField.ancestorsVisible()) continue; Vector2 actorCoords = actor.getParent().localToStageCoordinates(tmp3.set(actor.getX(), actor.getY())); boolean below = actorCoords.y != currentCoords.y && (actorCoords.y < currentCoords.y ^ up); boolean right = actorCoords.y == currentCoords.y && (actorCoords.x > currentCoords.x ^ up); if (!below && !right) continue; boolean better = best == null || (actorCoords.y != bestCoords.y && (actorCoords.y > bestCoords.y ^ up)); if (!better) better = actorCoords.y == bestCoords.y && (actorCoords.x < bestCoords.x ^ up); if (better) { best = (TextField)actor; bestCoords.set(actorCoords); } } else if (actor instanceof Group) best = findNextTextField(((Group)actor).getChildren(), best, bestCoords, currentCoords, up); } return best; }
/** @return May be null. */ private TextField findNextTextField (Array<Actor> actors, TextField best, Vector2 bestCoords, Vector2 currentCoords, boolean up) { for (int i = 0, n = actors.size; i < n; i++) { Actor actor = actors.get(i); if (actor instanceof TextField) { if (actor == this) continue; TextField textField = (TextField)actor; if (textField.isDisabled() || !textField.focusTraversal || !textField.ancestorsVisible()) continue; Vector2 actorCoords = actor.getParent().localToStageCoordinates(tmp3.set(actor.getX(), actor.getY())); boolean below = actorCoords.y != currentCoords.y && (actorCoords.y < currentCoords.y ^ up); boolean right = actorCoords.y == currentCoords.y && (actorCoords.x > currentCoords.x ^ up); if (!below && !right) continue; boolean better = best == null || (actorCoords.y != bestCoords.y && (actorCoords.y > bestCoords.y ^ up)); if (!better) better = actorCoords.y == bestCoords.y && (actorCoords.x < bestCoords.x ^ up); if (better) { best = (TextField)actor; bestCoords.set(actorCoords); } } else if (actor instanceof Group) best = findNextTextField(((Group)actor).getChildren(), best, bestCoords, currentCoords, up); } return best; }
stage.getBatch().disableBlending(); Group root = stage.getRoot(); Array<Actor> actors = root.getChildren();
public void setNativeTextFieldsHidden(Group father,boolean isHidden){ SnapshotArray<Actor> children= father.getChildren(); for(Actor actor:children){ if(actor instanceof NativeTextField){ ((NativeTextField)actor).setHidden(isHidden); } } }
/** 子控件根据zOrder属性排序 */ protected void sort(final ObjectData widget, Group group) { group.getChildren().sort(new Comparator<Actor>() { @Override public int compare(Actor arg0, Actor arg1) { return getZOrder(widget, arg0.getName()) - getZOrder(widget, arg1.getName()); } }); }
private void setChildRelativePositions(Group group, List<BaseModel> childrenModels) { SnapshotArray<Actor> children = group.getChildren(); for (int i = 0; i < childrenModels.size(); i++) { BaseModel childModel = childrenModels.get(i); Actor child = children.get(i); setRelativePositions(group, childModel, child); } }
private void synchronizeAllForStage(Group root){ SnapshotArray<Actor> children= root.getChildren(); for(Actor actor:children){ if(actor instanceof NativeTextField){ NativeTextField son=(NativeTextField)actor; listener.linkNativeTextField(son, NativeTextField.Method.positionChanged); } if(actor instanceof Group)synchronizeAllForStage((Group)actor); } }
private void synchronizeAllForStage(Group root){ SnapshotArray<Actor> children= root.getChildren(); for(Actor actor:children){ if(actor instanceof NativeTextField){ NativeTextField son=(NativeTextField)actor; linkNativeTextField(son, NativeTextField.Method.positionChanged); } if(actor instanceof Group)synchronizeAllForStage((Group)actor); } }
public void setStage(Stage stage) { this.stage = stage; screenHeight = (int) stage.getHeight(); ignoreFocusChangeActorsList = new HashSet<String>(); addFocusChangedListenerToStage(); initialYCoordinateMap.clear(); for(Actor actor : stage.getRoot().getChildren()) { initialYCoordinateMap.put(actor, actor.getY()); } }
private void focusChanged (FocusEvent event) { Stage stage = getStage(); if (isModal && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this) && !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus))) event.cancel(); } } };
private void setLayoutEnabled (Group parent, boolean enabled) { SnapshotArray<Actor> children = parent.getChildren(); for (int i = 0, n = children.size; i < n; i++) { Actor actor = children.get(i); if (actor instanceof Layout) ((Layout)actor).setLayoutEnabled(enabled); else if (actor instanceof Group) // setLayoutEnabled((Group)actor, enabled); } }
private void focusChanged(FocusEvent event) { Stage stage = getStage(); if (isModal() && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == GenericDialog.this) { // Dialog is top most actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(GenericDialog.this) && !(newFocusedActor.equals(previousKeyboardFocus) || newFocusedActor.equals(previousScrollFocus))) event.cancel(); } } };
/** @param group will replace the internally managed group. All current children will be moved to this group. */ @Override public void setActor (final WidgetGroup group) { if (group == null) { throw new IllegalArgumentException("Group cannot be null."); } final Group previousGroup = getActor(); super.setActor(group); attachListener(); // Attaches draggable to all previous group children. for (final Actor child : previousGroup.getChildren()) { group.addActor(child); // No need to attach draggable, child was already in pane. } }
@Override protected void setParent(Group parent) { super.setParent(parent); if (parent != null) { int index = parent.getChildren().indexOf(this, true); parent.addActorAt(index, shadowLabel); } }
private void focusChanged (FocusEvent event) { Stage stage = getStage(); if (isModal && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == Dialog.this) { // Dialog is top most actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(Dialog.this)) event.cancel(); } } });
private void focusChanged (FocusEvent event) { Stage stage = getStage(); if (isModal() && stage != null && stage.getRoot().getChildren().size > 0 && stage.getRoot().getChildren().peek() == VisDialog.this) { // Dialog is top most actor. Actor newFocusedActor = event.getRelatedActor(); if (newFocusedActor != null && !newFocusedActor.isDescendantOf(VisDialog.this)) event.cancel(); } } };