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);
}
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());
}
}
}
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());
}
}
}
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());
}
}
Aggregations