base = new JPanel();
base.setLayout(new BorderLayout(8, 8));
tabpane = new JTabbedPane();
String svcName;
ServiceType type = getServiceType(attrs);
if(type!=null) {
svcName = type.getDisplayName();
} else {
svcName = item.service.getClass().getName();
}
ComputeResourceInfo computeResourceInfo = getComputeResourceInfo(attrs);
java.util.Timer taskTimer = new java.util.Timer(true);
long now = System.currentTimeMillis();
UIComponentFetcher uiFetcher = new UIComponentFetcher();
WaitingToLoadTask waitingToLoadTask;
if(computeResourceInfo!=null)
waitingToLoadTask = new WaitingToLoadTask(svcName,
computeResourceInfo.hostName,
computeResourceInfo.hostAddress);
else
waitingToLoadTask = new WaitingToLoadTask(svcName,
"unknown",
"unknown");
TimeoutTask timeoutTask = new TimeoutTask(uiFetcher);
taskTimer.schedule(waitingToLoadTask,
new Date(now+Math.min(1000*5, startupDelay)));
taskTimer.schedule(timeoutTask, new Date(now+startupDelay));
uiFetcher.start();
try {
uiFetcher.join(startupDelay);
} catch(InterruptedException e) {
throw new Exception("Unable to obtain Service UI attributes for "+
svcName+" in allotted time of "+
(startupDelay/1000)+" seconds");
}
waitingToLoadTask.cancel();
if(waitingToLoadTask.dialog!=null)
waitingToLoadTask.dialog.dispose();
if(uiFetcher.isInterrupted())
throw new Exception("Unable to obtain Service UI attributes for "+
svcName+" in allotted time of "+
(startupDelay/1000)+" seconds");
timeoutTask.cancel();
if(uiFetcher.exception!=null)
throw uiFetcher.exception;
ServiceInfo info = getServiceInfo(attrs);
if(type!=null || info!=null) {
JPanel svcTypePanel = new JPanel();
svcTypePanel.setLayout(new BoxLayout(svcTypePanel, BoxLayout.Y_AXIS));
ServiceTypePanel typePanel = new ServiceTypePanel();
typePanel.setMaximumSize(new Dimension(Integer.MAX_VALUE, 200));
if(type!=null) {
image = type.getIcon(0);
typePanel.setServiceType(type);
}
svcTypePanel.add(Box.createVerticalStrut(8));
svcTypePanel.add(typePanel);