Added new SUIWindow methods: addTableDataSource, addTableColumn, addTableRow, minor GuildMember variable additions

This commit is contained in:
Waverunner
2014-05-24 19:15:27 -04:00
parent 615602e9b3
commit a9c95d0612
5 changed files with 110 additions and 5 deletions
+37 -1
View File
@@ -40,6 +40,7 @@ public class SUIWindow {
private Map<Integer, PyObject> callbacks = new ConcurrentHashMap<Integer, PyObject>();
private Map<Integer, SUICallback> javaCallbacks = new ConcurrentHashMap<Integer, SUICallback>();
private Vector<SUIListBoxItem> menuItems = new Vector<SUIListBoxItem>();
private Vector<SUITableItem> tableItems = new Vector<SUITableItem>();
public SUIWindow(String script, SWGObject owner, int windowId, SWGObject rangeObject, float maxDistance) {
@@ -154,6 +155,21 @@ public class SUIWindow {
}
public void addTableDataSource(String name, String value) {
SUIWindowComponent component = new SUIWindowComponent();
component.setType((byte) 8); // using 6 (addDataSource) doesn't allow setting of column titles in tables
for(String str : name.split(":")) {
component.getNarrowParams().add(str);
}
component.getWideParams().add(value);
components.add(component);
}
public void addListBoxMenuItem(String itemName, long objectId) {
SUIListBoxItem menuItem = new SUIListBoxItem(itemName, objectId);
@@ -164,8 +180,28 @@ public class SUIWindow {
menuItems.add(menuItem);
}
public void addTableColumn(String itemName, String type) {
int index = tableItems.size();
SUITableItem item = new SUITableItem(itemName, index);
addTableDataSource("comp.TablePage.dataTable:Name", String.valueOf(index));
setProperty("comp.TablePage.dataTable." + index + ":Label", itemName);
setProperty("comp.TablePage.dataTable." + index + ":Type", type);
tableItems.add(item);
}
public void addTableRow(String itemName) {
tableItems.forEach(column -> {
int index = column.getIndex();
SUITableItem item = new SUITableItem(itemName, index);
addDataItem("comp.TablePage.dataTable." + index + ":Name", "data" + index);
setProperty("comp.TablePage.dataTable." + index + ".data" + index + ":Value", itemName);
column.getChildren().add(item);
});
}
public int getWindowId() {
return windowId;
}