_openTab(DOMID, initSubject, componentId, name, componentId, icon);
}
private void _openTab(final String DOMID, final String initSubject, final String componentId, final String name, final String instanceId, final Image icon) {
final MessageBus bus = ErraiBus.get();
bus.conversationWith(
createMessage().getMessage().set(LayoutParts.DOMID, DOMID)
.toSubject(initSubject),
new MessageCallback() {
public void callback(Message message) {
final ExtSimplePanel panel = new ExtSimplePanel();
panel.getElement().getStyle().setProperty("overflow", "hidden");
Effects.setOpacity(panel.getElement(), 0);
WSElementWrapper toolWidget = new WSElementWrapper(getElementById(DOMID));
toolWidget.setVisible(true);
panel.setWidget(toolWidget);
Image app = new Image(erraiImageBundle.application());
final Image newIcon = new Image(icon != null || "".equals(icon) ? icon.getUrl() :
app.getUrl());
newIcon.setSize("16px", "16px");
final WSTab newWSTab = new WSTab(name, panel, newIcon);
tabPanel.add(panel, newWSTab);
newWSTab.activate();
newWSTab.clearTabCloseHandlers();
newWSTab.addTabCloseHandler(new TabCloseHandler(instanceId));
tabDragController.makeDraggable(newWSTab, newWSTab.getLabel());
tabDragController.makeDraggable(newWSTab, newWSTab.getIcon());
newWSTab.getLabel().addMouseOverHandler(new MouseOverHandler() {
public void onMouseOver(MouseOverEvent event) {
newWSTab.getLabel().getElement().getStyle().setProperty("cursor", "default");
}
});
newWSTab.getLabel().addMouseDownHandler(new MouseDownHandler() {
public void onMouseDown(MouseDownEvent event) {
newWSTab.activate();
}
});
tabDragController.setBehaviorDragProxy(true);
tabDragController.registerDropController(newWSTab.getTabDropController());
newWSTab.reset();
activateTool(componentId);
Map<String, Object> tabProperties = new HashMap<String, Object>();
tabProperties.put(LayoutParts.Name.name(), name);
tabProperties.put(LayoutParts.IconURI.name(), newIcon.getUrl());
tabProperties.put(LayoutParts.ComponentID.name(), componentId);
tabProperties.put(LayoutParts.Subject.name(), getInstanceSubject(instanceId));
tabInstances.put(instanceId, JSONUtilCli.encodeMap(tabProperties));
bus.subscribe(getInstanceSubject(instanceId),
new MessageCallback() {
private Map<String, List<Object>> toUnregister = ((ClientMessageBus) bus).getCapturedRegistrations();
public void callback(Message message) {
switch (LayoutCommands.valueOf(message.getCommandType())) {