Integer graphId = bufEvent.getGraphId();
Date d = new Date();
StorableSubGraph ssg = this.parameter.model.getRootStorableSubGraph(graphId);
VisualGraph.log.printInfo("[" + this.getClass().getName() + ".update] Root subGraph select time: " + (new Date().getTime() - d.getTime()) / 1000.0 + "sec");
if(ssg != null) {
IGraphView graphView = GraphView.newGraphView(ssg, DesktopPanel.this.parameter.userInterface);
addTab(graphView.getTitle(), graphView);
} else {
VisualGraph.log.printError("[" + this.getClass().getName() + ".update] Desktop. Openning of root subgraph(DEF_OPEN_NEW_GRAPH). GraphId = " + graphId.toString());
}
break;
}
case DEF_CREATE_NEW_CONNECT:
{
UIEventCreateNewConnection bufEvent = (UIEventCreateNewConnection)event;
addNewConnect(bufEvent.getConnectionId(), bufEvent.getConnectionName(), bufEvent.getGraphId(), bufEvent.getAnchor());
break;
}
case DEF_DELETE_CONNECT:
{
UIEventDeleteConnection bufEvent = (UIEventDeleteConnection)event;
removeConnect(bufEvent.getConnectId());
break;
}
case DEF_CHANGE_UI_STYLE:
{
updateUITheme();
break;
}
case DEF_RESET:
{
this.connections.clear();
this.comTabIdAndTabTitle.clear();
this.comTabIdAndTab.clear();
this.comTabIdAndGraphView.clear();
this.tabTitleStatistic.clear();
this.tabs.removeAll();
break;
}
}
} else if(arg instanceof AUIRequest) {
AUIRequest request = (AUIRequest)arg;
switch(request.getType()) {
case DEF_CLOSE_CURRENT_TAB:
{
// call request owner method (PROCESS REQUEST)
IUIRequestOwner bufOwner = request.getOwner();
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.PROCESS, null) {});
}
// execute query
int index = this.tabs.getSelectedIndex();
if(index >= 0) {
for(Integer buf : this.comTabIdAndTab.keySet()) {
Integer value = this.comTabIdAndTab.get(buf);
if(value != null && value.equals(index)) {
closeTab(buf);
break;
}
}
}
// call request owner method (OK REQUEST)
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.OK, null) {});
}
break;
}
case DEF_CLOSE_TAB: {
// call request owner method (PROCESS REQUEST)
IUIRequestOwner bufOwner = request.getOwner();
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.PROCESS, null) {});
}
// execute query
UIRequestCloseTab req = (UIRequestCloseTab)request;
Set<Integer>tabSet = req.getTabSet();
if(tabSet != null) {
for(Integer buf : tabSet) {
closeTab(buf);
}
}
// call request owner method (OK REQUEST)
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.OK, null) {});
}
break;
}
case DEF_OPEN_SUB_GRAPH:
{
// call request owner method (PROCESS REQUEST)
IUIRequestOwner bufOwner = request.getOwner();
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.PROCESS, null) {});
}
// execute query
UIRequestOpenSubGraph req = (UIRequestOpenSubGraph)request;
final IGraphView igv = req.getSubGraphView();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if(igv != null) {
addTab(igv.getTitle(), igv);
}
}
});
// call request owner method (OK REQUEST)
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.OK, null) {});
}
break;
}
case DEF_SELECT_TAB:
{
// call request owner method (PROCESS REQUEST)
IUIRequestOwner bufOwner = request.getOwner();
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.PROCESS, null) {});
}
// execute query
UIRequestSelectTab req = (UIRequestSelectTab)request;
final Integer tabId = req.getTabId();
// find tab
SwingUtilities.invokeLater(new Runnable() {
public void run() {
tabs.setSelectedIndex(DesktopPanel.this.comTabIdAndTab.get(tabId));
}
});
// call request owner method (OK REQUEST)
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.OK, null) {});
}
break;
}
case DEF_REPLACE_CURRENT_TAB:
{
// call request owner method (PROCESS REQUEST)
IUIRequestOwner bufOwner = request.getOwner();
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.PROCESS, null) {});
}
// execute query
UIRequestReplaceCurrentTab req = (UIRequestReplaceCurrentTab)request;
int index = this.tabs.getSelectedIndex();
if(index >= 0) {
for(Integer buf : this.comTabIdAndTab.keySet()) {
Integer value = this.comTabIdAndTab.get(buf);
if(value != null && value.equals(index)) {
closeTab(buf);
IGraphView igv = req.getSubGraphView();
if(igv != null) {
addTab(igv.getTitle(), igv);
}
break;
}
}
}