/** Create new {@link MainMenuViewImpl} */ @Inject public MainMenuViewImpl( MenuResources resources, ActionManager actionManager, KeyBindingAgent keyBindingAgent, Provider<PerspectiveManager> managerProvider, CommandToolbarPresenter toolbarPresenter) { this.resources = resources; this.actionManager = actionManager; this.keyBindingAgent = keyBindingAgent; this.managerProvider = managerProvider; initWidget(rootPanel); disableTextSelection(rootPanel.getElement(), true); rootPanel.setStyleName(resources.menuCss().menuBar()); leftPanel.addStyleName(resources.menuCss().leftPanel()); table.setStyleName(resources.menuCss().menuBarTable()); table.setCellPadding(0); table.setCellSpacing(0); final DivElement triangleSeparator = Elements.createDivElement(resources.menuCss().triangleSeparator()); rightPanel.addStyleName(resources.menuCss().rightPanel()); rightPanel.addStyleName(resources.menuCss().commandToolbar()); rootPanel.add(leftPanel); rootPanel.add(table); rootPanel.getElement().appendChild((Element) triangleSeparator); rootPanel.add(rightPanel); toolbarPresenter.go(rightPanel::add); }
public void inject() { resources.coreCss().ensureInjected(); windowClientBundle.getStyle().ensureInjected(); resources.treeCss().ensureInjected(); resources.defaultSimpleListCss().ensureInjected(); resources.partStackCss().ensureInjected(); resources.dialogBox().ensureInjected(); resources.clipboardCss().ensureInjected(); resources.notificationCss().ensureInjected(); resources.dataGridStyle().ensureInjected(); resources.cellTableStyle().ensureInjected(); resources.defaultCategoriesListCss().ensureInjected(); resources.buttonLoaderCss().ensureInjected(); resources.menuCss().ensureInjected(); resources.commandsExplorerCss().ensureInjected(); resources.commandsPaletteCss().ensureInjected(); resources.commandToolbarCss().ensureInjected(); resources.editorCss().ensureInjected(); resources.commandTypeChooserCss().ensureInjected(); resources.treeStylesCss().ensureInjected(); } }
/** Create new {@link MainMenuViewImpl} */ @Inject public StatusPanelGroupViewImpl(MenuResources resources, ActionManager actionManager) { this.resources = resources; this.actionManager = actionManager; initWidget(rootPanel); rootPanel.setStyleName(resources.menuCss().menuBar()); rootPanel.addStyleName(resources.menuCss().statusPanel()); leftPanel.addStyleName(resources.menuCss().leftPanel()); leftPanel.getElement().getStyle().setPropertyPx("marginLeft", 1); rootPanel.add(leftPanel); centerPanel.setStyleName(resources.menuCss().leftPanel()); rootPanel.add(centerPanel); rightPanel.addStyleName(resources.menuCss().rightPanel()); rightPanel.getElement().getStyle().setPropertyPx("marginRight", 1); rootPanel.add(rightPanel); }
/** Create a new widget and add it to panel menu. */ private void addToPanel(FlowPanel panel, Action action, PresentationFactory presentationFactory) { Presentation presentation = presentationFactory.getPresentation(action); if (action instanceof Separator) { panel.add(new SeparatorItem(resources.menuCss().panelSeparator())); // todo find way to render non custom actions } else if (action instanceof CustomComponentAction) { CustomComponentAction customComponentAction = (CustomComponentAction) action; Widget component = customComponentAction.createCustomComponent(presentation); component.addStyleName(resources.menuCss().customComponent()); panel.add(component); } }
/** Create a new widget and add it to panel menu. */ private void addToPanel(FlowPanel panel, Action action, PresentationFactory presentationFactory) { Presentation presentation = presentationFactory.getPresentation(action); if (action instanceof Separator) { panel.add(new SeparatorItem(resources.menuCss().panelSeparator())); // todo find way to render non custom actions } else if (action instanceof CustomComponentAction) { CustomComponentAction customComponentAction = (CustomComponentAction) action; Widget component = customComponentAction.createCustomComponent(presentation); component.addStyleName(resources.menuCss().customComponent()); panel.add(component); } }
/** Mouse Over Handler */ public void onMouseOver() { if (pressed) { return; } if (enabled && hasVisibleItems) { element.setClassName(css.menuBarItemOver()); } }
/** Mouse Out Handler */ public void onMouseOut() { if (pressed) { return; } if (enabled && hasVisibleItems) { element.setClassName(css.menuBarItem()); } else { element.setClassName(css.menuBarItemDisabled()); } }
private void updateEnabledState() { pressed = false; if (enabled && hasVisibleItems) { element.setClassName(css.menuBarItem()); } else { element.setClassName(css.menuBarItemDisabled()); } UIObject.ensureDebugId(element, "MenuItem/" + actionManager.getId(group) + "-" + enabled); }
/** Mouse Down handler */ public boolean onMouseDown() { if (enabled && hasVisibleItems) { element.setClassName(css.menuBarItemSelected()); pressed = true; actionSelectedHandler.onActionSelected(group); return true; } return false; }
/** Reset visual state of Menu Bar Item to default. */ public void setNormalState() { pressed = false; element.setClassName(css.menuBarItem()); }