Java 类com.badlogic.gdx.scenes.scene2d.utils.Disableable 实例源码

项目:gdx-lml    文件:ColorPickerLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
    final ActorConsumer<?, Color> listener = parser.parseAction(rawAttributeData, Color.WHITE);
    if (listener == null) {
        parser.throwErrorIfStrict(
                "Color picker attribute needs a reference to an action that consumes a Color instance. No method found for ID: "
                        + rawAttributeData);
        return;
    }
    final ColorPickerListener colorPickerListener = getListener(listener);
    actor.addListener(new ClickListener() {
        @Override
        public void clicked(final InputEvent event, final float x, final float y) {
            if (actor instanceof Disableable && ((Disableable) actor).isDisabled()) {
                return;
            }
            final ColorPicker colorPicker = ColorPickerContainer.requestInstance();
            colorPicker.setListener(null);
            colorPicker.setColor(actor.getColor());
            colorPicker.setListener(colorPickerListener);
            colorPicker.centerWindow();
            actor.getStage().addActor(colorPicker.fadeIn());
        }
    });
}
项目:gdx-lml-vis    文件:ColorPickerLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
    final ActorConsumer<?, Color> listener = parser.parseAction(rawAttributeData, Color.WHITE);
    if (listener == null) {
        parser.throwErrorIfStrict(
                "Color picker attribute needs a reference to an action that consumes a Color instance. No method found for ID: "
                        + rawAttributeData);
        return;
    }
    final ColorPickerListener colorPickerListener = getListener(listener);
    actor.addListener(new ClickListener() {
        @Override
        public void clicked(final InputEvent event, final float x, final float y) {
            if (actor instanceof Disableable && ((Disableable) actor).isDisabled()) {
                return;
            }
            final ColorPicker colorPicker = ColorPickerContainer.requestInstance();
            colorPicker.setListener(null);
            colorPicker.setColor(actor.getColor());
            colorPicker.setListener(colorPickerListener);
            colorPicker.centerWindow();
            actor.getStage().addActor(colorPicker.fadeIn());
        }
    });
}
项目:vis-editor    文件:SimpleFormValidator.java   
private void updateWidgets () {
    for (Disableable disableable : disableTargets) {
        disableable.setDisabled(formInvalid);
    }

    if (messageLabel != null) {
        if (errorMsgText != null) {
            messageLabel.setText(errorMsgText);
        } else {
            messageLabel.setText(successMsg); //setText will default to "" if successMsg is null
        }

        Color targetColor = errorMsgText != null ? style.errorLabelColor : style.validLabelColor;
        if (targetColor != null && style.colorTransitionDuration != 0) {
            messageLabel.addAction(Actions.color(targetColor, style.colorTransitionDuration));
        } else {
            messageLabel.setColor(targetColor);
        }
    }
}
项目:gdx-lml    文件:DisabledLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final Actor actor, final String rawAttributeData) {
    if (actor instanceof Disableable) {
        ((Disableable) actor).setDisabled(parser.parseBoolean(rawAttributeData, actor));
    } else {
        parser.throwErrorIfStrict(
                "This widget cannot be disabled, as it does not implement Disableable interface. Received disabled attribute on tag: "
                        + tag.getTagName() + " with actor: " + actor);
    }
}
项目:gdx-lml    文件:DisableOnFormErrorLmlAttribute.java   
@Override
protected void processFormAttribute(final LmlParser parser, final LmlTag tag, final VisFormTable parent,
        final Actor actor, final String rawAttributeData) {
    if (actor instanceof Disableable) {
        if (parser.parseBoolean(rawAttributeData, actor)) {
            parent.addWidgetToDisable((Disableable) actor);
        }
    } else {
        parser.throwErrorIfStrict(
                "Only Disableable widgets can be attached to the form with this attribute. Found widget that does not implement Disableable attribute: "
                        + actor + " with tag: " + tag.getTagName());
    }
}
项目:gdx-lml    文件:VisStageAttacher.java   
@Override
public void clicked(final InputEvent event, final float x, final float y) {
    if (actor instanceof Disableable && ((Disableable) actor).isDisabled()) {
        return;
    }
    actor.getStage().addActor(visWindow.fadeIn());
}
项目:gdx-lml-vis    文件:DisableOnFormErrorLmlAttribute.java   
@Override
protected void processFormAttribute(final LmlParser parser, final LmlTag tag, final VisFormTable parent,
        final Actor actor, final String rawAttributeData) {
    if (actor instanceof Disableable) {
        if (parser.parseBoolean(rawAttributeData, actor)) {
            parent.addWidgetToDisable((Disableable) actor);
        }
    } else {
        parser.throwErrorIfStrict(
                "Only Disableable widgets can be attached to the form with this attribute. Found widget that does not implement Disableable attribute: "
                        + actor + " with tag: " + tag.getTagName());
    }
}
项目:gdx-lml-vis    文件:VisStageAttacher.java   
@Override
public void clicked(final InputEvent event, final float x, final float y) {
    if (actor instanceof Disableable && ((Disableable) actor).isDisabled()) {
        return;
    }
    actor.getStage().addActor(visWindow.fadeIn());
}
项目:gaiasky    文件:LandAtWindow.java   
/**
 * Sets the enabled property on the given components
 * 
 * @param enabled
 * @param components
 */
