use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class SessionControlPanel method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
boolean alt = MathMaster.isMaskAlt(e.getModifiers());
switch(e.getActionCommand()) {
case SAVE:
ObjType type = session.getType();
if (alt) {
type = new ObjType(session.getType());
type.setName(type.getName() + " " + SessionMaster.TEMPLATE);
type.setProperty(AT_PROPS.SESSION_TYPE, SessionMaster.TEMPLATE);
}
XML_Writer.writeXML_ForType(type);
if (alt) {
DialogMaster.inform(session + " saved as Template!");
}
break;
case PIN:
if (alt) {
// TODO goals
}
List<Task> tasks = PromptMaster.taskPrompt(true, TASK_STATUS.PINNED);
for (Task t : tasks) {
t.setStatus(TASK_STATUS.PINNED);
// t.setProperty(AT_PROPS.SESSION, value)
session.pinTask(t);
t.toBase();
}
if (DialogMaster.confirm("Set Pinned Custom View?")) {
session.getWindow().getGoalsPanel().setViewOption(VIEW_OPTION.PINNED);
}
break;
case COMPILE:
// SessionMaster.createTaskCompilation();
break;
case PAUSE:
session.getWindow().getTimer().pause();
ZeitMaster.paused(session);
break;
case RESUME:
session.getWindow().getTimer().resume();
ZeitMaster.resumed(session);
break;
case START:
SessionMaster.sessionStarted(session);
ZeitMaster.started(session);
break;
case END_SESSION:
SessionMaster.sessionFinished(session);
ZeitMaster.finished(session);
break;
case ADD:
// TODO
doAdd(alt);
break;
case REMOVE:
if (ArcaneTower.getSelectedEntity() != null) {
DataManager.removeType(ArcaneTower.getSelectedEntity().getType());
ArcaneTower.initDynamicEntities();
}
break;
case EDIT:
// TODO edit goal?
List<String> listData = DataManager.getTypeNames(AT_OBJ_TYPE.GOAL);
List<String> secondListData = DataManager.toStringList(session.getDisplayedGoals());
if (alt) {
}
String result = ListChooser.chooseTypes(AT_OBJ_TYPE.GOAL, listData, secondListData);
if (result == null) {
return;
}
List<Goal> goals = ArcaneTower.getGoals(DataManager.toTypeList(result, AT_OBJ_TYPE.GOAL));
session.setGoals(goals);
session.toBase();
break;
case NEW:
Task task;
if (alt) {
}
task = (Task) ArcaneTower.getEntity(CreationHelper.create(AT_OBJ_TYPE.TASK));
// null;
Goal goal = ArcaneMaster.getCurrentGoal();
// if (ArcaneTower.getSelectedEntity() instanceof Goal)
// goal = (Goal) ArcaneTower.getSelectedEntity();
// else
// goal = ArcaneMaster.chooseGoal();
goal.addTask(task);
break;
}
session.getWindow().refresh();
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class PromptMaster method preSessionPrompt.
public static void preSessionPrompt(Session session, boolean alt) {
if (alt) {
String captureData = DialogMaster.inputText("Input Capture text...");
CaptureParser.initSessionCapture(session, captureData);
return;
}
// SessionMaster.getSessions()
ObjType directionType = DataManager.getType(session.getProperty(AT_PROPS.DIRECTION), AT_OBJ_TYPE.DIRECTION);
if (directionType == null) {
if (ArcaneTower.isTestMode()) {
directionType = DataManager.getTypes(AT_OBJ_TYPE.DIRECTION).get(0);
} else {
directionType = directionPrompt(session);
if (directionType == null) {
return;
}
taskPrompt(session);
goalPrompt(session);
}
}
Direction direction = (Direction) ArcaneTower.getSimulation().getInstance(directionType);
session.setDirection(direction);
// session.setGoals(session.getDirection().getGoals());
session.setTasks(ArcaneTower.getTasks());
// int minutes =
// DialogMaster.inputInt("Preset session length? (minutes)",
// DEFAULT_DURATION);
// setTimer(session);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class CreationHelper method getGroupGoal.
public static Goal getGroupGoal(VIEW_OPTION viewOption) {
ObjType type = null;
if (viewOption == VIEW_OPTION.CHOOSE_GROUP) {
type = ListChooser.chooseTypeFromSubgroup_(AT_OBJ_TYPE.GOAL, "Task Group");
}
if (viewOption == VIEW_OPTION.GROUP_LAST) {
type = (ObjType) ZeitMaster.getLatest(DataManager.getTypesGroup(AT_OBJ_TYPE.GOAL, "Task Group"), AT_PARAMS.TIME_LAST_MODIFIED);
}
if (viewOption == VIEW_OPTION.NEW_GROUP) {
String typeName = CreationHelper.TASK_COMPILATION + " from " + TimeMaster.getDateString();
typeName = NameMaster.getUniqueVersionedName(DataManager.getTypes(AT_OBJ_TYPE.GOAL), typeName);
type = new ObjType(typeName, AT_OBJ_TYPE.GOAL);
ListChooser.addMod(LC_MODS.TEXT_DISPLAYED);
StringMaster.constructEntityNameContainer(PromptMaster.taskPrompt());
String types = ListChooser.chooseTypes(AT_OBJ_TYPE.TASK, "", "");
if (types.isEmpty()) {
return null;
}
type.setProperty(AT_PROPS.TASKS, types);
// unique name if same day!
type.setProperty(AT_PROPS.GOAL_TYPE, CreationHelper.TASK_COMPILATION);
DataManager.addType(type);
ArcaneTower.saveAll();
}
return (Goal) ArcaneTower.getSimulation().getInstance(type);
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class Session method init.
@Override
public void init() {
// default direction? last modified? first in list?
super.init();
ObjType type = DataManager.getType(getProperty(AT_PROPS.DIRECTION), AT_OBJ_TYPE.DIRECTION);
if (type != null) {
direction = (Direction) ArcaneTower.getEntity(type);
} else {
List<ObjType> list = DataManager.toTypeList(getProperty(AT_PROPS.SESSION_DIRECTIONS), AT_OBJ_TYPE.DIRECTION);
if (list.isEmpty()) {
direction = ArcaneTower.getDirections().get(0);
} else {
direction = (Direction) ArcaneTower.getEntity(list.get(0));
}
}
tasks = ArcaneTower.getTasks(getListFromProperty(AT_OBJ_TYPE.TASK, AT_PROPS.TASKS));
goals = ArcaneTower.getGoals(getListFromProperty(AT_OBJ_TYPE.GOAL, AT_PROPS.GOALS));
}
use of main.entity.type.ObjType in project Eidolons by IDemiurge.
the class SessionMaster method getNewSession.
private static Session getNewSession(ObjType type, boolean prompt) {
ObjType templateType = new ObjType(type);
VersionMaster.setVersionToCurrent(templateType);
Session session = (Session) ArcaneTower.getSimulation().getInstance(type);
sessions.add(session);
if (prompt) {
initSession(session);
PromptMaster.preSessionPrompt(session, false);
}
return session;
}
Aggregations