Search in sources :

Example 1 with CustomClass

use of com.ray3k.skincomposer.data.CustomClass in project skin-composer by raeleus.

the class MainListener method loadClasses.

@Override
public void loadClasses(SelectBox classSelectBox) {
    Array names = new Array<>();
    for (Class clazz : Main.BASIC_CLASSES) {
        names.add(clazz.getSimpleName());
    }
    for (CustomClass customClass : main.getJsonData().getCustomClasses()) {
        names.add(customClass);
    }
    classSelectBox.setItems(names);
}
Also used : Array(com.badlogic.gdx.utils.Array) DialogCustomClass(com.ray3k.skincomposer.dialog.DialogCustomClass) CustomClass(com.ray3k.skincomposer.data.CustomClass) DialogCustomClass(com.ray3k.skincomposer.dialog.DialogCustomClass) CustomClass(com.ray3k.skincomposer.data.CustomClass)

Example 2 with CustomClass

use of com.ray3k.skincomposer.data.CustomClass in project skin-composer by raeleus.

the class DialogCustomClass method updateOkButton.

private void updateOkButton() {
    if (classField.getText().matches("^.*[^\\.]$") && DrawableData.validate(displayField.getText())) {
        boolean buttonDisabled = false;
        if (!allowSameName || !classField.getText().equals(originalFullyQualifiedName) || !displayField.getText().equals(originalDisplayName)) {
            for (CustomClass otherClass : main.getJsonData().getCustomClasses()) {
                if (!allowSameName) {
                    if ((otherClass.getDisplayName().equals(displayField.getText())) || otherClass.getFullyQualifiedName().equals(classField.getText())) {
                        buttonDisabled = true;
                        break;
                    }
                } else {
                    if (otherClass.getDisplayName().equals(displayField.getText()) && !otherClass.getDisplayName().equals(originalDisplayName)) {
                        buttonDisabled = true;
                        break;
                    } else if (otherClass.getFullyQualifiedName().equals(classField.getText()) && !otherClass.getFullyQualifiedName().equals(originalFullyQualifiedName)) {
                        buttonDisabled = true;
                        break;
                    }
                }
            }
            for (Class clazz : Main.STYLE_CLASSES) {
                if (classField.getText().equals(clazz.getName())) {
                    buttonDisabled = true;
                }
            }
            for (Class clazz : Main.BASIC_CLASSES) {
                if (displayField.getText().equals(clazz.getSimpleName())) {
                    buttonDisabled = true;
                }
            }
        }
        okButton.setDisabled(buttonDisabled);
        if (!buttonDisabled && !okButton.getListeners().contains(main.getHandListener(), true)) {
            okButton.addListener(main.getHandListener());
        }
    } else {
        okButton.setDisabled(true);
        if (okButton.getListeners().contains(main.getHandListener(), true)) {
            okButton.removeListener(main.getHandListener());
        }
    }
}
Also used : CustomClass(com.ray3k.skincomposer.data.CustomClass) CustomClass(com.ray3k.skincomposer.data.CustomClass)

Example 3 with CustomClass

use of com.ray3k.skincomposer.data.CustomClass in project skin-composer by raeleus.

the class DialogCustomStyle method updateOkButton.

private void updateOkButton() {
    if (StyleData.validate(nameField.getText())) {
        boolean buttonDisabled = false;
        CustomClass customClass = (CustomClass) main.getRootTable().getClassSelectBox().getSelected();
        if (!allowSameName || !nameField.getText().equals(originalName)) {
            for (CustomStyle otherStyle : customClass.getStyles()) {
                if (otherStyle.getName().equals(nameField.getText())) {
                    buttonDisabled = true;
                    break;
                }
            }
        }
        okButton.setDisabled(buttonDisabled);
        if (!buttonDisabled && !okButton.getListeners().contains(main.getHandListener(), true)) {
            okButton.addListener(main.getHandListener());
        }
    } else {
        okButton.setDisabled(true);
        if (okButton.getListeners().contains(main.getHandListener(), true)) {
            okButton.removeListener(main.getHandListener());
        }
    }
}
Also used : CustomStyle(com.ray3k.skincomposer.data.CustomStyle) CustomClass(com.ray3k.skincomposer.data.CustomClass)

Example 4 with CustomClass

use of com.ray3k.skincomposer.data.CustomClass in project skin-composer by raeleus.

the class MainListener method loadStyles.

@Override
public void loadStyles(SelectBox classSelectBox, SelectBox styleSelectBox) {
    int selection = classSelectBox.getSelectedIndex();
    if (selection < Main.BASIC_CLASSES.length) {
        Class selectedClass = Main.BASIC_CLASSES[selection];
        styleSelectBox.setItems(jsonData.getClassStyleMap().get(selectedClass));
        styleSelectBox.setSelectedIndex(0);
    } else {
        CustomClass customClass = (CustomClass) classSelectBox.getSelected();
        styleSelectBox.setItems(customClass.getStyles());
    }
}
Also used : DialogCustomClass(com.ray3k.skincomposer.dialog.DialogCustomClass) CustomClass(com.ray3k.skincomposer.data.CustomClass) DialogCustomClass(com.ray3k.skincomposer.dialog.DialogCustomClass) CustomClass(com.ray3k.skincomposer.data.CustomClass)

Aggregations

CustomClass (com.ray3k.skincomposer.data.CustomClass)4 DialogCustomClass (com.ray3k.skincomposer.dialog.DialogCustomClass)2 Array (com.badlogic.gdx.utils.Array)1 CustomStyle (com.ray3k.skincomposer.data.CustomStyle)1