use of org.vcell.util.gui.sorttable.JSortTable in project vcell by virtualcell.
the class ServerManageConsole method getQueryResultTable.
/**
* Return the QueryResultTable property value.
* @return cbit.vcell.messaging.admin.sorttable.JSortTable
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private JSortTable getQueryResultTable() {
if (ivjQueryResultTable == null) {
try {
ivjQueryResultTable = new JSortTable();
ivjQueryResultTable.setName("QueryResultTable");
ivjQueryResultTable.setModel(new JobTableModel());
ivjQueryResultTable.disableUneditableForeground();
final JPopupMenu popup = new JPopupMenu();
JMenuItem viewMongoMenuItem = new JMenuItem("View Mongo Log Info...");
popup.add(viewMongoMenuItem);
viewMongoMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Number simID = (Number) ivjQueryResultTable.getModel().getValueAt(ivjQueryResultTable.getSelectedRow(), JobTableModel.columnIndex_SimID);
String userid = (String) ivjQueryResultTable.getModel().getValueAt(ivjQueryResultTable.getSelectedRow(), JobTableModel.columnIndex_UserID);
System.out.println("----- user=" + userid + " simID=" + simID);
String mongoDbHost = PropertyLoader.getRequiredProperty(PropertyLoader.mongodbHostInternal);
// default 27017
int mongoDbPort = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.mongodbPortInternal));
Mongo m = new Mongo(mongoDbHost, mongoDbPort);
String mongoDbDatabaseName = PropertyLoader.getRequiredProperty(PropertyLoader.mongodbDatabase);
DB db = m.getDB(mongoDbDatabaseName);
String mongoDbLoggingCollectionName = PropertyLoader.getRequiredProperty(PropertyLoader.mongodbLoggingCollection);
DBCollection dbCollection = db.getCollection(mongoDbLoggingCollectionName);
BasicDBObject query = new BasicDBObject();
query.put(VCMongoMessage.MongoMessage_simId, simID.intValue() + "");
DBCursor cur = dbCollection.find(query);
TreeMap<String, Integer> mapKeyToColumnIndex = new TreeMap<String, Integer>();
Vector<DBObject> dbObjV = new Vector<DBObject>();
while (cur.hasNext()) {
DBObject dbObject = cur.next();
dbObjV.add(dbObject);
Set<String> keys = dbObject.keySet();
Iterator<String> iter = keys.iterator();
while (iter.hasNext()) {
String key = iter.next();
Integer columnIndex = mapKeyToColumnIndex.get(key);
if (columnIndex == null) {
columnIndex = mapKeyToColumnIndex.size();
mapKeyToColumnIndex.put(key, columnIndex);
}
}
}
int msgTimeColumnIndex = -1;
if (mapKeyToColumnIndex.size() > 0) {
String[] columnNames = new String[mapKeyToColumnIndex.size()];
Iterator<String> keyIter = mapKeyToColumnIndex.keySet().iterator();
while (keyIter.hasNext()) {
String key = keyIter.next();
int columnIndex = mapKeyToColumnIndex.get(key);
columnNames[columnIndex] = key;
if (key.equals(VCMongoMessage.MongoMessage_msgTime)) {
msgTimeColumnIndex = columnIndex;
}
}
// //Ask which columns to view
// Object[][] colrowdata = new Object[columnNames.length][1];
// for (int i = 0; i < colrowdata.length; i++) {
// colrowdata[i][0] = columnNames[i];
// }
// int[] showcolArr =
// DialogUtils.showComponentOKCancelTableList(ServerManageConsole.this, "Select Columns to View...", new String[] {"Column Names"}, colrowdata, ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
Object[][] rowData = new Object[dbObjV.size()][columnNames.length];
for (int i = 0; i < rowData.length; i++) {
DBObject dbObj = dbObjV.get(i);
Set<String> keys = dbObj.keySet();
Iterator<String> iter = keys.iterator();
while (iter.hasNext()) {
String key = iter.next();
rowData[i][mapKeyToColumnIndex.get(key)] = dbObj.get(key);
}
}
// sort by msgtime
final int msgTimeColumnIndexFinal = msgTimeColumnIndex;
if (msgTimeColumnIndex != -1) {
Arrays.sort(rowData, new Comparator<Object[]>() {
public int compare(Object[] o1, Object[] o2) {
Long o1Long = (Long) o1[msgTimeColumnIndexFinal];
Long o2Long = (Long) o2[msgTimeColumnIndexFinal];
int result = (int) (o2Long - o1Long);
return result;
}
});
}
DialogUtils.showComponentOptionsTableList(ServerManageConsole.this, "Mongo Log Info (" + rowData.length + ") " + userid + " " + simID, columnNames, rowData, ListSelectionModel.SINGLE_SELECTION, null, null, null, null, false);
} else {
DialogUtils.showWarningDialog(ServerManageConsole.this, "No Mongo Log Info found for simID=" + simID.intValue());
}
} catch (UserCancelException uce) {
// ignore
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
ivjQueryResultTable.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.isPopupTrigger()) {
JTable source = (JTable) e.getSource();
int row = source.rowAtPoint(e.getPoint());
int column = source.columnAtPoint(e.getPoint());
if (!source.isRowSelected(row))
source.changeSelection(row, column, false, false);
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
});
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjQueryResultTable;
}
use of org.vcell.util.gui.sorttable.JSortTable in project vcell by virtualcell.
the class ServerManageConsole method getUserConnectionTable.
/**
* Return the UserConnectionTable property value.
* @return cbit.vcell.messaging.admin.sorttable.JSortTable
*/
private JSortTable getUserConnectionTable() {
if (ivjUserConnectionTable == null) {
try {
ivjUserConnectionTable = new JSortTable();
ivjUserConnectionTable.setModel(new UserConnectionTableModel());
ivjUserConnectionTable.disableUneditableForeground();
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjUserConnectionTable;
}
use of org.vcell.util.gui.sorttable.JSortTable in project vcell by virtualcell.
the class SimulationListPanel method getScrollPaneTable.
/**
* Return the ScrollPaneTable property value.
* @return cbit.gui.JTableFixed
*/
private JSortTable getScrollPaneTable() {
if (ivjScrollPaneTable == null) {
try {
// ivjScrollPaneTable = new ScrollTable() {
// @Override
// public JToolTip createToolTip() {
// MultiLineToolTip tip = new MultiLineToolTip();
// tip.setComponent(this);
// return tip;
// }
// };
ivjScrollPaneTable = new JSortTable();
ivjScrollPaneTable.setName("ScrollPaneTable");
ivjScrollPaneTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
ivjScrollPaneTable.setModel(getSimulationListTableModel1());
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjScrollPaneTable;
}
use of org.vcell.util.gui.sorttable.JSortTable in project vcell by virtualcell.
the class InitialConditionsPanel method getScrollPaneTable.
/**
* Return the ScrollPaneTable property value.
* @return javax.swing.JTable
*/
private JSortTable getScrollPaneTable() {
if (table == null) {
try {
table = new JSortTable();
table.setName("spceciesContextSpecsTable");
tableModel = new SpeciesContextSpecsTableModel(table);
table.setModel(tableModel);
table.setScrollTableActionManager(new InternalScrollTableActionManager(table));
table.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return table;
}
use of org.vcell.util.gui.sorttable.JSortTable in project vcell by virtualcell.
the class ModelProcessSpecsPanel method getScrollPaneTable.
/**
* Return the ScrollPaneTable property value.
* @return javax.swing.JTable
*/
private JSortTable getScrollPaneTable() {
if (ivjScrollPaneTable == null) {
try {
ivjScrollPaneTable = new JSortTable();
ivjScrollPaneTable.setName("ScrollPaneTable");
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
return ivjScrollPaneTable;
}
Aggregations