String context = PUBLISHER;
public MenuBarPanel(String context) {
this.context = context;
HorizontalPanel pushPanel = new HorizontalPanel();
pushPanel.setSpacing(7);
newButton.setHTML(images.create().getHTML());
newButton.setStyleName(("portlet-form-button"));
newButton.addClickListener(this);
pushPanel.add(newButton);
saveButton.setHTML(images.save().getHTML());
saveButton.setStyleName(("portlet-form-button"));
saveButton.addClickListener(this);
pushPanel.add(saveButton);
deleteButton.setHTML(images.delete().getHTML());
deleteButton.setStyleName(("portlet-form-button"));
deleteButton.addClickListener(this);
pushPanel.add(deleteButton);
if (SUBSCRIPTION.equals(context)) {
syncButton.setHTML(images.sync().getHTML());
syncButton.setStyleName(("portlet-form-button"));
syncButton.addClickListener(this);
pushPanel.add(syncButton);
}
if (PUBLISHER.equals(context)) {
managerButton.setHTML(images.manager().getHTML());
managerButton.setStyleName(("portlet-form-button"));
managerButton.addClickListener(this);
pushPanel.add(managerButton);
}
add(pushPanel);
}