use of com.google.gwt.user.client.ui.Widget in project che by eclipse.
the class MainMenuViewImpl method add.
/**
* Create and add new item in menu.
*/
private void add(Action action, PresentationFactory presentationFactory) {
Presentation presentation = presentationFactory.getPresentation(action);
if (action instanceof ActionGroup) {
ActionGroup group = (ActionGroup) action;
table.setText(0, menuBarItems.size(), presentation.getText());
Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
MenuBarItem item = new MenuBarItem(group, actionManager, managerProvider, presentationFactory, element, this, keyBindingAgent, resources.menuCss());
item.onMouseOut();
menuBarItems.put(element, item);
action2barItem.put(group, item);
} else if (action instanceof CustomComponentAction) {
Widget widget = ((CustomComponentAction) action).createCustomComponent(presentation);
table.setWidget(0, menuBarItems.size(), widget);
Element element = table.getCellFormatter().getElement(0, menuBarItems.size());
menuBarItems.put(element, null);
}
}
use of com.google.gwt.user.client.ui.Widget in project che by eclipse.
the class EditorPartStackView method ensureActiveTabVisible.
/**
* Makes active tab visible.
*/
private void ensureActiveTabVisible() {
if (activeTab == null) {
return;
}
for (int i = 0; i < tabsPanel.getWidgetCount(); i++) {
if (editorPaneMenu != null && editorPaneMenu != tabsPanel.getWidget(i)) {
tabsPanel.getWidget(i).setVisible(true);
}
}
for (int i = 0; i < tabsPanel.getWidgetCount(); i++) {
Widget currentWidget = tabsPanel.getWidget(i);
Widget activeTabWidget = activeTab.getView().asWidget();
if (editorPaneMenu != null && editorPaneMenu == currentWidget) {
continue;
}
if (activeTabWidget.getAbsoluteTop() > tabsPanel.getAbsoluteTop() && activeTabWidget != currentWidget) {
currentWidget.setVisible(false);
}
}
}
use of com.google.gwt.user.client.ui.Widget in project che by eclipse.
the class ToolbarViewImpl method createToolbarPart.
/**
* Creates a toolbar part widget.
*
* @return widget
*/
private Widget createToolbarPart(List<Utils.VisibleActionGroup> visibleActionGroupList) {
FlowPanel toolbarPart = new FlowPanel();
if (addSeparatorFirst) {
final Widget firstDelimiter = createDelimiter();
toolbarPart.add(firstDelimiter);
}
for (Utils.VisibleActionGroup visibleActionGroup : visibleActionGroupList) {
List<Action> actions = visibleActionGroup.getActionList();
if (actions == null || actions.size() == 0) {
continue;
}
FlowPanel actionGroupPanel = new FlowPanel();
actionGroupPanel.setStyleName(toolbarResources.toolbar().toolbarActionGroupPanel());
toolbarPart.add(actionGroupPanel);
for (Action action : actions) {
if (action instanceof Separator) {
int actionIndex = actions.indexOf(action);
if (actionIndex > 0 && actionIndex < actions.size() - 1) {
final Widget delimiter = createDelimiter();
actionGroupPanel.add(delimiter);
}
} else if (action instanceof CustomComponentAction) {
Presentation presentation = presentationFactory.getPresentation(action);
Widget customComponent = ((CustomComponentAction) action).createCustomComponent(presentation);
actionGroupPanel.add(customComponent);
} else if (action instanceof ActionGroup && ((ActionGroup) action).isPopup()) {
ActionPopupButton button = new ActionPopupButton((ActionGroup) action, actionManager, keyBindingAgent, presentationFactory, managerProvider, toolbarResources);
actionGroupPanel.add(button);
} else {
final ActionButton button = createToolbarButton(action);
actionGroupPanel.add(button);
}
}
}
return toolbarPart;
}
use of com.google.gwt.user.client.ui.Widget in project che by eclipse.
the class NotificationContainerItem method update.
/**
* Update notification's widget values.
* <p/>
* Widget consumes:
* <ul>
* <li>{@link Notification#title}</li>
* <li>{@link Notification#content}</li>
* <li>Icon and background color based on {@link StatusNotification.Status}</li>
* </ul>
*/
private void update() {
Widget titleWidget = titlePanel.getWidget();
if (titleWidget != null && titleWidget instanceof Label) {
((Label) titleWidget).setText(notification.getTitle());
StringBuilder infoBuilder = new StringBuilder();
if (notification.getProject() != null) {
infoBuilder.append("Project: ").append(notification.getProject().getName()).append(". ");
}
infoBuilder.append(DATA_FORMAT.format(new Date(notification.getTime())));
titlePanel.getElement().setAttribute("info", infoBuilder.toString());
}
Widget messageWidget = messagePanel.getWidget();
if (messageWidget != null && messageWidget instanceof Label) {
((Label) messageWidget).setText(notification.getContent());
}
if (notification instanceof StatusNotification) {
iconPanel.setWidget(getIconBaseOnStatus());
}
}
use of com.google.gwt.user.client.ui.Widget in project che by eclipse.
the class ClipboardButtonBuilderImpl method append.
/**
* Append to parentWidget as a child element.
*
* @param element
*/
private void append(Element element) {
if (parentWidget == null && (resourceWidget == null || resourceWidget.getParent() == null)) {
return;
}
Widget parent = parentWidget != null ? parentWidget : resourceWidget.getParent();
parent.getElement().appendChild(element);
}
Aggregations