mirror of
https://github.com/AndorsTrailRelease/ATCS.git
synced 2025-10-27 18:44:03 +01:00
Warning hunt. Dialogue sketch I/O progress. Sketch creation from
existing Dialogue begins.
This commit is contained in:
@@ -9,7 +9,6 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@@ -827,7 +826,7 @@ public class Project implements ProjectTreeNode, Serializable {
|
||||
*
|
||||
* @param node. Before calling this method, make sure that no other node with the same class and id exist in either created or altered.
|
||||
*/
|
||||
public void createElements(List<JSONElement> nodes) {
|
||||
public void createElements(List<? extends JSONElement> nodes) {
|
||||
for (JSONElement node : nodes) {
|
||||
//Already added.
|
||||
if (node.getProject() != null) continue;
|
||||
@@ -892,7 +891,6 @@ public class Project implements ProjectTreeNode, Serializable {
|
||||
public void createWriterSketch(WriterModeData node) {
|
||||
node.writable = true;
|
||||
createdContent.writerModeDataSet.add(node);
|
||||
node.state = GameDataElement.State.created;
|
||||
node.link();
|
||||
fireElementAdded(node, getNodeIndex(node));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -26,13 +25,13 @@ import com.gpl.rpg.atcontentstudio.ui.ProjectsTree.ProjectsTreeModel;
|
||||
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
|
||||
|
||||
public class Workspace implements ProjectTreeNode, Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 7938633033601384956L;
|
||||
|
||||
public static final String WS_SETTINGS_FILE = ".workspace";
|
||||
|
||||
|
||||
public static Workspace activeWorkspace;
|
||||
|
||||
|
||||
public Preferences preferences = new Preferences();
|
||||
public File baseFolder;
|
||||
public File settingsFile;
|
||||
@@ -40,16 +39,17 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
public Set<String> projectsName = new HashSet<String>();
|
||||
public Map<String, Boolean> projectsOpenByName = new HashMap<String, Boolean>();
|
||||
public Set<File> knownMapSourcesFolders = new HashSet<File>();
|
||||
|
||||
|
||||
public transient ProjectsTreeModel projectsTreeModel = null;
|
||||
|
||||
|
||||
public Workspace(File workspaceRoot) {
|
||||
baseFolder = workspaceRoot;
|
||||
if (!workspaceRoot.exists()) {
|
||||
try {
|
||||
workspaceRoot.mkdir();
|
||||
} catch (SecurityException e) {
|
||||
Notification.addError("Error creating workspace directory: "+e.getMessage());
|
||||
Notification.addError("Error creating workspace directory: "
|
||||
+ e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -58,14 +58,15 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
try {
|
||||
settingsFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
Notification.addError("Error creating workspace datafile: "+e.getMessage());
|
||||
Notification.addError("Error creating workspace datafile: "
|
||||
+ e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Notification.addSuccess("New workspace created: "+workspaceRoot.getAbsolutePath());
|
||||
Notification.addSuccess("New workspace created: "
|
||||
+ workspaceRoot.getAbsolutePath());
|
||||
save();
|
||||
}
|
||||
|
||||
|
||||
public static void setActive(File workspaceRoot) {
|
||||
Workspace w = null;
|
||||
@@ -82,11 +83,11 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
}
|
||||
activeWorkspace = w;
|
||||
}
|
||||
|
||||
|
||||
public static void saveActive() {
|
||||
activeWorkspace.save();
|
||||
}
|
||||
|
||||
|
||||
public void save() {
|
||||
SettingsSave.saveInstance(this, settingsFile, "Workspace");
|
||||
}
|
||||
@@ -95,82 +96,104 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
public Enumeration<ProjectTreeNode> children() {
|
||||
return Collections.enumeration(projects);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAllowsChildren() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeNode getChildAt(int arg0) {
|
||||
return projects.get(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChildCount() {
|
||||
return projects.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex(TreeNode arg0) {
|
||||
return projects.indexOf(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeNode getParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaf() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenAdded(List<ProjectTreeNode> path) {
|
||||
path.add(0, this);
|
||||
if (projectsTreeModel != null) projectsTreeModel.insertNode(new TreePath(path.toArray()));
|
||||
if (projectsTreeModel != null)
|
||||
projectsTreeModel.insertNode(new TreePath(path.toArray()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenChanged(List<ProjectTreeNode> path) {
|
||||
path.add(0, this);
|
||||
if (projectsTreeModel != null) projectsTreeModel.changeNode(new TreePath(path.toArray()));
|
||||
ATContentStudio.frame.editorChanged(path.get(path.size() - 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void childrenRemoved(List<ProjectTreeNode> path) {
|
||||
path.add(0, this);
|
||||
if (projectsTreeModel != null) projectsTreeModel.removeNode(new TreePath(path.toArray()));
|
||||
if (projectsTreeModel != null)
|
||||
projectsTreeModel.removeNode(new TreePath(path.toArray()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyCreated() {
|
||||
childrenAdded(new ArrayList<ProjectTreeNode>());
|
||||
for (ProjectTreeNode node : projects) {
|
||||
if (node != null) node.notifyCreated();
|
||||
if (node != null)
|
||||
node.notifyCreated();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesc() {
|
||||
return "Workspace: "+baseFolder.getAbsolutePath();
|
||||
return "Workspace: " + baseFolder.getAbsolutePath();
|
||||
}
|
||||
|
||||
|
||||
public static void createProject(final String projectName, final File gameSourceFolder, final Project.ResourceSet sourceSet) {
|
||||
WorkerDialog.showTaskMessage("Creating project "+projectName+"...", ATContentStudio.frame, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (activeWorkspace.projectsName.contains(projectName)) {
|
||||
Notification.addError("A project named "+projectName+" already exists in this workspace.");
|
||||
return;
|
||||
}
|
||||
Project p = new Project(activeWorkspace, projectName, gameSourceFolder, sourceSet);
|
||||
activeWorkspace.projects.add(p);
|
||||
activeWorkspace.projectsName.add(projectName);
|
||||
activeWorkspace.projectsOpenByName.put(projectName, p.open);
|
||||
activeWorkspace.knownMapSourcesFolders.add(gameSourceFolder);
|
||||
p.notifyCreated();
|
||||
Notification.addSuccess("Project "+projectName+" successfully created");
|
||||
saveActive();
|
||||
}
|
||||
});
|
||||
public static void createProject(final String projectName,
|
||||
final File gameSourceFolder, final Project.ResourceSet sourceSet) {
|
||||
WorkerDialog.showTaskMessage("Creating project " + projectName + "...",
|
||||
ATContentStudio.frame, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (activeWorkspace.projectsName.contains(projectName)) {
|
||||
Notification.addError("A project named "
|
||||
+ projectName
|
||||
+ " already exists in this workspace.");
|
||||
return;
|
||||
}
|
||||
Project p = new Project(activeWorkspace, projectName,
|
||||
gameSourceFolder, sourceSet);
|
||||
activeWorkspace.projects.add(p);
|
||||
activeWorkspace.projectsName.add(projectName);
|
||||
activeWorkspace.projectsOpenByName.put(projectName,
|
||||
p.open);
|
||||
activeWorkspace.knownMapSourcesFolders
|
||||
.add(gameSourceFolder);
|
||||
p.notifyCreated();
|
||||
Notification.addSuccess("Project " + projectName
|
||||
+ " successfully created");
|
||||
saveActive();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void closeProject(Project p) {
|
||||
int index = activeWorkspace.projects.indexOf(p);
|
||||
if (index < 0) {
|
||||
Notification.addError("Cannot close unknown project "+p.name);
|
||||
Notification.addError("Cannot close unknown project " + p.name);
|
||||
return;
|
||||
}
|
||||
p.close();
|
||||
@@ -180,27 +203,31 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
cp.notifyCreated();
|
||||
saveActive();
|
||||
}
|
||||
|
||||
|
||||
public static void openProject(final ClosedProject cp) {
|
||||
WorkerDialog.showTaskMessage("Opening project "+cp.name+"...", ATContentStudio.frame, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int index = activeWorkspace.projects.indexOf(cp);
|
||||
if (index < 0) {
|
||||
Notification.addError("Cannot open unknown project "+cp.name);
|
||||
return;
|
||||
}
|
||||
cp.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||
Project p = Project.fromFolder(activeWorkspace, new File(activeWorkspace.baseFolder, cp.name));
|
||||
p.open();
|
||||
activeWorkspace.projects.set(index, p);
|
||||
activeWorkspace.projectsOpenByName.put(p.name, true);
|
||||
p.notifyCreated();
|
||||
saveActive();
|
||||
}
|
||||
});
|
||||
WorkerDialog.showTaskMessage("Opening project " + cp.name + "...",
|
||||
ATContentStudio.frame, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int index = activeWorkspace.projects.indexOf(cp);
|
||||
if (index < 0) {
|
||||
Notification
|
||||
.addError("Cannot open unknown project "
|
||||
+ cp.name);
|
||||
return;
|
||||
}
|
||||
cp.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||
Project p = Project.fromFolder(activeWorkspace,
|
||||
new File(activeWorkspace.baseFolder, cp.name));
|
||||
p.open();
|
||||
activeWorkspace.projects.set(index, p);
|
||||
activeWorkspace.projectsOpenByName.put(p.name, true);
|
||||
p.notifyCreated();
|
||||
saveActive();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void refreshTransients() {
|
||||
this.projects = new ArrayList<ProjectTreeNode>();
|
||||
Set<String> projectsFailed = new HashSet<String>();
|
||||
@@ -212,11 +239,16 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
if (p != null) {
|
||||
projects.add(p);
|
||||
} else {
|
||||
Notification.addError("Failed to open project "+projectName+". Removing it from workspace (not from filesystem though).");
|
||||
Notification
|
||||
.addError("Failed to open project "
|
||||
+ projectName
|
||||
+ ". Removing it from workspace (not from filesystem though).");
|
||||
projectsFailed.add(projectName);
|
||||
}
|
||||
} else {
|
||||
Notification.addError("Unable to find project "+projectName+"'s root folder. Removing it from workspace");
|
||||
Notification.addError("Unable to find project "
|
||||
+ projectName
|
||||
+ "'s root folder. Removing it from workspace");
|
||||
projectsFailed.add(projectName);
|
||||
}
|
||||
} else {
|
||||
@@ -229,21 +261,31 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
}
|
||||
notifyCreated();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Project getProject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getIcon() {return null;}
|
||||
@Override
|
||||
public Image getClosedIcon() {return null;}
|
||||
@Override
|
||||
public Image getLeafIcon() {return null;}
|
||||
@Override
|
||||
public Image getOpenIcon() {return null;}
|
||||
|
||||
@Override
|
||||
public Image getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getClosedIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getLeafIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getOpenIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void deleteProject(ClosedProject cp) {
|
||||
cp.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||
@@ -251,37 +293,41 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
activeWorkspace.projectsOpenByName.remove(cp.name);
|
||||
activeWorkspace.projectsName.remove(cp.name);
|
||||
if (delete(new File(activeWorkspace.baseFolder, cp.name))) {
|
||||
Notification.addSuccess("Closed project "+cp.name+" successfully deleted.");
|
||||
Notification.addSuccess("Closed project " + cp.name
|
||||
+ " successfully deleted.");
|
||||
} else {
|
||||
Notification.addError("Error while deleting closed project "+cp.name+". Files may remain in the workspace.");
|
||||
Notification.addError("Error while deleting closed project "
|
||||
+ cp.name + ". Files may remain in the workspace.");
|
||||
}
|
||||
cp = null;
|
||||
saveActive();
|
||||
}
|
||||
|
||||
|
||||
public static void deleteProject(Project p) {
|
||||
p.childrenRemoved(new ArrayList<ProjectTreeNode>());
|
||||
activeWorkspace.projects.remove(p);
|
||||
activeWorkspace.projectsOpenByName.remove(p.name);
|
||||
activeWorkspace.projectsName.remove(p.name);
|
||||
if (delete(p.baseFolder)) {
|
||||
Notification.addSuccess("Project "+p.name+" successfully deleted.");
|
||||
Notification.addSuccess("Project " + p.name
|
||||
+ " successfully deleted.");
|
||||
} else {
|
||||
Notification.addError("Error while deleting project "+p.name+". Files may remain in the workspace.");
|
||||
Notification.addError("Error while deleting project " + p.name
|
||||
+ ". Files may remain in the workspace.");
|
||||
}
|
||||
p = null;
|
||||
saveActive();
|
||||
}
|
||||
|
||||
|
||||
private static boolean delete(File f) {
|
||||
boolean b = true;
|
||||
if (f.isDirectory()) {
|
||||
for (File c : f.listFiles())
|
||||
b &= delete(c);
|
||||
}
|
||||
return b&= f.delete();
|
||||
return b &= f.delete();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GameDataSet getDataSet() {
|
||||
return null;
|
||||
@@ -291,11 +337,10 @@ public class Workspace implements ProjectTreeNode, Serializable {
|
||||
public Type getDataType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return projects.isEmpty();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.gpl.rpg.atcontentstudio.model.gamedata;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.gpl.rpg.atcontentstudio.model.maps;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
@@ -6,10 +6,11 @@ import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
@@ -17,6 +18,7 @@ import org.json.simple.parser.ParseException;
|
||||
import com.gpl.rpg.atcontentstudio.Notification;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
|
||||
import com.gpl.rpg.atcontentstudio.model.SaveEvent;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.GameDataSet;
|
||||
@@ -43,15 +45,21 @@ public class WriterModeData extends GameDataElement {
|
||||
public WriterModeData(String id_prefix){
|
||||
this.id = id_prefix;
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public WriterModeData(WriterModeDataSet parent, @SuppressWarnings("rawtypes") Map jsonObj) {
|
||||
public WriterModeData(WriterModeDataSet parent, Map jsonObj) {
|
||||
this.parent = parent;
|
||||
this.jsonFile = parent.writerFile;
|
||||
this.parse(jsonObj);
|
||||
this.state = State.parsed;
|
||||
}
|
||||
|
||||
public WriterModeData(String id_prefix, Dialogue imported) {
|
||||
this.id = id_prefix;
|
||||
this.begin = new WriterDialogue(imported);
|
||||
this.state = State.linked;
|
||||
}
|
||||
|
||||
public int getNextIndex(String id_prefix) {
|
||||
Integer index = threadsNextIndex.get(id_prefix);
|
||||
if (index == null) index = 0;
|
||||
@@ -81,6 +89,30 @@ public class WriterModeData extends GameDataElement {
|
||||
|
||||
public WriterDialogue() {}
|
||||
|
||||
public WriterDialogue(Dialogue dialogue) {
|
||||
this.dialogue = dialogue;
|
||||
this.text = dialogue.message;
|
||||
this.id = this.dialogue_id = dialogue.id;
|
||||
Pattern p = Pattern.compile("(.*)([0-9]+)");
|
||||
Matcher m = p.matcher(dialogue.id);
|
||||
if (m.matches()) {
|
||||
this.id_prefix = m.group(1);
|
||||
this.index = Integer.parseInt(m.group(2));
|
||||
} else {
|
||||
this.id_prefix = this.id+"_";
|
||||
}
|
||||
nodesById.put(this.id, this);
|
||||
if (dialogue.replies != null) {
|
||||
for (Dialogue.Reply reply : dialogue.replies) {
|
||||
if (Dialogue.Reply.GO_NEXT_TEXT.equals(reply.text)) {
|
||||
replies.add(new EmptyReply(this, reply));
|
||||
} else {
|
||||
replies.add(new WriterReply(this, reply));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public WriterDialogue(String id_prefix) {
|
||||
text = "";
|
||||
this.id_prefix = id_prefix;
|
||||
@@ -89,7 +121,7 @@ public class WriterModeData extends GameDataElement {
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Dialogue "+id_prefix+index;
|
||||
return "Dialogue "+getID();
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
@@ -146,22 +178,50 @@ public class WriterModeData extends GameDataElement {
|
||||
public boolean isSpecial() {return false;}
|
||||
|
||||
|
||||
public Dialogue toDialogue(Map<WriterDialogue, Dialogue> visited) {
|
||||
public Dialogue toDialogue(Map<WriterDialogue, Dialogue> visited, List<Dialogue> created, List<Dialogue> modified) {
|
||||
if (visited.get(this) != null) return visited.get(this);
|
||||
//Creating a new Dialogue
|
||||
if (dialogue == null) {
|
||||
dialogue = new Dialogue();
|
||||
dialogue.id = getID();
|
||||
dialogue.state = GameDataElement.State.parsed;
|
||||
created.add(dialogue);
|
||||
} else {
|
||||
if (hasChanged()) dialogue.state = GameDataElement.State.modified;
|
||||
if (hasChanged()) {
|
||||
if (dialogue.writable) {
|
||||
//Modifying a created or altered Dialogue
|
||||
dialogue.state = GameDataElement.State.modified;
|
||||
modified.add(dialogue);
|
||||
} else {
|
||||
//Altering a game source Dialogue
|
||||
Dialogue clone = (Dialogue) dialogue.clone();
|
||||
if (this.replies != null) {
|
||||
for (WriterReply wReply : this.replies) {
|
||||
if (wReply.reply != null) {
|
||||
wReply.reply = clone.replies.get(dialogue.replies.indexOf(wReply.reply));
|
||||
}
|
||||
}
|
||||
}
|
||||
dialogue = clone;
|
||||
dialogue.state = GameDataElement.State.parsed;
|
||||
created.add(dialogue);
|
||||
}
|
||||
}
|
||||
}
|
||||
visited.put(this, dialogue);
|
||||
dialogue.message = this.text;
|
||||
if (this.replies != null && !this.replies.isEmpty()) {
|
||||
dialogue.replies = new ArrayList<Dialogue.Reply>();
|
||||
for (WriterReply wReply : this.replies) {
|
||||
dialogue.replies.add(wReply.toReply(visited));
|
||||
if (dialogue.replies == null) {
|
||||
dialogue.replies = new ArrayList<Dialogue.Reply>();
|
||||
} else {
|
||||
dialogue.replies.clear();
|
||||
}
|
||||
for (WriterReply wReply : this.replies) {
|
||||
//if (wReply.reply != null && dialogue.replies)
|
||||
dialogue.replies.add(wReply.toReply(visited, created, modified));
|
||||
}
|
||||
} else {
|
||||
dialogue.replies = null;
|
||||
}
|
||||
return dialogue;
|
||||
}
|
||||
@@ -194,19 +254,19 @@ public class WriterModeData extends GameDataElement {
|
||||
public SpecialDialogue duplicate() {return new SelectorDialogue();}
|
||||
}
|
||||
public class ShopDialogue extends SpecialDialogue {
|
||||
public static final String id = "S";
|
||||
public static final String id = Dialogue.Reply.SHOP_PHRASE_ID;
|
||||
public SpecialDialogue duplicate() {return new ShopDialogue();}
|
||||
}
|
||||
public class FightDialogue extends SpecialDialogue {
|
||||
public static final String id = "F";
|
||||
public static final String id = Dialogue.Reply.FIGHT_PHRASE_ID;
|
||||
public SpecialDialogue duplicate() {return new FightDialogue();}
|
||||
}
|
||||
public class EndDialogue extends SpecialDialogue {
|
||||
public static final String id = "X";
|
||||
public static final String id = Dialogue.Reply.EXIT_PHRASE_ID;
|
||||
public SpecialDialogue duplicate() {return new EndDialogue();}
|
||||
}
|
||||
public class RemoveNPCDialogue extends SpecialDialogue {
|
||||
public static final String id = "R";
|
||||
public static final String id = Dialogue.Reply.REMOVE_PHRASE_ID;
|
||||
public SpecialDialogue duplicate() {return new RemoveNPCDialogue();}
|
||||
}
|
||||
|
||||
@@ -224,6 +284,18 @@ public class WriterModeData extends GameDataElement {
|
||||
parent.replies.add(this);
|
||||
}
|
||||
|
||||
public WriterReply(WriterDialogue parent, Dialogue.Reply reply) {
|
||||
this.parent = parent;
|
||||
this.reply = reply;
|
||||
this.text = reply.text;
|
||||
this.next_dialogue_id = reply.next_phrase_id;
|
||||
if (nodesById.get(this.next_dialogue_id) != null) {
|
||||
this.next_dialogue = nodesById.get(this.next_dialogue_id);
|
||||
} else if (reply.next_phrase != null ){
|
||||
this.next_dialogue = new WriterDialogue(reply.next_phrase);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public WriterReply(WriterDialogue parent, Map json) {
|
||||
this.parent = parent;
|
||||
@@ -252,18 +324,18 @@ public class WriterModeData extends GameDataElement {
|
||||
|
||||
public boolean isSpecial() {return false;}
|
||||
|
||||
public Dialogue.Reply toReply(Map<WriterDialogue, Dialogue> visited) {
|
||||
public Dialogue.Reply toReply(Map<WriterDialogue, Dialogue> visited, List<Dialogue> created, List<Dialogue> modified) {
|
||||
if (reply == null) {
|
||||
reply = new Dialogue.Reply();
|
||||
}
|
||||
reply.text = this.text;
|
||||
if (this.next_dialogue != null) {
|
||||
this.next_dialogue.toDialogue(visited);
|
||||
this.next_dialogue.toDialogue(visited, created, modified);
|
||||
reply.next_phrase_id = this.next_dialogue.getID();
|
||||
} else if (this.next_dialogue_id != null) {
|
||||
reply.next_phrase_id = this.next_dialogue_id;
|
||||
} else {
|
||||
reply.next_phrase_id = "X";
|
||||
reply.next_phrase_id = Dialogue.Reply.EXIT_PHRASE_ID;
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
@@ -289,6 +361,10 @@ public class WriterModeData extends GameDataElement {
|
||||
|
||||
public boolean isSpecial() {return true;}
|
||||
|
||||
public SpecialReply(WriterDialogue parent, Dialogue.Reply reply) {
|
||||
super(parent, reply);
|
||||
}
|
||||
|
||||
public SpecialReply(WriterDialogue parent) {
|
||||
super(parent);
|
||||
}
|
||||
@@ -298,15 +374,20 @@ public class WriterModeData extends GameDataElement {
|
||||
}
|
||||
}
|
||||
public class EmptyReply extends SpecialReply {
|
||||
|
||||
public EmptyReply(WriterDialogue parent, Dialogue.Reply reply) {
|
||||
super(parent, reply);
|
||||
text = Dialogue.Reply.GO_NEXT_TEXT;
|
||||
}
|
||||
|
||||
public EmptyReply(WriterDialogue parent) {
|
||||
super(parent);
|
||||
text="N";
|
||||
text = Dialogue.Reply.GO_NEXT_TEXT;
|
||||
}
|
||||
|
||||
public EmptyReply(WriterDialogue parent, Map json) {
|
||||
super(parent, json);
|
||||
text="N";
|
||||
text = Dialogue.Reply.GO_NEXT_TEXT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,6 +552,35 @@ public class WriterModeData extends GameDataElement {
|
||||
reply.next_dialogue = nodesById.get(reply.next_dialogue_id);
|
||||
}
|
||||
}
|
||||
//TODO Seriously, this is failure-prone by design. Can't do much better though...
|
||||
List<Dialogue.Reply> linked = new ArrayList<Dialogue.Reply>(dialogue.dialogue.replies.size());
|
||||
if (dialogue.dialogue != null && dialogue.dialogue.replies != null) {
|
||||
//Try to hook to existing replies... not as easy when there's no ID.
|
||||
Dialogue.Reply best = null;
|
||||
int score, maxScore = 0;
|
||||
for (Dialogue.Reply dReply : dialogue.dialogue.replies) {
|
||||
//Never link twice to the same...
|
||||
if (linked.contains(dReply)) continue;
|
||||
score = 0;
|
||||
//Arbitrary values... hopefully this gives good results.
|
||||
//Same target gives good hope of preserving at least the structure.
|
||||
if (dReply.next_phrase_id != null && dReply.next_phrase_id.equals(reply.next_dialogue_id)) score +=50;
|
||||
//Same text is almost as good as an ID, but there may be duplicates due to requirements system...
|
||||
if (dReply.text != null && dReply.text.equals(reply.text)) score +=40;
|
||||
//Same slot in the list. That's not so bad if all else fails, and could help sort duplicates with same text.
|
||||
if (dialogue.dialogue.replies.indexOf(dReply) == dialogue.replies.indexOf(reply)) score +=20;
|
||||
//Both have null text. It's not much, but it's something....
|
||||
if (dReply.text == null && reply.text == null) score += 10;
|
||||
if (score > maxScore) {
|
||||
maxScore = score;
|
||||
best = dReply;
|
||||
}
|
||||
}
|
||||
if (maxScore > 0) {
|
||||
reply.reply = best;
|
||||
linked.add(best);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String rootId : rootsId) {
|
||||
@@ -504,10 +614,15 @@ public class WriterModeData extends GameDataElement {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection<Dialogue> toDialogue(){
|
||||
public List<Dialogue> toDialogue(){
|
||||
Map<WriterModeData.WriterDialogue, Dialogue> visited = new LinkedHashMap<WriterModeData.WriterDialogue, Dialogue>();
|
||||
begin.toDialogue(visited);
|
||||
return visited.values();
|
||||
List<Dialogue> created = new ArrayList<Dialogue>();
|
||||
List<Dialogue> modified = new ArrayList<Dialogue>();
|
||||
begin.toDialogue(visited, created, modified);
|
||||
for (Dialogue modifiedDialogue : modified) {
|
||||
modifiedDialogue.childrenChanged(new ArrayList<ProjectTreeNode>());
|
||||
}
|
||||
return created;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -81,6 +81,7 @@ public class AboutEditor extends Editor {
|
||||
|
||||
|
||||
public static final AboutEditor instance = new AboutEditor();
|
||||
@SuppressWarnings("resource")
|
||||
private AboutEditor() {
|
||||
this.name="About "+ATContentStudio.APP_NAME;
|
||||
this.icon = new ImageIcon(DefaultIcons.getMainIconIcon());
|
||||
|
||||
@@ -306,15 +306,18 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
return bbcb;
|
||||
}
|
||||
|
||||
public static JComboBox addEnumValueBox(JPanel pane, String label, @SuppressWarnings("rawtypes") Enum[] values, @SuppressWarnings("rawtypes") Enum initialValue, boolean writable) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static JComboBox addEnumValueBox(JPanel pane, String label, Enum[] values, Enum initialValue, boolean writable) {
|
||||
return addEnumValueBox(pane, label, values, initialValue, writable, new FieldUpdateListener() {@Override public void valueChanged(JComponent source, Object value) {}});
|
||||
}
|
||||
|
||||
public static JComboBox addEnumValueBox(JPanel pane, String label, @SuppressWarnings("rawtypes") Enum[] values, @SuppressWarnings("rawtypes") Enum initialValue, boolean writable, final FieldUpdateListener listener) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static JComboBox addEnumValueBox(JPanel pane, String label, Enum[] values, Enum initialValue, boolean writable, final FieldUpdateListener listener) {
|
||||
JPanel comboPane = new JPanel();
|
||||
comboPane.setLayout(new JideBoxLayout(comboPane, JideBoxLayout.LINE_AXIS, 6));
|
||||
JLabel comboLabel = new JLabel(label);
|
||||
comboPane.add(comboLabel, JideBoxLayout.FIX);
|
||||
@SuppressWarnings("unchecked")
|
||||
final JComboBox enumValuesCombo = new JComboBox(values);
|
||||
enumValuesCombo.setEnabled(writable);
|
||||
enumValuesCombo.setSelectedItem(initialValue);
|
||||
@@ -347,7 +350,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<NPC> comboModel = new GDEComboModel<NPC>(proj, npc){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public NPC getTypedElementAt(int index) {
|
||||
return project.getNPC(index);
|
||||
}
|
||||
@Override
|
||||
@@ -362,7 +365,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<ActorCondition> comboModel = new GDEComboModel<ActorCondition>(proj, acond){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public ActorCondition getTypedElementAt(int index) {
|
||||
return project.getActorCondition(index);
|
||||
}
|
||||
@Override
|
||||
@@ -377,7 +380,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<Item> comboModel = new GDEComboModel<Item>(proj, item){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public Item getTypedElementAt(int index) {
|
||||
return project.getItem(index);
|
||||
}
|
||||
@Override
|
||||
@@ -392,7 +395,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<ItemCategory> comboModel = new GDEComboModel<ItemCategory>(proj, ic){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public ItemCategory getTypedElementAt(int index) {
|
||||
return project.getItemCategory(index);
|
||||
}
|
||||
@Override
|
||||
@@ -407,7 +410,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<Quest> comboModel = new GDEComboModel<Quest>(proj, quest){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public Quest getTypedElementAt(int index) {
|
||||
return project.getQuest(index);
|
||||
}
|
||||
@Override
|
||||
@@ -422,7 +425,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<Droplist> comboModel = new GDEComboModel<Droplist>(proj, droplist){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public Droplist getTypedElementAt(int index) {
|
||||
return project.getDroplist(index);
|
||||
}
|
||||
@Override
|
||||
@@ -437,7 +440,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<Dialogue> comboModel = new GDEComboModel<Dialogue>(proj, dialogue){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public Dialogue getTypedElementAt(int index) {
|
||||
return project.getDialogue(index);
|
||||
}
|
||||
@Override
|
||||
@@ -452,7 +455,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
final GDEComboModel<TMXMap> comboModel = new GDEComboModel<TMXMap>(proj, map){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public TMXMap getTypedElementAt(int index) {
|
||||
return project.getMap(index);
|
||||
}
|
||||
@Override
|
||||
@@ -463,6 +466,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
return addGDEBox(pane, label, map, TMXMap.class, comboModel, writable, listener);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public MyComboBox addGDEBox(JPanel pane, String label, GameDataElement gde, final Class<? extends GameDataElement> dataClass, final GDEComboModel<? extends GameDataElement> comboModel, final boolean writable, final FieldUpdateListener listener) {
|
||||
JPanel gdePane = new JPanel();
|
||||
gdePane.setLayout(new JideBoxLayout(gdePane, JideBoxLayout.LINE_AXIS, 6));
|
||||
@@ -529,6 +533,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
return gdeBox;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public JList addBacklinksList(JPanel pane, GameDataElement gde) {
|
||||
final JList list = new JList(new GDEBacklinksListModel(gde));
|
||||
list.addMouseListener(new MouseAdapter() {
|
||||
@@ -561,7 +566,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static abstract class GDEComboModel<E extends GameDataElement> extends AbstractListModel implements ComboBoxModel {
|
||||
public static abstract class GDEComboModel<E extends GameDataElement> extends AbstractListModel<E> implements ComboBoxModel<E> {
|
||||
|
||||
private static final long serialVersionUID = -5854574666510314715L;
|
||||
|
||||
@@ -577,14 +582,14 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
public abstract int getSize();
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public E getElementAt(int index) {
|
||||
if (index == 0) {
|
||||
return null;
|
||||
}
|
||||
return getTypedElementAt(index - 1);
|
||||
}
|
||||
|
||||
public abstract Object getTypedElementAt(int index);
|
||||
public abstract E getTypedElementAt(int index);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
@@ -620,6 +625,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
this.writable = writable;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
@@ -642,7 +648,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
|
||||
}
|
||||
|
||||
public static class GDEBacklinksListModel implements ListModel {
|
||||
public static class GDEBacklinksListModel implements ListModel<GameDataElement> {
|
||||
|
||||
GameDataElement source;
|
||||
|
||||
@@ -667,7 +673,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public GameDataElement getElementAt(int index) {
|
||||
for (GameDataElement gde : source.getBacklinks()) {
|
||||
if (index == 0) return gde;
|
||||
index --;
|
||||
@@ -694,6 +700,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public class MyComboBox extends JComboBox implements ProjectElementListener {
|
||||
|
||||
private static final long serialVersionUID = -4184228604170642567L;
|
||||
@@ -706,13 +713,11 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
|
||||
Editor.this.addElementListener(dataType, this);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void elementAdded(GameDataElement added, int index) {
|
||||
((GDEComboModel)getModel()).itemAdded(added, index);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void elementRemoved(GameDataElement removed, int index) {
|
||||
((GDEComboModel)getModel()).itemRemoved(removed, index);
|
||||
|
||||
@@ -59,6 +59,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
|
||||
private JSONElement creation = null;
|
||||
final JLabel message;
|
||||
@SuppressWarnings("rawtypes")
|
||||
final JComboBox dataTypeCombo;
|
||||
final JTextField idField;
|
||||
final JTextField nameField;
|
||||
@@ -85,6 +86,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
dataTypeCombo.setEnabled(false);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public JSONCreationWizard(final Project proj) {
|
||||
super(ATContentStudio.frame);
|
||||
this.proj = proj;
|
||||
@@ -501,6 +503,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class DataTypeComboModel implements ComboBoxModel {
|
||||
|
||||
DataType selected = DataType.none;
|
||||
@@ -542,7 +545,7 @@ public class JSONCreationWizard extends JDialog {
|
||||
private static final long serialVersionUID = 5621373849299980998L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
((JLabel)c).setText(JSONCreationWizard.dataTypeDesc((DataType) value));
|
||||
|
||||
@@ -75,6 +75,7 @@ public class JSONImportWizard extends JDialog {
|
||||
|
||||
JPanel pane;
|
||||
JLabel message;
|
||||
@SuppressWarnings("rawtypes")
|
||||
JComboBox dataTypeCombo;
|
||||
JRadioButton importFromFile;
|
||||
JRadioButton importPasted;
|
||||
@@ -83,11 +84,13 @@ public class JSONImportWizard extends JDialog {
|
||||
JButton browse;
|
||||
RSyntaxTextArea jsonPasteArea;
|
||||
JScrollPane scroller;
|
||||
@SuppressWarnings("rawtypes")
|
||||
JList createdPreview;
|
||||
JPanel buttonPane;
|
||||
JButton ok, cancel;
|
||||
ActionListener okListener, cancelListener;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public JSONImportWizard(Project proj) {
|
||||
|
||||
super(ATContentStudio.frame);
|
||||
@@ -390,6 +393,7 @@ public class JSONImportWizard extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void showImportPreviewScreen(final List<JSONElement> created) {
|
||||
pane.removeAll();
|
||||
message.setText("The following data has been found. Click \"Ok\" to confirm.");
|
||||
@@ -429,6 +433,7 @@ public class JSONImportWizard extends JDialog {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void showErrorScreen(List<String> errors) {
|
||||
pane.removeAll();
|
||||
message.setText("Failed to import. The following error(s) have been encountered:");
|
||||
@@ -461,6 +466,7 @@ public class JSONImportWizard extends JDialog {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void showWarningScreen(List<String> warnings, final List<JSONElement> created) {
|
||||
pane.removeAll();
|
||||
message.setText("The following warnings(s) were raised while importing:");
|
||||
@@ -508,7 +514,7 @@ public class JSONImportWizard extends JDialog {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value == null) {
|
||||
label.setText("none");
|
||||
@@ -552,7 +558,7 @@ public class JSONImportWizard extends JDialog {
|
||||
public static class ErrorRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = -4265342800284721660L;
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
((JLabel)c).setIcon(NotificationsPane.icons.get(Notification.Type.ERROR));
|
||||
@@ -565,7 +571,7 @@ public class JSONImportWizard extends JDialog {
|
||||
public static class WarningRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = -3836045237946111606L;
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
((JLabel)c).setIcon(NotificationsPane.icons.get(Notification.Type.WARN));
|
||||
@@ -574,6 +580,7 @@ public class JSONImportWizard extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class GDEListModel implements ListModel {
|
||||
|
||||
List<? extends Object> source;
|
||||
@@ -617,6 +624,7 @@ public class JSONImportWizard extends JDialog {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static class DataTypeComboModel implements ComboBoxModel {
|
||||
|
||||
DataType selected = DataType.none;
|
||||
@@ -658,7 +666,7 @@ public class JSONImportWizard extends JDialog {
|
||||
private static final long serialVersionUID = 5621373849299980998L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
((JLabel)c).setText(dataTypeDesc((DataType) value));
|
||||
|
||||
@@ -4,8 +4,8 @@ import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.gpl.rpg.atcontentstudio.Notification;
|
||||
import com.gpl.rpg.atcontentstudio.NotificationListener;
|
||||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class NotificationsPane extends JList {
|
||||
|
||||
private static final long serialVersionUID = -1100364214372392608L;
|
||||
@@ -47,6 +48,7 @@ public class NotificationsPane extends JList {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public NotificationsPane() {
|
||||
super();
|
||||
MyListModel model = new MyListModel();
|
||||
|
||||
@@ -245,6 +245,10 @@ public class ProjectsTree extends JPanel {
|
||||
addNextSeparator = true;
|
||||
popupMenu.add(new JMenuItem(actions.testCommitWriter));
|
||||
}
|
||||
if (actions.createWriter.isEnabled()) {
|
||||
addNextSeparator = true;
|
||||
popupMenu.add(new JMenuItem(actions.createWriter));
|
||||
}
|
||||
if (addNextSeparator) {
|
||||
popupMenu.add(new JSeparator());
|
||||
addNextSeparator = false;
|
||||
|
||||
@@ -5,9 +5,9 @@ import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -35,11 +35,15 @@ public class SaveItemsWizard extends JDialog {
|
||||
|
||||
List<SaveEvent> events;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
JList movedToCreated;
|
||||
@SuppressWarnings("rawtypes")
|
||||
JList movedToAltered;
|
||||
@SuppressWarnings("rawtypes")
|
||||
JList willBeSaved;
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public SaveItemsWizard(List<SaveEvent> events, GameDataElement originalRequester) {
|
||||
super(ATContentStudio.frame);
|
||||
this.events = events;
|
||||
@@ -170,7 +174,6 @@ public class SaveItemsWizard extends JDialog {
|
||||
buttonPane.add(okButton, JideBoxLayout.FIX);
|
||||
pane.add(buttonPane, JideBoxLayout.FIX);
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
||||
@@ -251,7 +254,7 @@ public class SaveItemsWizard extends JDialog {
|
||||
private static final long serialVersionUID = 5764079243906396333L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = (JLabel) c;
|
||||
|
||||
@@ -53,6 +53,7 @@ public class StudioFrame extends JFrame {
|
||||
final JSplitPane topDown = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
||||
final JSplitPane leftRight = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
JList notifs = new NotificationsPane();
|
||||
projectTree = new ProjectsTree();
|
||||
editors = new EditorsArea();
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -343,12 +342,25 @@ public class WorkspaceActions {
|
||||
WriterModeData wData = (WriterModeData)selectedNode;
|
||||
Collection<Dialogue> exported = wData.toDialogue();
|
||||
selectedNode.getProject().createElements(new ArrayList<JSONElement>(exported));
|
||||
wData.begin.dialogue.save();
|
||||
wData.save();
|
||||
};
|
||||
public void selectionChanged(ProjectTreeNode selectedNode, TreePath[] selectedPaths) {
|
||||
setEnabled(selectedNode != null && selectedNode instanceof WriterModeData);
|
||||
}
|
||||
};
|
||||
|
||||
public ATCSAction createWriter = new ATCSAction("Generate dialogue sketch", "Generates a dialogue sketch from this dialogue and its tree.") {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (selectedNode == null || selectedNode.getProject() == null || !(selectedNode instanceof Dialogue)) return;
|
||||
new WriterSketchCreationWizard(selectedNode.getProject(), (Dialogue)selectedNode).setVisible(true);
|
||||
|
||||
};
|
||||
public void selectionChanged(ProjectTreeNode selectedNode, TreePath[] selectedPaths) {
|
||||
setEnabled(selectedNode != null && selectedNode instanceof Dialogue);
|
||||
}
|
||||
};
|
||||
|
||||
List<ATCSAction> actions = new ArrayList<WorkspaceActions.ATCSAction>();
|
||||
|
||||
public WorkspaceActions() {
|
||||
@@ -368,6 +380,7 @@ public class WorkspaceActions {
|
||||
actions.add(exitATCS);
|
||||
actions.add(testWriter);
|
||||
actions.add(testCommitWriter);
|
||||
actions.add(createWriter);
|
||||
selectionChanged(null, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WorkspaceSelector extends JFrame {
|
||||
final List<String> wsPaths = new ArrayList<String>();
|
||||
|
||||
//Active widgets declaration
|
||||
final JComboBox combo = new JComboBox();
|
||||
final JComboBox<String> combo = new JComboBox<String>();
|
||||
final JButton browse = new JButton("Browse...");
|
||||
final JButton cancel = new JButton("Cancel");
|
||||
final JButton ok = new JButton("Ok");
|
||||
|
||||
@@ -17,11 +17,14 @@ import javax.swing.event.DocumentListener;
|
||||
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||
import com.gpl.rpg.atcontentstudio.model.GameDataElement.State;
|
||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
|
||||
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
|
||||
import com.jidesoft.swing.JideBoxLayout;
|
||||
|
||||
public class WriterSketchCreationWizard extends JDialog {
|
||||
|
||||
private static final long serialVersionUID = 175788847797352548L;
|
||||
|
||||
private WriterModeData creation = null;
|
||||
final JLabel message;
|
||||
final JTextField idField;
|
||||
@@ -29,6 +32,10 @@ public class WriterSketchCreationWizard extends JDialog {
|
||||
final Project proj;
|
||||
|
||||
public WriterSketchCreationWizard(Project proj) {
|
||||
this(proj, null);
|
||||
}
|
||||
|
||||
public WriterSketchCreationWizard(Project proj, final Dialogue dialogue) {
|
||||
super(ATContentStudio.frame);
|
||||
this.proj = proj;
|
||||
|
||||
@@ -62,10 +69,14 @@ public class WriterSketchCreationWizard extends JDialog {
|
||||
ok.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
creation = new WriterModeData(idField.getText());
|
||||
WriterSketchCreationWizard.this.setVisible(false);
|
||||
WriterSketchCreationWizard.this.dispose();
|
||||
creation.state = State.created;
|
||||
if (dialogue == null) {
|
||||
creation = new WriterModeData(idField.getText());
|
||||
creation.state = State.created;
|
||||
} else {
|
||||
creation = new WriterModeData(idField.getText(), dialogue);
|
||||
}
|
||||
WriterSketchCreationWizard.this.proj.createWriterSketch(creation);
|
||||
// notifyCreated();
|
||||
ATContentStudio.frame.selectInTree(creation);
|
||||
|
||||
@@ -30,6 +30,7 @@ public class ActorConditionEditor extends JSONElementEditor {
|
||||
private JButton acIcon;
|
||||
private JTextField idField;
|
||||
private JTextField nameField;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox categoryBox;
|
||||
private IntegerBasedCheckBox positiveBox;
|
||||
private IntegerBasedCheckBox stackingBox;
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
@@ -85,7 +84,9 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private MyComboBox switchToNpcBox;
|
||||
|
||||
private RewardsListModel rewardsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList rewardsList;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox rewardTypeCombo;
|
||||
private JPanel rewardsParamsPane;
|
||||
private MyComboBox rewardMap;
|
||||
@@ -94,15 +95,19 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private JSpinner rewardValue;
|
||||
|
||||
private RepliesListModel repliesListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList repliesList;
|
||||
private JPanel repliesParamsPane;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox replyTypeCombo;
|
||||
private MyComboBox replyNextPhrase;
|
||||
private String replyTextCache = null;
|
||||
private JTextField replyText;
|
||||
|
||||
private ReplyRequirementsListModel requirementsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList requirementsList;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox requirementTypeCombo;
|
||||
private JPanel requirementParamsPane;
|
||||
private MyComboBox requirementObj;
|
||||
@@ -149,6 +154,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
return pane;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void insertFormViewDataField(final JPanel pane) {
|
||||
|
||||
final Dialogue dialogue = (Dialogue) target;
|
||||
@@ -414,6 +420,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void updateRepliesEditorPane(final JPanel pane, final Dialogue.Reply reply, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
if (replyNextPhrase != null) {
|
||||
@@ -680,7 +687,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public static class RewardsListModel implements ListModel {
|
||||
public static class RewardsListModel implements ListModel<Dialogue.Reward> {
|
||||
|
||||
Dialogue source;
|
||||
|
||||
@@ -695,7 +702,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Dialogue.Reward getElementAt(int index) {
|
||||
if (source.rewards == null) return null;
|
||||
return source.rewards.get(index);
|
||||
}
|
||||
@@ -746,7 +753,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
@@ -819,7 +826,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
|
||||
public static class RepliesListModel implements ListModel {
|
||||
public static class RepliesListModel implements ListModel<Dialogue.Reply> {
|
||||
|
||||
Dialogue source;
|
||||
|
||||
@@ -835,7 +842,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Dialogue.Reply getElementAt(int index) {
|
||||
if (source.replies == null) return null;
|
||||
return source.replies.get(index);
|
||||
}
|
||||
@@ -907,7 +914,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
@@ -953,7 +960,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ReplyRequirementsListModel implements ListModel {
|
||||
public static class ReplyRequirementsListModel implements ListModel<Requirement> {
|
||||
|
||||
Dialogue.Reply reply;
|
||||
|
||||
@@ -968,7 +975,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Requirement getElementAt(int index) {
|
||||
if (reply.requirements == null) return null;
|
||||
return reply.requirements.get(index);
|
||||
}
|
||||
@@ -1022,7 +1029,7 @@ public class DialogueEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
decorateRequirementJLabel((JLabel)c, (Requirement)value);
|
||||
|
||||
@@ -57,6 +57,7 @@ public class DroplistEditor extends JSONElementEditor {
|
||||
addEditorTab(json_view_id, getJSONView());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void insertFormViewDataField(JPanel pane) {
|
||||
|
||||
@@ -146,7 +147,7 @@ public class DroplistEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public class DroppedItemsListModel implements ListModel {
|
||||
public class DroppedItemsListModel implements ListModel<Droplist.DroppedItem> {
|
||||
|
||||
Droplist source;
|
||||
|
||||
@@ -161,7 +162,7 @@ public class DroplistEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Droplist.DroppedItem getElementAt(int index) {
|
||||
if (source.dropped_items == null) return null;
|
||||
return source.dropped_items.get(index);
|
||||
}
|
||||
@@ -212,7 +213,7 @@ public class DroplistEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
|
||||
@@ -35,10 +35,14 @@ public class ItemCategoryEditor extends JSONElementEditor {
|
||||
private JButton icIcon;
|
||||
private JTextField idField;
|
||||
private JTextField nameField;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox slotBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox typeBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox sizeBox;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void insertFormViewDataField(JPanel pane) {
|
||||
final ItemCategory ic = ((ItemCategory)target);
|
||||
@@ -62,7 +66,7 @@ public class ItemCategoryEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = -8359181274986492979L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
((JLabel)c).setIcon(new ImageIcon(ItemCategory.getIcon((ItemCategory.InventorySlot) value)));
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
@@ -60,6 +59,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JTextField idField;
|
||||
private JTextField nameField;
|
||||
private JTextField descriptionField;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox typeBox;
|
||||
private IntegerBasedCheckBox manualPriceBox;
|
||||
private JSpinner baseCostField;
|
||||
@@ -82,6 +82,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner equipIncReequipCost;
|
||||
private JSpinner equipIncAttackCost;
|
||||
private ConditionsListModel equipConditionsModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList equipConditionsList;
|
||||
private MyComboBox equipConditionBox;
|
||||
private JSpinner equipConditionMagnitude;
|
||||
@@ -93,12 +94,14 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner hitAPMin;
|
||||
private JSpinner hitAPMax;
|
||||
private SourceTimedConditionsListModel hitSourceConditionsModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitSourceConditionsList;
|
||||
private MyComboBox hitSourceConditionBox;
|
||||
private JSpinner hitSourceConditionMagnitude;
|
||||
private JSpinner hitSourceConditionDuration;
|
||||
private JSpinner hitSourceConditionChance;
|
||||
private TargetTimedConditionsListModel hitTargetConditionsModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitTargetConditionsList;
|
||||
private MyComboBox hitTargetConditionBox;
|
||||
private JSpinner hitTargetConditionMagnitude;
|
||||
@@ -112,6 +115,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private JSpinner killAPMin;
|
||||
private JSpinner killAPMax;
|
||||
private SourceTimedConditionsListModel killSourceConditionsModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList killSourceConditionsList;
|
||||
private MyComboBox killSourceConditionBox;
|
||||
private JSpinner killSourceConditionMagnitude;
|
||||
@@ -125,6 +129,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
addEditorTab(json_view_id, getJSONView());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void insertFormViewDataField(JPanel pane) {
|
||||
|
||||
@@ -524,7 +529,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public static class SourceTimedConditionsListModel implements ListModel {
|
||||
public static class SourceTimedConditionsListModel implements ListModel<Item.TimedConditionEffect> {
|
||||
|
||||
Item.KillEffect source;
|
||||
|
||||
@@ -539,7 +544,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Item.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_source == null) return null;
|
||||
return source.conditions_source.get(index);
|
||||
}
|
||||
@@ -586,7 +591,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class TargetTimedConditionsListModel implements ListModel {
|
||||
public static class TargetTimedConditionsListModel implements ListModel<Item.TimedConditionEffect> {
|
||||
|
||||
Item.HitEffect source;
|
||||
|
||||
@@ -601,7 +606,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Item.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_target == null) return null;
|
||||
return source.conditions_target.get(index);
|
||||
}
|
||||
@@ -652,7 +657,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
@@ -669,7 +674,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class ConditionsListModel implements ListModel {
|
||||
public static class ConditionsListModel implements ListModel<Item.ConditionEffect> {
|
||||
|
||||
Item.EquipEffect source;
|
||||
|
||||
@@ -684,7 +689,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Item.ConditionEffect getElementAt(int index) {
|
||||
if (source.conditions == null) return null;
|
||||
return source.conditions.get(index);
|
||||
}
|
||||
@@ -735,7 +740,7 @@ public class ItemEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
@@ -60,8 +59,10 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JSpinner experienceField;
|
||||
private MyComboBox dialogueBox;
|
||||
private MyComboBox droplistBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox monsterClassBox;
|
||||
private IntegerBasedCheckBox uniqueBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox moveTypeBox;
|
||||
|
||||
private CollapsiblePanel combatTraitPane;
|
||||
@@ -85,6 +86,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JSpinner hitEffectAPMax;
|
||||
|
||||
private SourceTimedConditionsListModel hitSourceConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitSourceConditionsList;
|
||||
private MyComboBox sourceConditionBox;
|
||||
private JSpinner sourceConditionMagnitude;
|
||||
@@ -92,6 +94,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private JSpinner sourceConditionChance;
|
||||
|
||||
private TargetTimedConditionsListModel hitTargetConditionsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList hitTargetConditionsList;
|
||||
private MyComboBox targetConditionBox;
|
||||
private JSpinner targetConditionMagnitude;
|
||||
@@ -157,6 +160,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void insertFormViewDataField(JPanel pane) {
|
||||
final NPC npc = (NPC) target;
|
||||
@@ -344,7 +348,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
public static class TargetTimedConditionsListModel implements ListModel {
|
||||
public static class TargetTimedConditionsListModel implements ListModel<NPC.TimedConditionEffect> {
|
||||
|
||||
NPC.HitEffect source;
|
||||
|
||||
@@ -359,7 +363,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public NPC.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_target == null) return null;
|
||||
return source.conditions_target.get(index);
|
||||
}
|
||||
@@ -406,7 +410,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
}
|
||||
|
||||
public static class SourceTimedConditionsListModel implements ListModel {
|
||||
public static class SourceTimedConditionsListModel implements ListModel<NPC.TimedConditionEffect> {
|
||||
|
||||
NPC.HitEffect source;
|
||||
|
||||
@@ -421,7 +425,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public NPC.TimedConditionEffect getElementAt(int index) {
|
||||
if (source.conditions_source == null) return null;
|
||||
return source.conditions_source.get(index);
|
||||
}
|
||||
@@ -472,7 +476,7 @@ public class NPCEditor extends JSONElementEditor {
|
||||
private static final long serialVersionUID = 7987880146189575234L;
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = ((JLabel)c);
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
|
||||
@@ -18,10 +18,8 @@ import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionAdapter;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.image.BufferedImageOp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -114,8 +112,10 @@ public class TMXMapEditor extends Editor {
|
||||
private RSyntaxTextArea editorPane;
|
||||
|
||||
private IntegerBasedCheckBox outsideBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox colorFilterBox;
|
||||
private LayerListModel layerListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList layerList;
|
||||
private tiled.core.MapLayer selectedLayer;
|
||||
private JButton addTileLayer;
|
||||
@@ -124,9 +124,10 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
private JPanel layerDetailsPane;
|
||||
private BooleanBasedCheckBox layerVisibleBox;
|
||||
private BooleanBasedCheckBox activeLayerBox;
|
||||
//private BooleanBasedCheckBox activeLayerBox;
|
||||
private JTextField layerNameField;
|
||||
private MapObjectsListModel groupObjectsListModel;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList groupObjectsList;
|
||||
private MapObject selectedMapObject;
|
||||
private JButton addMapchange;
|
||||
@@ -140,32 +141,43 @@ public class TMXMapEditor extends Editor {
|
||||
private JButton deleteObject;
|
||||
|
||||
private JPanel mapObjectSettingsPane;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox droplistBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox dialogueBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox mapBox;
|
||||
private JTextField areaField;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox targetAreaCombo;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox evaluateTriggerBox;
|
||||
private JSpinner quantityField;
|
||||
private JCheckBox activeForNewGame;
|
||||
private JTextField spawngroupField;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList npcList;
|
||||
private SpawnGroupNpcListModel npcListModel;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox requirementTypeCombo;
|
||||
private JPanel requirementParamsPane;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox requirementObj;
|
||||
private JTextField requirementObjId;
|
||||
private JSpinner requirementValue;
|
||||
private BooleanBasedCheckBox requirementNegated;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JList replacementsList;
|
||||
private ReplacementsListModel replacementsListModel;
|
||||
private ReplaceArea.Replacement selectedReplacement;
|
||||
private JButton addReplacement;
|
||||
private JButton deleteReplacement;
|
||||
private JPanel replacementEditPane;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox sourceLayer;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox targetLayer;
|
||||
|
||||
private TMXViewer tmxViewer;
|
||||
@@ -195,6 +207,7 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public JPanel getTmxEditorPane() {
|
||||
final TMXMap map = (TMXMap) target;
|
||||
final FieldUpdateListener listener = new MapFieldUpdater();
|
||||
@@ -287,6 +300,7 @@ public class TMXMapEditor extends Editor {
|
||||
return pane;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void updateLayerDetailsPane(JPanel pane, tiled.core.MapLayer selected, final FieldUpdateListener listener) {
|
||||
final TMXMap map = (TMXMap)target;
|
||||
pane.removeAll();
|
||||
@@ -444,6 +458,7 @@ public class TMXMapEditor extends Editor {
|
||||
pane.repaint();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void updateMapObjectSettingsPane(JPanel pane, final MapObject selected, final FieldUpdateListener listener) {
|
||||
pane.removeAll();
|
||||
boolean needVary = true;
|
||||
@@ -908,6 +923,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static JList addTMXMapSpritesheetsList(JPanel pane, TMXMap tmxMap) {
|
||||
final JList list = new JList(new TMXMapSpritesheetsListModel(tmxMap));
|
||||
list.addMouseListener(new MouseAdapter() {
|
||||
@@ -935,6 +951,7 @@ public class TMXMapEditor extends Editor {
|
||||
return list;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class LayerListModel implements ListModel {
|
||||
|
||||
public TMXMap map;
|
||||
@@ -995,7 +1012,7 @@ public class TMXMapEditor extends Editor {
|
||||
public class LayerListRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = -6182599528961565957L;
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = (JLabel)c;
|
||||
@@ -1011,7 +1028,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
}
|
||||
|
||||
public class ReplacementsListModel implements ListModel {
|
||||
public class ReplacementsListModel implements ListModel<ReplaceArea.Replacement> {
|
||||
|
||||
public ReplaceArea area;
|
||||
|
||||
@@ -1026,7 +1043,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public ReplaceArea.Replacement getElementAt(int index) {
|
||||
if (index < 0 || index > getSize()) return null;
|
||||
if (area.replacements == null) return null;
|
||||
return area.replacements.get(index);
|
||||
@@ -1077,7 +1094,7 @@ public class TMXMapEditor extends Editor {
|
||||
this.area = area;
|
||||
}
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
JLabel label = (JLabel)c;
|
||||
@@ -1144,7 +1161,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
}
|
||||
|
||||
public class MapObjectsListModel implements ListModel {
|
||||
public class MapObjectsListModel implements ListModel<MapObject> {
|
||||
|
||||
public MapObjectGroup group;
|
||||
|
||||
@@ -1158,7 +1175,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public MapObject getElementAt(int index) {
|
||||
return group.mapObjects.get(index);
|
||||
}
|
||||
|
||||
@@ -1201,7 +1218,7 @@ public class TMXMapEditor extends Editor {
|
||||
public class GroupObjectsRenderer extends DefaultListCellRenderer {
|
||||
private static final long serialVersionUID = -6182599528961565957L;
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (c instanceof JLabel) {
|
||||
((JLabel)c).setText(((MapObject)value).name);
|
||||
@@ -1211,7 +1228,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
}
|
||||
|
||||
public class SpawnGroupNpcListModel implements ListModel {
|
||||
public class SpawnGroupNpcListModel implements ListModel<NPC> {
|
||||
|
||||
public SpawnArea area;
|
||||
|
||||
@@ -1225,7 +1242,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public NPC getElementAt(int index) {
|
||||
return area.spawnGroup.get(index);
|
||||
}
|
||||
|
||||
@@ -1243,42 +1260,6 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
}
|
||||
|
||||
private static final BufferedImageOp colorFilterBlack20 = null;
|
||||
private static final BufferedImageOp colorFilterBlack40 = null;
|
||||
private static final BufferedImageOp colorFilterBlack60 = null;
|
||||
private static final BufferedImageOp colorFilterBlack80 = null;
|
||||
private static final BufferedImageOp colorFilterInvert = null;
|
||||
private static final BufferedImageOp colorFilterBW = null;
|
||||
|
||||
|
||||
// private static final BufferedImageOp colorFilterBlack20 = createGrayScaleColorFilter(0.8f);
|
||||
// private static final BufferedImageOp colorFilterBlack40 = createGrayScaleColorFilter(0.6f);
|
||||
// private static final BufferedImageOp colorFilterBlack60 = createGrayScaleColorFilter(0.4f);
|
||||
// private static final BufferedImageOp colorFilterBlack80 = createGrayScaleColorFilter(0.2f);
|
||||
// private static final BufferedImageOp colorFilterInvert = createInvertColorFilter();
|
||||
// private static final BufferedImageOp colorFilterBW = createBWColorFilter();
|
||||
//
|
||||
// private static BufferedImageOp createGrayScaleColorFilter(float f) {
|
||||
// byte[] gs = new byte[256];
|
||||
// for (int i=0; i < 256; i++) {
|
||||
// gs[i] = (byte)( i * f);
|
||||
// }
|
||||
// return new LookupOp(new ByteLookupTable(0, gs), null);
|
||||
// }
|
||||
//
|
||||
// private static BufferedImageOp createInvertColorFilter() {
|
||||
// byte[] invert = new byte[256];
|
||||
// for (int i=0; i < 256; i++) {
|
||||
// invert[i] = (byte) (255 - i);
|
||||
// }
|
||||
// return new LookupOp(new ByteLookupTable(0, invert), null);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private static BufferedImageOp createBWColorFilter() {
|
||||
// return new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
|
||||
// }
|
||||
|
||||
|
||||
public class TMXViewer extends JPanel implements Scrollable {
|
||||
|
||||
@@ -1525,7 +1506,7 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
}
|
||||
|
||||
public static class TMXMapSpritesheetsListModel implements ListModel {
|
||||
public static class TMXMapSpritesheetsListModel implements ListModel<Spritesheet> {
|
||||
|
||||
TMXMap map;
|
||||
|
||||
@@ -1539,7 +1520,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public Spritesheet getElementAt(int index) {
|
||||
for (Spritesheet sheet : map.usedSpritesheets) {
|
||||
if (index == 0) return sheet;
|
||||
index --;
|
||||
@@ -1579,7 +1560,7 @@ public class TMXMapEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value == null) {
|
||||
label.setText("none");
|
||||
@@ -1724,6 +1705,7 @@ public class TMXMapEditor extends Editor {
|
||||
|
||||
|
||||
public class MapFieldUpdater implements FieldUpdateListener {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public void valueChanged(JComponent source, Object value) {
|
||||
TMXMap map = (TMXMap) target;
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.awt.event.ItemListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.ButtonGroup;
|
||||
@@ -107,6 +106,7 @@ public class WorldMapEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private JPanel buildSegmentTab(final WorldmapSegment worldmap) {
|
||||
JPanel pane = new JPanel();
|
||||
pane.setLayout(new JideBoxLayout(pane, JideBoxLayout.PAGE_AXIS));
|
||||
@@ -151,7 +151,7 @@ public class WorldMapEditor extends Editor {
|
||||
final GDEComboModel<TMXMap> mapComboModel = new GDEComboModel<TMXMap>(worldmap.getProject(), null){
|
||||
private static final long serialVersionUID = 2638082961277241764L;
|
||||
@Override
|
||||
public Object getTypedElementAt(int index) {
|
||||
public TMXMap getTypedElementAt(int index) {
|
||||
return project.getMap(index);
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -14,9 +14,9 @@ import java.awt.Shape;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -7,8 +7,8 @@ import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -56,6 +56,7 @@ public class SpritesheetEditor extends Editor {
|
||||
private JSpinner widthField;
|
||||
private JSpinner heightField;
|
||||
private JCheckBox animatedBox;
|
||||
@SuppressWarnings("rawtypes")
|
||||
private JComboBox categoryBox;
|
||||
private JPanel spriteViewPane;
|
||||
|
||||
@@ -160,6 +161,7 @@ public class SpritesheetEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static JList addBacklinksList(JPanel pane, Spritesheet sheet) {
|
||||
final JList list = new JList(new SpritesheetsBacklinksListModel(sheet));
|
||||
list.addMouseListener(new MouseAdapter() {
|
||||
@@ -317,7 +319,7 @@ public class SpritesheetEditor extends Editor {
|
||||
}
|
||||
|
||||
|
||||
public static class SpritesheetsBacklinksListModel implements ListModel {
|
||||
public static class SpritesheetsBacklinksListModel implements ListModel<ProjectTreeNode> {
|
||||
|
||||
Spritesheet sheet;
|
||||
|
||||
@@ -331,7 +333,7 @@ public class SpritesheetEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int index) {
|
||||
public ProjectTreeNode getElementAt(int index) {
|
||||
for (ProjectTreeNode node : sheet.getBacklinks()) {
|
||||
if (index == 0) return node;
|
||||
index --;
|
||||
@@ -371,7 +373,7 @@ public class SpritesheetEditor extends Editor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
public Component getListCellRendererComponent(@SuppressWarnings("rawtypes") JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
|
||||
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
if (value == null) {
|
||||
label.setText("none");
|
||||
|
||||
@@ -10,9 +10,8 @@ import java.awt.event.FocusListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
@@ -58,7 +57,6 @@ import prefuse.visual.VisualItem;
|
||||
import prefuse.visual.expression.InGroupPredicate;
|
||||
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
|
||||
import com.gpl.rpg.atcontentstudio.model.gamedata.JSONElement;
|
||||
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData;
|
||||
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.EmptyReply;
|
||||
import com.gpl.rpg.atcontentstudio.model.tools.writermode.WriterModeData.SpecialDialogue;
|
||||
@@ -105,8 +103,10 @@ public class WriterModeEditor extends Editor {
|
||||
export.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Collection<Dialogue> exported = data.toDialogue();
|
||||
data.getProject().createElements(new ArrayList<JSONElement>(exported));
|
||||
List<Dialogue> created = data.toDialogue();
|
||||
data.getProject().createElements(created);
|
||||
//data.begin.dialogue.save();
|
||||
data.save();
|
||||
}
|
||||
});
|
||||
pane.add(save, JideBoxLayout.FIX);
|
||||
@@ -371,6 +371,7 @@ public class WriterModeEditor extends Editor {
|
||||
}
|
||||
|
||||
public String wordWrap(String in, int length) {
|
||||
if (in == null) return null;
|
||||
final String newline = "\n";
|
||||
//:: Trim
|
||||
while(in.length() > 0 && (in.charAt(0) == '\t' || in.charAt(0) == ' ')) in = in.substring(1);
|
||||
|
||||
@@ -55,7 +55,8 @@ public class FilteredSpanningTree extends Tree {
|
||||
* unweighted breadth first traversal to build the spanning tree.
|
||||
* @param root the root node of the spanning tree
|
||||
*/
|
||||
public void buildSpanningTree(Node root) {
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void buildSpanningTree(Node root) {
|
||||
// re-use a previously allocated tree if possible
|
||||
super.clearEdges();
|
||||
super.setRoot(root);
|
||||
|
||||
Reference in New Issue
Block a user