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;
}
}
}
// call request owner method (OK REQUEST)
if(bufOwner != null) {
bufOwner.callRequestOwner(new AUIRequest(EUIRequestType.OK, null) {});
}
break;
}
}
}