Old changes never committed yet

This commit is contained in:
Waverunner
2015-04-06 18:38:38 -04:00
parent e781292fba
commit 5bd7469b00
35 changed files with 1233 additions and 70 deletions
+3 -1
View File
@@ -17,4 +17,6 @@ hs_err_pid*
/dist/
/nbproject/private/
/ConversationEditor/nbproject/private/
/ConversationCompiler/nbproject/private/
/ConversationCompiler/nbproject/private/
/mina-core/build/
/mina-core/nbproject/private/
@@ -1,8 +1,8 @@
build.xml.data.CRC32=87962ed9
build.xml.data.CRC32=c55d3ba8
build.xml.script.CRC32=af729615
build.xml.stylesheet.CRC32=[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=87962ed9
nbproject/build-impl.xml.data.CRC32=c55d3ba8
nbproject/build-impl.xml.script.CRC32=b2a11926
nbproject/build-impl.xml.stylesheet.CRC32=[email protected]
+8
View File
@@ -6,6 +6,14 @@
<code-name-base>com.projectswg.tools.csc.conversationeditor</code-name-base>
<suite-component/>
<module-dependencies>
<dependency>
<code-name-base>com.projectswg.minacore</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.0</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.api.visual</code-name-base>
<build-prerequisite/>
@@ -107,12 +107,9 @@ public class Compiler {
break;
case ConversationNode.END:
if (handleNode.getStf().contains(":")) {
String[] split = handleNode.getStf().split(":");
bw.write(indent8 + "core.conversationService.sendStopConversation(actor, npc, 'conversation/" + split[0] + "', '" + split[1] + "')\n");
} else {
bw.write(indent8 + "# Couldn't write end response because of bad format!");
}
String[] split = handleNode.getStf().toString().split(":");
bw.write(indent8 + "core.conversationService.sendStopConversation(actor, npc, 'conversation/" + split[0] + "', '" + split[1] + "')\n");
break;
}
@@ -28,7 +28,7 @@ public class ConversationWidget extends IconNodeWidget implements LookupListener
this.attachedNode = node;
this.mgr = mgr;
setLabel(node.getStf());
setLabel(node.getStf().toString());
setImage(ImageUtilities.loadImage(node.getImageStr()));
// Alignment/pos/ori
@@ -124,7 +124,7 @@ public final class EditorTopComponent extends TopComponent implements ExplorerMa
}
public void blankSlate() {
scene.addNode(new BeginNode("sdafsdf", 0));
scene.addNode(new EndNode("asdfasdfsaf", 1));
scene.addNode(new BeginNode(scene.getStfFile(), 0));
scene.addNode(new EndNode(scene.getStfFile(), 1));
}
}
@@ -45,7 +45,7 @@ public final class NewConvEnd implements ActionListener {
return;
int id = scene.getNextId();
scene.addNode(new EndNode("New End Conversation " + String.valueOf(id), id));
scene.addNode(new EndNode(scene.getStfFile(), id));
scene.validate();
}
@@ -40,7 +40,7 @@ public final class NewConvOption implements ActionListener {
return;
int id = scene.getNextId();
scene.addNode(new OptionNode("New Conversation Option " + String.valueOf(id), id));
scene.addNode(new OptionNode(scene.getStfFile(), id));
scene.validate();
}
@@ -45,7 +45,7 @@ public final class NewConvResponse implements ActionListener {
return;
int id = scene.getNextId();
scene.addNode(new ResponseNode("New Conversation Response " + String.valueOf(id), id));
scene.addNode(new ResponseNode(scene.getStfFile(), id));
scene.validate();
}
}
@@ -1,39 +0,0 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projectswg.tools.csc.conversationeditor.actions;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle.Messages;
@ActionID(
category = "File",
id = "com.projectswg.tools.csc.conversationeditor.actions.NewConversation"
)
@ActionRegistration(
iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png",
displayName = "New Conversation"
)
@ActionReferences({
@ActionReference(path = "Menu/File", position = 2),
@ActionReference(path = "Toolbars/File", position = 400),
@ActionReference(path = "Shortcuts", name = "D-N")
})
@Messages("CTL_NewConversation=New Conversation")
public final class NewConversation implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
EditorTopComponent newEditor = new EditorTopComponent();
newEditor.open();
newEditor.requestActive();
}
}
@@ -1,17 +1,22 @@
package com.projectswg.tools.csc.conversationeditor.nodes;
import com.projectswg.tools.csc.conversationeditor.nodes.editors.StfEditor;
import com.projectswg.tools.csc.conversationeditor.stf.Stf;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.PropertySupport;
import org.openide.nodes.Sheet;
import org.openide.util.Exceptions;
import org.openide.util.Lookup;
public class ConversationNode extends AbstractNode implements Lookup.Provider {
private final int id;
private String stf;
private Stf stf;
private boolean locked;
private final Sheet sheet;
@@ -29,7 +34,7 @@ public class ConversationNode extends AbstractNode implements Lookup.Provider {
super(Children.LEAF);
this.id = id;
this.stf = stf;
this.stf = new Stf(stf);
this.imageStr = imageStr;
this.sheet = super.createSheet();
@@ -39,25 +44,31 @@ public class ConversationNode extends AbstractNode implements Lookup.Provider {
properties.setShortDescription("Basic properties for all conversation nodes.");
properties.put(new IdProperty(this));
properties.put(new StfProperty(this));
try {
properties.put(new StfProperty(this));
} catch (NoSuchMethodException ex) {
Exceptions.printStackTrace(ex);
}
properties.put(new LockedProperty(this));
sheet.put(properties);
this.type = type;
this.setDisplayName(stf);
//this.setDisplayName("New Node"); Controls name shown in properties window
}
public final int getId() {
return id;
}
public final String getStf() {
public Stf getStf() {
firePropertyChange("stf", stf, stf); // setStf is never used when changing property, so using getStf instead
return stf;
}
public final void setStf(String stf) {
public void setStf(Stf stf) {
//firePropertyChange("Stf", this.stf.toString(), stf.toString());
this.stf = stf;
}
@@ -66,6 +77,7 @@ public class ConversationNode extends AbstractNode implements Lookup.Provider {
}
public final void setLocked(boolean isLocked) {
firePropertyChange("locked", this.locked, isLocked);
this.locked = isLocked;
}
@@ -123,17 +135,20 @@ final class LockedProperty extends PropertySupport.ReadWrite<Boolean> {
}
final class StfProperty extends PropertySupport.ReadWrite<String> {
final class StfProperty extends PropertySupport.Reflection<Stf> {
private final ConversationNode node;
public StfProperty(ConversationNode node) {
super("stf", String.class, "STF", "STF file for this conversation node, excluding conversation/. Ex: conversation/c_newbie_mentor:s_109 would be c_newbie_mentor:s_109");
this.setValue("oneline", true);
public StfProperty(ConversationNode node) throws NoSuchMethodException {
super(node, Stf.class, "Stf");
//super("stf", String.class, "STF", "STF file for this conversation node, excluding conversation/. Ex: conversation/c_newbie_mentor:s_109 would be c_newbie_mentor:s_109");
//this.setValue("oneline", true);
this.setPropertyEditorClass(StfEditor.class);
this.node = node;
}
@Override
/* @Override
public String getValue() throws IllegalAccessException, InvocationTargetException {
return node.getStf();
}
@@ -141,7 +156,7 @@ final class StfProperty extends PropertySupport.ReadWrite<String> {
@Override
public void setValue(String val) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
node.setStf(String.valueOf(val));
}
}*/
}
final class IdProperty extends PropertySupport.ReadOnly<Integer> {
@@ -0,0 +1,5 @@
StfEditorVisual.jLabel1.text=STF File:
StfEditorVisual.jLabel1.toolTipText=
StfEditorVisual.jLabel2.text=STF Key:
StfEditorVisual.tfStfKey.text=None
StfEditorVisual.tfStfFile.text=None
@@ -0,0 +1,115 @@
package com.projectswg.tools.csc.conversationeditor.nodes.editors;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.scene.SceneView;
import com.projectswg.tools.csc.conversationeditor.stf.Stf;
import java.awt.Component;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyEditorSupport;
import java.beans.PropertyVetoException;
import java.beans.VetoableChangeListener;
import java.util.Set;
import org.openide.explorer.propertysheet.ExPropertyEditor;
import org.openide.explorer.propertysheet.PropertyEnv;
import org.openide.windows.TopComponent;
public class StfEditor extends PropertyEditorSupport implements ExPropertyEditor, VetoableChangeListener {
private StfEditorVisual editor;
private PropertyEnv env;
public StfEditor() {
editor = new StfEditorVisual();
}
@Override
public Object getValue() {
if (super.getValue() == null) {
//System.out.println("NULL VALUE");
setValue(null);
}
Stf val = (Stf) super.getValue();
val.setKey(editor.getTfStfKey().getText());
val.setFile(editor.tfStfFile.getText());
//val.setValue((String) editor.stfValues.getModel().getElementAt(editor.stfValues.getSelectedIndex()));
return super.getValue(); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean supportsCustomEditor() {
return true;
}
@Override
public void setAsText(String text) throws IllegalArgumentException {
//System.out.println("Setting as text.");
super.setAsText(text); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getAsText() {
Stf val = (Stf) super.getValue();
//System.out.println("Getting as text.");
return val.toString(); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Component getCustomEditor() {
//editor.addPropertyChangeListener(StfEditorVisual.);
env.addVetoableChangeListener(this);
return editor; //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setValue(Object stf) {
if (stf != null) {
super.setValue(stf);
return;
}
TopComponent component = TopComponent.getRegistry().getActivated();
if (component == null || !(component instanceof EditorTopComponent)) {
Set<TopComponent> components = TopComponent.getRegistry().getOpened();
boolean success = false;
for (TopComponent comp : components) {
if (comp instanceof EditorTopComponent) {
component = comp;
success = true;
break;
}
}
if (!success)
return;
}
EditorTopComponent editorComp = (EditorTopComponent) component;
SceneView scene = editorComp.getScene();
if (scene == null)
return;
if(stf==null){
stf = new Stf(scene.getStfFile());
}
editor.tfStfFile.setText(((Stf)stf).getFile());
editor.getTfStfKey().setText(((Stf)stf).getKey());
editor.stfValues.setListData(((Stf)stf).getEntries());
super.setValue(stf);
//System.out.println("Value set (setValue): " + ((Stf)stf).getKey());
}
@Override
public void attachEnv(PropertyEnv env) {
this.env = env;
editor.env = env;
editor.env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
}
@Override
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
// Only thrown when OK is pressed.
Stf val = (Stf) getValue();
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tfStfFile" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="tfStfKey" pref="333" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="tfStfFile" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="tfStfKey" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="209" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties" key="StfEditorVisual.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties" key="StfEditorVisual.jLabel1.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tfStfFile">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties" key="StfEditorVisual.tfStfFile.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties" key="StfEditorVisual.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tfStfKey">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/nodes/editors/Bundle.properties" key="StfEditorVisual.tfStfKey.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="stfValues">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="1">
<StringItem index="0" value="NULL"/>
</StringArray>
</Property>
</Properties>
<Events>
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="stfValuesValueChanged"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>
@@ -0,0 +1,121 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projectswg.tools.csc.conversationeditor.nodes.editors;
import javax.swing.JTextField;
import org.openide.explorer.propertysheet.PropertyEnv;
/**
*
* @author Wave
*/
public class StfEditorVisual extends javax.swing.JPanel {
public PropertyEnv env;
/**
* Creates new form StfEditorVisual
*/
public StfEditorVisual() {
initComponents();
}
public StfEditorVisual(PropertyEnv env) {
initComponents();
env.setState(PropertyEnv.STATE_NEEDS_VALIDATION);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
tfStfFile = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
tfStfKey = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
stfValues = new javax.swing.JList();
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.jLabel1.text")); // NOI18N
jLabel1.setToolTipText(org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.jLabel1.toolTipText")); // NOI18N
tfStfFile.setText(org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.tfStfFile.text")); // NOI18N
tfStfFile.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.jLabel2.text")); // NOI18N
tfStfKey.setEditable(false);
tfStfKey.setText(org.openide.util.NbBundle.getMessage(StfEditorVisual.class, "StfEditorVisual.tfStfKey.text")); // NOI18N
stfValues.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "NULL" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
stfValues.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
stfValuesValueChanged(evt);
}
});
jScrollPane1.setViewportView(stfValues);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfStfFile))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfStfKey, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(tfStfFile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tfStfKey, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void stfValuesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_stfValuesValueChanged
tfStfKey.setText(stfValues.getSelectedValue().toString().split(" | ")[0]);
}//GEN-LAST:event_stfValuesValueChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
public javax.swing.JList stfValues;
public javax.swing.JTextField tfStfFile;
private javax.swing.JTextField tfStfKey;
// End of variables declaration//GEN-END:variables
public JTextField getTfStfKey() {
return tfStfKey;
}
}
@@ -74,7 +74,7 @@ public class SceneSaver {
setAttribute(file, dataXMLNode, X_NODE, Integer.toString(location.x));
setAttribute(file, dataXMLNode, Y_NODE, Integer.toString(location.y));
setAttribute(file, dataXMLNode, LOCKED, Boolean.toString(node.isLocked()));
setAttribute(file, dataXMLNode, STF, node.getStf());
setAttribute(file, dataXMLNode, STF, node.getDisplayName());
for (HashMap.Entry<String, Object> entry : node.getAttributes().entrySet()) {
setAttribute(file, dataXMLNode, entry.getKey(), entry.getValue().toString());
@@ -4,8 +4,10 @@ import com.projectswg.tools.csc.conversationeditor.ConversationLookFeel;
import com.projectswg.tools.csc.conversationeditor.ConversationWidget;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import com.projectswg.tools.csc.conversationeditor.nodes.ConversationNode;
import com.projectswg.tools.csc.conversationeditor.stf.StfTable;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -16,6 +18,7 @@ import org.netbeans.api.visual.widget.ConnectionWidget;
import org.netbeans.api.visual.widget.LayerWidget;
import org.netbeans.api.visual.widget.Widget;
import org.openide.explorer.ExplorerManager;
import org.openide.util.Exceptions;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
@@ -29,6 +32,10 @@ public class SceneView extends GraphScene<ConversationNode, String>{
private String scenePath = "";
private boolean loaded = false;
private String stfFile = "None";
private StfTable stfTable;
private int id = 1;
public SceneView(ExplorerManager mgr) {
@@ -50,7 +57,7 @@ public class SceneView extends GraphScene<ConversationNode, String>{
}
@Override
protected Widget attachNodeWidget(ConversationNode n) {
protected Widget attachNodeWidget(final ConversationNode n) {
final ConversationWidget widget = new ConversationWidget(this, mgr, n);
widget.getActions().addAction(createObjectHoverAction());
@@ -59,6 +66,7 @@ public class SceneView extends GraphScene<ConversationNode, String>{
@Override
public void propertyChange(PropertyChangeEvent evt) {
TopComponent component = WindowManager.getDefault().findTopComponent("EditorTopComponent");
if (component == null || !(component instanceof EditorTopComponent))
return;
@@ -69,9 +77,13 @@ public class SceneView extends GraphScene<ConversationNode, String>{
if (scene == null)
return;
widget.getLabelWidget().setLabel(n.getStf().toString());
widget.repaint();
scene.validate();
switch(evt.getPropertyName()) {
case "stf":
widget.getLabelWidget().setLabel((String) evt.getNewValue());
widget.getLabelWidget().setLabel(evt.getNewValue().toString());
widget.repaint();
scene.validate();
@@ -79,6 +91,7 @@ public class SceneView extends GraphScene<ConversationNode, String>{
}
}
});
mainLayer.addChild(widget);
return widget;
}
@@ -143,6 +156,25 @@ public class SceneView extends GraphScene<ConversationNode, String>{
return loaded;
}
public String getStfFile() {
return stfFile;
}
public void setStfFile(String stfFile) {
this.stfFile = stfFile;
StfTable stfTable = new StfTable();
try {
stfTable.readFile(stfFile);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
this.stfTable = stfTable;
}
public StfTable getStfTable() {
return stfTable;
}
public LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> getConversationLinks() {
List<Widget> connectedNodes = connectionLayer.getChildren();
LinkedHashMap<ConversationNode, ArrayList<ConversationNode>> conversationLinks = new LinkedHashMap<>();
@@ -0,0 +1,4 @@
SceneVisualPanel1.jLabel1.text=Conversation STF file
SceneVisualPanel1.jButton1.text=Browse
SceneVisualPanel1.jLabel2.text=Select directory for STF file. This is used for displaying conversation entries for nodes.
SceneVisualPanel1.directory.text=None Specified
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="directory" min="-2" pref="199" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="directory" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="220" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties" key="SceneVisualPanel1.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="directory">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties" key="SceneVisualPanel1.directory.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties" key="SceneVisualPanel1.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/projectswg/tools/csc/conversationeditor/scenewizard/Bundle.properties" key="SceneVisualPanel1.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>
@@ -0,0 +1,112 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projectswg.tools.csc.conversationeditor.scenewizard;
import java.io.File;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.openide.filesystems.FileChooserBuilder;
public final class SceneVisualPanel1 extends JPanel {
/**
* Creates new form SceneVisualPanel1
*/
public SceneVisualPanel1() {
initComponents();
}
@Override
public String getName() {
return "Properties";
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
directory = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.jLabel1.text")); // NOI18N
directory.setText(org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.directory.text")); // NOI18N
directory.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.jButton1.text")); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SceneVisualPanel1.class, "SceneVisualPanel1.jLabel2.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(directory, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1))
.addComponent(jLabel2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(32, 32, 32)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(directory, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1))
.addContainerGap(220, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
File home = new File(System.getProperty("user.home"));
File selection = new FileChooserBuilder("user-dir").setTitle("Select Directory").
setDefaultWorkingDirectory(home).setApproveText("Select").setDirectoriesOnly(false).showOpenDialog();
if (selection != null) {
String path = selection.getAbsolutePath();
if (!path.endsWith(".stf")) {
JOptionPane.showConfirmDialog(null, path + " is not a STF", "Error", JOptionPane.OK_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE);
return;
}
directory.setText(path);
}
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField directory;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
public JTextField getDirectory() {
return directory;
}
}
@@ -0,0 +1,70 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projectswg.tools.csc.conversationeditor.scenewizard;
import com.projectswg.tools.csc.conversationeditor.EditorTopComponent;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComponent;
import org.openide.DialogDisplayer;
import org.openide.WizardDescriptor;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.NbBundle;
@ActionID(
category = "File",
id = "com.projectswg.tools.csc.conversationeditor.scenewizard.SceneWizardAction"
)
@ActionRegistration(
iconBase = "com/projectswg/tools/csc/conversationeditor/actions/conversation_tb_new.png",
displayName = "New Conversation"
)
@ActionReferences({
@ActionReference(path = "Menu/File", position = 2),
@ActionReference(path = "Toolbars/File", position = 400),
@ActionReference(path = "Shortcuts", name = "D-N")
})
@NbBundle.Messages("CTL_NewConversation=New Conversation")
public final class SceneWizardAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
List<WizardDescriptor.Panel<WizardDescriptor>> panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>();
panels.add(new SceneWizardPanel1());
String[] steps = new String[panels.size()];
for (int i = 0; i < panels.size(); i++) {
Component c = panels.get(i).getComponent();
// Default step name to component name of panel.
steps[i] = c.getName();
if (c instanceof JComponent) { // assume Swing components
JComponent jc = (JComponent) c;
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i);
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps);
jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true);
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true);
jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true);
}
}
WizardDescriptor wiz = new WizardDescriptor(new WizardDescriptor.ArrayIterator<WizardDescriptor>(panels));
// {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
wiz.setTitleFormat(new MessageFormat("{0}"));
wiz.setTitle("New Conversation");
if (DialogDisplayer.getDefault().notify(wiz) == WizardDescriptor.FINISH_OPTION) {
EditorTopComponent newEditor = new EditorTopComponent();
newEditor.open();
newEditor.requestActive();
newEditor.getScene().setStfFile((String) wiz.getProperty("directory"));
}
}
}
@@ -0,0 +1,68 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projectswg.tools.csc.conversationeditor.scenewizard;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
public class SceneWizardPanel1 implements WizardDescriptor.Panel<WizardDescriptor> {
/**
* The visual component that displays this panel. If you need to access the
* component from this class, just use getComponent().
*/
private SceneVisualPanel1 component;
// Get the visual component for the panel. In this template, the component
// is kept separate. This can be more efficient: if the wizard is created
// but never displayed, or not all panels are displayed, it is better to
// create only those which really need to be visible.
@Override
public SceneVisualPanel1 getComponent() {
if (component == null) {
component = new SceneVisualPanel1();
}
return component;
}
@Override
public HelpCtx getHelp() {
// Show no Help button for this panel:
return HelpCtx.DEFAULT_HELP;
// If you have context help:
// return new HelpCtx("help.key.here");
}
@Override
public boolean isValid() {
// If it is always OK to press Next or Finish, then:
return true;
// If it depends on some condition (form filled out...) and
// this condition changes (last form field filled in...) then
// use ChangeSupport to implement add/removeChangeListener below.
// WizardDescriptor.ERROR/WARNING/INFORMATION_MESSAGE will also be useful.
}
@Override
public void addChangeListener(ChangeListener l) {
}
@Override
public void removeChangeListener(ChangeListener l) {
}
@Override
public void readSettings(WizardDescriptor wiz) {
// use wiz.getProperty to retrieve previous panel state
}
@Override
public void storeSettings(WizardDescriptor wiz) {
wiz.putProperty("directory", component.getDirectory().getText());
}
}
@@ -0,0 +1,91 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.projectswg.tools.csc.conversationeditor.stf;
import com.projectswg.tools.csc.conversationeditor.stf.StfTable.Pair;
import java.io.IOException;
import java.util.Vector;
import org.openide.util.Exceptions;
public class Stf {
private String file;
private String key = "None";
private String value = "";
private Vector<String> entries = new Vector<>();
public Stf(String file) {
this.file = file;
if (!getFilename().equals("None")) {
StfTable table = new StfTable();
try {
table.readFile(file);
for (Pair<String, String> pair : table.disorderedTable) {
if (pair.getKey().equals("do_not_edit"))
continue;
entries.add(pair.getKey() + " | " + pair.getValue());
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
}
}
public String getFile() {
return file;
}
public void setFile(String file) {
this.file = file;
}
public final String getFilename() {
String r2;
try {
String[] base = file.split("conversation");
r2 = base[1].replace("\\", "").replace(".stf", "");
} catch (ArrayIndexOutOfBoundsException exc) {
r2 = "None";
}
return r2;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Vector<String> getEntries() {
return entries;
}
public void setEntries(Vector<String> entries) {
this.entries = entries;
}
@Override
public String toString() {
return getFilename() + ":" + getKey();
}
}
@@ -0,0 +1,153 @@
/*******************************************************************************
* Part of NGECore2
* Copyright (c) 2013 <Project SWG>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
package com.projectswg.tools.csc.conversationeditor.stf;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.List;
import org.apache.mina.core.buffer.IoBuffer;
/*
* Stf files don't appear to use the IFF format.
*
* ID 0 will probably always be null because they start at 1.
*/
public class StfTable {
private String[][] orderedTable;
public List<Pair<String, String>> disorderedTable;
public class Pair<K, V> {
private K key;
private V value;
public Pair(K key, V value) {
this.key = key;
this.value = value;
}
public K getKey() {
return key;
}
public V getValue() {
return value;
}
}
public StfTable() {
}
public StfTable(String filePath) throws IOException {
readFile(filePath);
}
public void readFile(String filePath) throws IOException {
java.io.FileInputStream stf = new java.io.FileInputStream(filePath);
IoBuffer buffer = IoBuffer.allocate(stf.available(), false);
buffer.setAutoExpand(true);
buffer.order(ByteOrder.LITTLE_ENDIAN);
byte[] buf = new byte[1024];
for (int i = stf.read(buf); i != -1; i = stf.read(buf)) {
buffer.put(buf, 0, i);
}
buffer.flip();
buffer.getInt(); // Size?
buffer.get(); // isMore?
int arrayCount = buffer.getInt();
int rowCount = buffer.getInt();
orderedTable = new String[arrayCount][2];
disorderedTable = new ArrayList<Pair<String, String>>();
for (int i = 0; i < rowCount; i++) {
int id = buffer.getInt();
buffer.getInt();
String value = "";
value = StringUtilities.getUnicodeString(buffer, true);
orderedTable[id][0] = null;
orderedTable[id][1] = value;
}
for (int i = 0; i < rowCount; i++) {
int id = buffer.getInt();
String name = StringUtilities.getAsciiString(buffer, true);
orderedTable[id][0] = name;
disorderedTable.add(new Pair<String, String>(name, orderedTable[id][1]));
}
stf.close();
}
public int getRowCount() {
return ((orderedTable == null) ? 0 : orderedTable.length);
}
public int getColumnCount() {
return ((orderedTable == null) ? 0 : 3);
}
/*
* @param id Iteration number
*
* @returns String's key-value pair from an alphanumeric list
*/
public Pair<String, String> getString(int id) {
return disorderedTable.get(id);
}
/*
* @param id Identifying number of the string from the .stf file, unlike above
*
* @returns String's key-value pair from an unordered list
*/
public Pair<String, String> getStringById(int id) {
return new Pair<String, String>(orderedTable[id][0], orderedTable[id][1]);
}
/*
* @param name Name of the string to return
*
* @returns The value for this key, or null if the key is not found
*/
public String getString(String name) {
for (String[] columns : orderedTable) {
if (columns[0].equals(name)) {
return columns[1];
}
}
return null;
}
}
@@ -0,0 +1,67 @@
/*******************************************************************************
* Part of NGECore2
* Copyright (c) 2013 <Project SWG>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
package com.projectswg.tools.csc.conversationeditor.stf;
import java.io.UnsupportedEncodingException;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
public class StringUtilities {
public static String getUnicodeString(IoBuffer buffer, boolean integer) {
return getString(buffer, "UTF-16LE", integer);
}
public static String getAsciiString(IoBuffer buffer, boolean integer) {
return getString(buffer, "US-ASCII", integer);
}
private static String getString(IoBuffer buffer, String charFormat, boolean integer) {
String result;
int length;
if (charFormat.equals("UTF-16LE")) {
if (integer) {
length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt() * 2;
} else {
length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt();
}
} else {
if (integer) {
length = buffer.order(ByteOrder.LITTLE_ENDIAN).getInt();
} else {
length = buffer.order(ByteOrder.LITTLE_ENDIAN).getShort();
}
}
int bufferPosition = buffer.position();
try {
result = new String(buffer.array(), bufferPosition, length, charFormat);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
buffer.position(bufferPosition + length);
return result;
}
}
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="com.projectswg.minacore" default="netbeans" basedir=".">
<description>Builds, tests, and runs the project com.projectswg.minacore.</description>
<import file="nbproject/build-impl.xml"/>
</project>
+6
View File
@@ -0,0 +1,6 @@
Manifest-Version: 1.0
AutoUpdate-Show-In-Client: true
OpenIDE-Module: com.projectswg.minacore
OpenIDE-Module-Localizing-Bundle: com/projectswg/minacore/Bundle.properties
OpenIDE-Module-Specification-Version: 1.0
+45
View File
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
-->
<project name="com.projectswg.minacore-impl" basedir="..">
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<property file="nbproject/private/suite-private.properties"/>
<property file="nbproject/suite.properties"/>
<fail unless="suite.dir">You must set 'suite.dir' to point to your containing module suite</fail>
<property file="${suite.dir}/nbproject/private/platform-private.properties"/>
<property file="${suite.dir}/nbproject/platform.properties"/>
<macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
<macrodef name="evalprops" uri="http://www.netbeans.org/ns/nb-module-project/2">
<attribute name="property"/>
<attribute name="value"/>
<sequential>
<property name="@{property}" value="@{value}"/>
</sequential>
</macrodef>
<property file="${user.properties.file}"/>
<nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:property name="nbplatform.active.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<nbmproject2:evalprops property="cluster.path.evaluated" value="${cluster.path}" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
<fail message="Path to 'platform' cluster missing in $${cluster.path} property or using corrupt Netbeans Platform (missing harness).">
<condition>
<not>
<contains string="${cluster.path.evaluated}" substring="platform"/>
</not>
</condition>
</fail>
<import file="${harness.dir}/build.xml"/>
</project>
+8
View File
@@ -0,0 +1,8 @@
build.xml.data.CRC32=4841ee18
build.xml.script.CRC32=c0ea07ec
build.xml.stylesheet.CRC32=[email protected]
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=4841ee18
nbproject/build-impl.xml.script.CRC32=78cc321f
nbproject/build-impl.xml.stylesheet.CRC32=[email protected]
+1
View File
@@ -0,0 +1 @@
is.autoload=true
+65
View File
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>com.projectswg.minacore</code-name-base>
<suite-component/>
<module-dependencies/>
<public-packages>
<package>org.apache.mina.core</package>
<package>org.apache.mina.core.buffer</package>
<package>org.apache.mina.core.file</package>
<package>org.apache.mina.core.filterchain</package>
<package>org.apache.mina.core.future</package>
<package>org.apache.mina.core.polling</package>
<package>org.apache.mina.core.service</package>
<package>org.apache.mina.core.session</package>
<package>org.apache.mina.core.write</package>
<package>org.apache.mina.filter.buffer</package>
<package>org.apache.mina.filter.codec</package>
<package>org.apache.mina.filter.codec.demux</package>
<package>org.apache.mina.filter.codec.prefixedstring</package>
<package>org.apache.mina.filter.codec.serialization</package>
<package>org.apache.mina.filter.codec.statemachine</package>
<package>org.apache.mina.filter.codec.textline</package>
<package>org.apache.mina.filter.errorgenerating</package>
<package>org.apache.mina.filter.executor</package>
<package>org.apache.mina.filter.firewall</package>
<package>org.apache.mina.filter.keepalive</package>
<package>org.apache.mina.filter.logging</package>
<package>org.apache.mina.filter.reqres</package>
<package>org.apache.mina.filter.ssl</package>
<package>org.apache.mina.filter.statistic</package>
<package>org.apache.mina.filter.stream</package>
<package>org.apache.mina.filter.util</package>
<package>org.apache.mina.handler.chain</package>
<package>org.apache.mina.handler.demux</package>
<package>org.apache.mina.handler.multiton</package>
<package>org.apache.mina.handler.stream</package>
<package>org.apache.mina.proxy</package>
<package>org.apache.mina.proxy.event</package>
<package>org.apache.mina.proxy.filter</package>
<package>org.apache.mina.proxy.handlers</package>
<package>org.apache.mina.proxy.handlers.http</package>
<package>org.apache.mina.proxy.handlers.http.basic</package>
<package>org.apache.mina.proxy.handlers.http.digest</package>
<package>org.apache.mina.proxy.handlers.http.ntlm</package>
<package>org.apache.mina.proxy.handlers.socks</package>
<package>org.apache.mina.proxy.session</package>
<package>org.apache.mina.proxy.utils</package>
<package>org.apache.mina.transport</package>
<package>org.apache.mina.transport.socket</package>
<package>org.apache.mina.transport.socket.nio</package>
<package>org.apache.mina.transport.vmpipe</package>
<package>org.apache.mina.util</package>
<package>org.apache.mina.util.byteaccess</package>
<package>testcase</package>
</public-packages>
<class-path-extension>
<runtime-relative-path>ext/mina-core-2.0.4.jar</runtime-relative-path>
<binary-origin>release/modules/ext/mina-core-2.0.4.jar</binary-origin>
</class-path-extension>
</data>
</configuration>
</project>
+1
View File
@@ -0,0 +1 @@
suite.dir=${basedir}/..
Binary file not shown.
@@ -0,0 +1 @@
OpenIDE-Module-Name=mina-core
+3 -1
View File
@@ -9,5 +9,7 @@ auxiliary.org-netbeans-modules-apisupport-installer.os-windows=true
auxiliary.org-netbeans-modules-apisupport-installer.pack200-enabled=false
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
modules=\
${project.com.projectswg.tools.csc.conversationeditor}
${project.com.projectswg.tools.csc.conversationeditor}:\
${project.com.projectswg.minacore}
project.com.projectswg.minacore=mina-core
project.com.projectswg.tools.csc.conversationeditor=ConversationEditor