this.context = context;
}
public Widget asWidget() {
final LayoutPanel layout = new LayoutPanel();
final PopupPanel toolsPopup = new DefaultPopup(DefaultPopup.Arrow.BOTTOM);
final List<String[]> toolReference = new ArrayList<String[]>();
if(context.isSuperUser()) {
toolReference.add(new String[]{"Management Model", "browser"});
}
toolReference.add(new String[]{"Expression Resolver", "expressions"});
if (diagnostics.isEnabled()) {
toolReference.add(new String[]{"Diagnostics", "debug-panel"});
}
// only enabled in dev mode
if (!GWT.isScript()) {
toolReference.add(new String[]{"Modelling", "mbui-workbench"});
toolReference.add(new String[]{"Resource Access", "access-log"});
}
final VerticalPanel toolsList = new VerticalPanel();
toolsList.getElement().setAttribute("width", "160px");
for(final String[] tool : toolReference)
{
InlineLink browser = new InlineLink(tool[0]);
browser.getElement().setAttribute("style", "margin:4px");
browser.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
toolsPopup.hide();
placeManager.revealPlace(
new PlaceRequest.Builder().nameToken(NameTokens.ToolsPresenter).with("name", tool[1])
.build());
}
});
toolsList.add(browser);
}
toolsPopup.setWidget(toolsList);
final HTML toolsLink = new HTML("<i class='icon-caret-up'></i> "+"Tools");
toolsLink.addStyleName("footer-link");
toolsLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
int listHeight = toolsList.getWidgetCount() * 25;
toolsPopup.setPopupPosition(
toolsLink.getAbsoluteLeft()-45,
toolsLink.getAbsoluteTop()-(listHeight-25)-50
);
toolsPopup.setWidth("165");
toolsPopup.setHeight(listHeight +"");
toolsPopup.show();
}
});
HTML settings = new HTML("<i class='icon-wrench'></i> "+Console.CONSTANTS.common_label_settings());
settings.addStyleName("footer-link");