use of main.entity.Entity in project Eidolons by IDemiurge.
the class SessionMaster method createSessionFromText.
public static Session createSessionFromText(String text, boolean mergeWithLast) {
String typeName = getSessionName(text);
Entity oldType = null;
if (mergeWithLast) {
oldType = ZeitMaster.getLatest(AT_OBJ_TYPE.SESSION, true);
typeName = oldType.getName();
typeName = NameMaster.getUniqueVersionedName(DataManager.getTypes(AT_OBJ_TYPE.SESSION), typeName);
}
typeName = DialogMaster.inputText("Session/Outcome Name?", typeName);
// TODO fill out - deadline, priority, type
ObjType type = new ObjType(typeName, AT_OBJ_TYPE.SESSION);
// type.setGroup(group, false);
if (oldType != null) {
type.copyValues(oldType, copiedVals);
type.copyValues(oldType, ContentManager.getValuesForType(AT_OBJ_TYPE.SESSION.getName(), false));
}
Session session = getNewSession(type, false);
CaptureParser.initSessionCapture(session, text);
session.setLocked(true);
// initSession(session);
session.toBase();
SessionWindow window = showInWindow(session);
window.refresh();
return session;
}
use of main.entity.Entity in project Eidolons by IDemiurge.
the class TavernView method itemIndexSelected.
public void itemIndexSelected(int i) {
this.setIndex(i);
Unit e = data.get(getSelectedIndex());
if (e instanceof Entity && infoPanel != null) {
infoPanel.setEntity(e);
infoPanel.refresh();
}
if (!isOkBlocked()) {
// "hire"
okButton.setVisuals(VISUALS.FORWARD);
} else {
okButton.setVisuals(VISUALS.FORWARD_BLOCKED);
}
}
use of main.entity.Entity in project Eidolons by IDemiurge.
the class FilterMaster method filter.
public static Collection<?> filter(Collection<?> list, String valueName, String value, OBJ_TYPE TYPE, boolean prop, boolean filterOut, Boolean strict_or_greater_less_equal) {
List<Object> filteredList = new ArrayList<>();
for (Object l : list) {
Entity entity;
if (l instanceof Entity) {
entity = (Entity) l;
} else {
entity = DataManager.getType(l.toString(), TYPE);
}
if (entity == null) {
continue;
}
boolean result;
if (prop) {
PROPERTY property = ContentManager.getPROP(valueName);
if (property.isContainer()) // if (!BooleanMaster.isFalse(strict_or_greater_less_equal))
{
result = entity.checkContainerProp(property, value, strict_or_greater_less_equal == null);
} else {
result = StringMaster.compareByChar(entity.getProperty(property), value, BooleanMaster.isTrue(strict_or_greater_less_equal));
}
// entity.checkProperty();
} else {
PARAMETER param = ContentManager.getPARAM(valueName);
int amount = new Formula(value).getInt(new Ref(entity));
if (strict_or_greater_less_equal == null) {
result = entity.getIntParam(param) == amount;
} else {
result = entity.checkParam(param, "" + amount);
if (!strict_or_greater_less_equal) {
result = !result;
}
}
}
if (filterOut) {
if (result) {
filteredList.add(l);
}
} else if (!result) {
filteredList.add(l);
}
}
for (Object l : filteredList) {
list.remove(l);
}
return list;
}
use of main.entity.Entity in project Eidolons by IDemiurge.
the class ScenarioListPanel method toDataList.
@Override
public List<SelectableItemData> toDataList(List<? extends Entity> objTypes) {
List<SelectableItemData> list = new LinkedList<>();
for (Entity sub : objTypes) {
SelectableItemData item = new SelectableItemData(sub);
list.add(item);
item.setDescription(HelpMaster.getScenarioInfoText(item.getName(), null));
item.setPreviewImagePath(item.getEntity().getProperty(G_PROPS.FULLSIZE_IMAGE));
}
return list;
}
use of main.entity.Entity in project Eidolons by IDemiurge.
the class ListItemMouseListener method mouseClicked.
@Override
public void mouseClicked(MouseEvent arg0) {
JList source = (JList) arg0.getSource();
if (ip != null) {
Entity obj = DataManager.getType(source.getSelectedValue().toString(), TYPE);
ip.setInfoObj(obj);
ip.refresh();
}
if (arg0.isAltDown()) {
buttonPanel.moveOne(SwingUtilities.isRightMouseButton(arg0));
return;
}
if (SwingUtilities.isRightMouseButton(arg0)) {
if (arg0.isAltDown()) {
buttonPanel.edit();
} else {
buttonPanel.moveOne(arg0.getClickCount() > 1);
}
return;
}
if (arg0.getClickCount() > 1) {
if (mode == SELECTION_MODE.SINGLE) {
} else {
if (source == getList()) {
buttonPanel.add();
} else {
buttonPanel.removeOrAdd(mode);
}
}
}
}
Aggregations