use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class XML_Transformer method renameType.
public static void renameType(ObjType type, String newName, PROPERTY... props) {
// backUp();
// after files are read
boolean dynamic = false;
if (props == null) {
dynamic = true;
}
// props = getValuesForType(obj_type);
for (PROPERTY prop : props) {
if (dynamic) {
}
for (OBJ_TYPE key : ContentManager.getOBJ_TYPEsForValue(prop)) {
for (ObjType objType : DataManager.getTypes(key)) {
String value = objType.getProperty(prop);
value = value.replaceAll(type.getName(), newName);
objType.setProperty(prop, value);
}
XML_Writer.writeXML_ForTypeGroup(key);
}
}
type.setName(newName);
XML_Writer.writeXML_ForType(type, type.getOBJ_TYPE_ENUM());
// XML_File file = getFile(type.getOBJ_TYPE_ENUM());
// String newContents = file
// .getContents()
// .replaceAll(XML_Converter.openXML(type.getName()), XML_Converter
// .openXML(newName));
// newContents =
// file.getContents().replaceAll(XML_Converter.closeXML(type
// .getName()), XML_Converter.closeXML(newName));
// String nameOpen = XML_Converter.openXML(type.getName());
// String nameClose = XML_Converter.closeXML(type.getName());
// newContents = file.getContents().replaceFirst(nameOpen +
// type.getName()
// + nameClose, nameOpen + newName + nameClose);
// file.setContents(newContents);
// XML_Writer.write(file);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class MusicList method toBase.
@Override
public void toBase() {
super.toBase();
tracks = new ArrayList<>();
String property = getProperty(AT_PROPS.TRACKS);
for (ObjType t : DataManager.toTypeList(property, AT_OBJ_TYPE.TRACK)) {
// duplicate preCheck
tracks.add(MusicCore.getTrack(t));
}
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class MC_ControlPanel method massEdit.
public static void massEdit(boolean emptyOnly) {
List<ObjType> types = DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST);
VALUE prop = getMassFilterValue();
if (prop != null) {
String filterValue = inputMassValue(prop);
for (ObjType sub : new ArrayList<>(types)) // if (emptyOnly) {
{
if (!sub.checkContainerProp((PROPERTY) prop, filterValue, true)) {
types.remove(sub);
}
}
// } else if (!generic.checkValue(prop, filterValue))
// types.remove(generic);
}
prop = getMassEditValue();
if (prop == null) {
return;
}
if (emptyOnly) {
for (ObjType sub : new ArrayList<>(types)) {
if (sub.checkValue(prop)) {
types.remove(sub);
}
}
}
massEdit(types, prop);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class MC_ControlPanel method massEdit.
public static void massEdit(List<ObjType> types, VALUE prop) {
// GenericListChooser.s
types = ListChooser.chooseTypes_(types);
if (types.isEmpty()) {
return;
}
String value = inputMassValue(prop);
if (StringMaster.isEmpty(value)) {
return;
}
MOD_PROP_TYPE p = new EnumMaster<MOD_PROP_TYPE>().selectEnum(MOD_PROP_TYPE.class);
// }
for (ObjType sub : (types)) {
sub.modifyProperty(p, (PROPERTY) prop, value);
}
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class MC_ControlPanel method doDialog.
public static void doDialog(boolean alt, boolean shift, boolean ctrl, MusicList list, boolean last) {
if (!last) {
dialogChooseOrRandom = alt || DialogMaster.confirm("Choose or random?");
}
if (!last) {
dialogListTypes = new ArrayList<>(DataManager.getTypes(AT_OBJ_TYPE.MUSIC_LIST));
dialogListTypes = filterViaDialog(dialogListTypes, ctrl, shift);
cachedDialogListTypes = new ArrayList<>(dialogListTypes);
}
String result;
if (dialogChooseOrRandom) {
result = ListChooser.chooseType(dialogListTypes).getProperty(AT_PROPS.PATH);
} else {
ObjType item = new RandomWizard<ObjType>().getRandomListItem(dialogListTypes);
dialogListTypes.remove(item);
if (dialogListTypes.isEmpty()) {
dialogListTypes = new ArrayList<>(cachedDialogListTypes);
}
result = item.getProperty(AT_PROPS.PATH);
}
// String listPath = DataManager.getType(result, AT_OBJ_TYPE.MUSIC_LIST
// )
// .getProperty(AT_PROPS.PATH);
PLAY_MODE playMode = MusicMouseListener.getPlayMode();
if (ctrl) {
playMode = new EnumMaster<PLAY_MODE>().retrieveEnumConst(PLAY_MODE.class, ListChooser.chooseEnum(PLAY_MODE.class));
}
MusicMouseListener.playM3uList(result, playMode);
}
Aggregations