protected void enableComponents(boolean enabled, Disableable... components) {
    for (Disableable c : components) {
        if (c != null)
            c.setDisabled(!enabled);
    }
}
项目:gaiasky    文件:GenericDialog.java   
/**
 * Sets the enabled property on the given components
 * 
 * @param enabled
 * @param components
 */
protected void enableComponents(boolean enabled, Disableable... components) {
    for (Disableable c : components) {
        if (c != null)
            c.setDisabled(!enabled);
    }
}
项目:gdx-lml    文件:VisFormTable.java   
/** See {@link SimpleFormValidator#addDisableTarget(Disableable)}.
 *
 * @param disableable will be disabled if any errors are found in the form. */
public void addWidgetToDisable(final Disableable disableable) {
    formValidator.addDisableTarget(disableable);
}
项目:gdx-lml-vis    文件:VisFormTable.java   
/** See {@link SimpleFormValidator#addDisableTarget(Disableable)}.
 *
 * @param disableable will be disabled if any errors are found in the form. */
public void addWidgetToDisable(final Disableable disableable) {
    formValidator.addDisableTarget(disableable);
}
项目:vis-editor    文件:SimpleFormValidator.java   
/**
 * @param targetToDisable target actor that will be disabled if form is invalid. Eg. you can pass form Confirm button.
 * May be null.
 * @param messageLabel label that text will be changed if from is valid or invalid. May be null.
 */
public SimpleFormValidator (Disableable targetToDisable, Label messageLabel, FormValidatorStyle style) {
    this.style = style;
    if (targetToDisable != null) disableTargets.add(targetToDisable);
    this.messageLabel = messageLabel;
}
项目:vis-editor    文件:SimpleFormValidator.java   
public void addDisableTarget (Disableable disableable) {
    disableTargets.add(disableable);
    updateWidgets();
}
项目:vis-editor    文件:SimpleFormValidator.java   
public boolean removeDisableTarget (Disableable disableable) {
    boolean result = disableTargets.removeValue(disableable, true);
    updateWidgets();
    return result;
}
项目:vis-editor    文件:FormValidator.java   
/** @see SimpleFormValidator#SimpleFormValidator(Disableable) */
public FormValidator (Disableable targetToDisable) {
    super(targetToDisable);
}
项目:vis-editor    文件:FormValidator.java   
/** @see SimpleFormValidator#SimpleFormValidator(Disableable, Label) */
public FormValidator (Disableable targetToDisable, Label messageLabel) {
    super(targetToDisable, messageLabel);
}
项目:vis-editor    文件:FormValidator.java   
/** @see SimpleFormValidator#SimpleFormValidator(Disableable, Label, String) */
public FormValidator (Disableable targetToDisable, Label messageLabel, String styleName) {
    super(targetToDisable, messageLabel, styleName);
}
项目:vis-editor    文件:FormValidator.java   
/** @see SimpleFormValidator#SimpleFormValidator(Disableable, Label, FormValidatorStyle) */
public FormValidator (Disableable targetToDisable, Label messageLabel, FormValidatorStyle style) {
    super(targetToDisable, messageLabel, style);
}
项目:ead    文件:EnableActionListener.java   
public EnableActionListener(Disableable disableable) {
    this.disableable = disableable;
}
项目:vis-editor    文件:SimpleFormValidator.java   
/**
 * @param targetToDisable target actor that will be disabled if form is invalid. Eg. you can pass form Confirm button.
 * May be null.
 */
public SimpleFormValidator (Disableable targetToDisable) {
    this(targetToDisable, null, "default");
}
项目:vis-editor    文件:SimpleFormValidator.java   
/**
 * @param targetToDisable target actor that will be disabled if form is invalid. Eg. you can pass form Confirm button.
 * May be null.
 * @param messageLabel label that text will be changed if from is valid or invalid. May be null.
 */
public SimpleFormValidator (Disableable targetToDisable, Label messageLabel) {
    this(targetToDisable, messageLabel, "default");
}
项目:vis-editor    文件:SimpleFormValidator.java   
/**
 * @param targetToDisable target actor that will be disabled if form is invalid. Eg. you can pass form Confirm button.
 * May be null.
 * @param messageLabel label that text will be changed if from is valid or invalid. May be null.
 */
public SimpleFormValidator (Disableable targetToDisable, Label messageLabel, String styleName) {
    this(targetToDisable, messageLabel, VisUI.getSkin().get(styleName, FormValidatorStyle.class));
}
项目:vis-editor    文件:Draggable.java   
/**
 * @param actor might be a {@link Disableable}.
 * @return true if actor is disabled.
 */
protected boolean isDisabled (final Actor actor) {
    return actor instanceof Disableable && ((Disableable) actor).isDisabled();
}