@Override public void setFrame(Frame frame) { this.frame = frame; if (frame instanceof FrameImplementation) { ((FrameImplementation) frame).registerComponent(this); } }
protected void detachFromFrame(Component childComponent) { ((FrameImplementation) frame).unregisterComponent(childComponent); }
protected void setUiEventListeners(List<ApplicationListener> listeners) { this.uiEventListeners = listeners; if (listeners != null && !listeners.isEmpty()) { ((WindowImplementation) this.window).initUiEventListeners(); } }
protected String getFilterComponentName() { String filterComponentName = ComponentsHelper.getFilterComponentPath(filter); String[] parts = ValuePathHelper.parse(filterComponentName); if (parts.length > 1) { filterComponentName = ValuePathHelper.format(Arrays.copyOfRange(parts, 1, parts.length)); } return filterComponentName; }
private void addShortcut(final String actionId, KeyCombination keyCombination) { if (!allowEnterShortcut && (keyCombination.getModifiers() == null || keyCombination.getModifiers().length == 0) && keyCombination.getKey() == KeyCombination.Key.ENTER) { return; } for (Action oldAction : getActions()) { if (keyCombination.equals(oldAction.getShortcutCombination())) { removeShortcut(oldAction); } } shortcuts.put(actionId, attachShortcut(actionId, keyCombination)); }
@Override public void setId(String id) { if (!Objects.equals(this.id, id)) { if (frame != null) { ((FrameImplementation) frame).unregisterComponent(this); } this.id = id; AppUI ui = AppUI.getCurrent(); if (ui != null) { if (this.component != null && ui.isTestMode()) { this.component.setCubaId(id); } } if (frame != null) { ((FrameImplementation) frame).registerComponent(this); } } }
public void removeAction(Action action) { if (action != null) { removeShortcut(action); // find and assign alternative if (action.getShortcutCombination() != null) { addAlternativeShortcut(action.getShortcutCombination()); } } }
@Override @Nullable public Component getComponent(String id) { String[] elements = ValuePathHelper.parse(id); if (elements.length == 1) { return getOwnComponent(id); } else { throw new UnsupportedOperationException("Filter contains only one level of sub components"); } }
private void addAlternativeShortcut(KeyCombination kc) { Action alternativeAction = null; for (Action action : getActions()) { // find last action with same shortcut if (kc.equals(action.getShortcutCombination())) { alternativeAction = action; } } if (alternativeAction != null) { addShortcut(alternativeAction.getId(), alternativeAction.getShortcutCombination()); } }
@Override public void actionPerform(com.haulmont.cuba.gui.components.Component component) { if (component instanceof Component.BelongToFrame && component instanceof ListComponent) { Entity selectedItem = ((ListComponent) component).getSingleSelected(); if (selectedItem != null) { showInfo(selectedItem, selectedItem.getMetaClass(), (Component.BelongToFrame) component); } } }
protected void initShowInfoAction() { if (security.isSpecificPermitted(ShowInfoAction.ACTION_PERMISSION)) { if (getAction(ShowInfoAction.ACTION_ID) == null) { addAction(new ShowInfoAction()); } } }
protected void setUiEventListeners(List<ApplicationListener> listeners) { this.uiEventListeners = listeners; if (listeners != null && !listeners.isEmpty()) { ((FragmentImplementation) this.fragment).initUiEventListeners(); } }
private void removeShortcut(Action action) { String actionId = action.getId(); if (shortcuts.containsKey(actionId)) { detachShortcut(action, shortcuts.remove(actionId)); } }
public ShowInfoAction() { super(ACTION_ID); Messages messages = AppBeans.get(Messages.NAME); setCaption(messages.getMainMessage("table.showInfoAction")); }
@Override public void removeAction(@Nullable Action action) { if (actionList.remove(action)) { ActionMenuItemWrapper menuItemWrapper = null; for (ActionMenuItemWrapper menuItem : contextMenuItems) { if (menuItem.getAction() == action) { menuItemWrapper = menuItem; break; } } if (menuItemWrapper != null) { menuItemWrapper.setAction(null); contextMenu.removeItem(menuItemWrapper.getMenuItem()); } shortcutsDelegate.removeAction(action); } }
@Override public void setFrame(Frame frame) { this.frame = frame; if (frame instanceof FrameImplementation) { ((FrameImplementation) frame).registerComponent(this); } }
protected void initShowInfoAction() { if (security.isSpecificPermitted(ShowInfoAction.ACTION_PERMISSION)) { if (getAction(ShowInfoAction.ACTION_ID) == null) { addAction(new ShowInfoAction()); } } }
protected void attachToFrame(Component childComponent) { ((FrameImplementation) frame).registerComponent(childComponent); }
protected void attachToFrame(Component childComponent) { ((FrameImplementation) frame).registerComponent(childComponent); }