Opens the context menu of the given table.<p>

@param event the click event
@param table the table
548211
public void openForTable(ItemClickEvent event, Table table) {

        fireEvent(new ContextMenuOpenedOnTableRowEvent(this, table, event.getItemId(), event.getPropertyId()));
        open(event.getClientX(), event.getClientY());

    }
430002
public void openForTree(ItemClickEvent event, Tree tree) {

        fireEvent(new ContextMenuOpenedOnTreeItemEvent(this, tree, event.getItemId()));
        open(event.getClientX(), event.getClientY());
    }
288935
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {

        if (!event.isCtrlKey() && !event.isShiftKey()) {

            changeValueIfNotMultiSelect(itemId);

            // don't interfere with multi-selection using control key
            if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
                m_menu.setEntries(getMenuEntries(), getSearchIndexNames());
                m_menu.openForTable(event, itemId, propertyId, this);
            } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.Name.equals(propertyId)) {
                showSourcesWindow(((I_CmsSearchIndex)((Set<?>)getValue()).iterator().next()).getName());
            }
        }
    }
609471
protected void init(boolean showAll) {

        m_menu = new CmsContextMenu();
        m_menu.setAsTableContextMenu(this);

        m_container = new IndexedContainer();

        for (TableProperty prop : TableProperty.values()) {
            m_container.addContainerProperty(prop, prop.getType(), prop.getDefault());
            setColumnHeader(prop, prop.getName());
        }
        m_app.addUserContainerProperties(m_container);
        setContainerDataSource(m_container);
        setItemIconPropertyId(TableProperty.Icon);
        setRowHeaderMode(RowHeaderMode.ICON_ONLY);

        setColumnWidth(null, 40);
        setColumnWidth(TableProperty.STATUS, 100);
        setSelectable(true);
        setMultiSelect(true);

        setVisibleColumns(TableProperty.Name, TableProperty.OU);

        fillContainer(showAll);

        addItemClickListener(new ItemClickListener() {

            private static final long serialVersionUID = 4807195510202231174L;

            @SuppressWarnings("unchecked")
            public void itemClick(ItemClickEvent event) {

                changeValueIfNotMultiSelect(event.getItemId());

                if (event.getButton().equals(MouseButton.RIGHT) || (event.getPropertyId() == null)) {
                    Set<String> userIds = new HashSet<String>();
                    for (CmsUser user : (Set<CmsUser>)getValue()) {
                        userIds.add(user.getId().getStringValue());
                    }

                    m_menu.setEntries(getMenuEntries(), userIds);
                    m_menu.openForTable(event, event.getItemId(), event.getPropertyId(), CmsUserTable.this);
                } else if (event.getButton().equals(MouseButton.LEFT)
                    && TableProperty.Name.equals(event.getPropertyId())) {
                    CmsUser user = ((Set<CmsUser>)getValue()).iterator().next();
                    try {
                        openInfoDialog(user.getId());
                    } catch (CmsException e) {
                        LOG.error("Error on opening user info dialog", e);
                    }
                }

            }

        });
        setCellStyleGenerator(new CellStyleGenerator() {

            private static final long serialVersionUID = 4685652851810828147L;

            public String getStyle(Table source, Object itemId, Object propertyId) {

                if (TableProperty.STATUS.equals(propertyId)) {
                    return getStatusStyleForItem(source.getItem(itemId), (CmsUser)itemId);

                }
                String css = " ";

                if (((Boolean)(source.getItem(itemId).getItemProperty(
                    TableProperty.FROMOTHEROU).getValue())).booleanValue()) {
                    css += OpenCmsTheme.EXPIRED;
                }

                if (TableProperty.Name.equals(propertyId)) {
                    css += " " + OpenCmsTheme.HOVER_COLUMN;
                }

                if (((Boolean)source.getItem(itemId).getItemProperty(
                    TableProperty.INDIRECT).getValue()).booleanValue()) {
                    return css + " " + OpenCmsTheme.TABLE_CELL_DISABLED;
                }
                return css.length() == 1 ? null : css;
            }

            private String getStatusStyleForItem(Item item, CmsUser user) {

                if (((Boolean)item.getItemProperty(TableProperty.DISABLED).getValue()).booleanValue()) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_GRAY;
                }

                if (((Boolean)item.getItemProperty(TableProperty.NEWUSER).getValue()).booleanValue()) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_BLUE;
                }

                if (OpenCms.getLoginManager().isUserTempDisabled(user.getName())) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_RED;
                }

                if (isUserPasswordReset(user)) {
                    return OpenCmsTheme.TABLE_COLUMN_BOX_ORANGE;
                }

                return OpenCmsTheme.TABLE_COLUMN_BOX_GREEN;
            }
        });
        addGeneratedColumn(TableProperty.STATUS, new ColumnGenerator() {

            private static final long serialVersionUID = -2144476865774782965L;

            public Object generateCell(Table source, Object itemId, Object columnId) {

                return getStatus(
                    (CmsUser)itemId,
                    ((Boolean)source.getItem(itemId).getItemProperty(TableProperty.DISABLED).getValue()).booleanValue(),
                    ((Boolean)source.getItem(itemId).getItemProperty(TableProperty.NEWUSER).getValue()).booleanValue());

            }

        });
        addGeneratedColumn(TableProperty.LastLogin, new ColumnGenerator() {

            private static final long serialVersionUID = -6781906011584975559L;

            public Object generateCell(Table source, Object itemId, Object columnId) {

                long lastLogin = ((Long)source.getItem(itemId).getItemProperty(
                    TableProperty.LastLogin).getValue()).longValue();
                return lastLogin == 0L
                ? CmsVaadinUtils.getMessageText(Messages.GUI_USERMANAGEMENT_USER_NEVER_LOGGED_IN_0)
                : CmsDateUtil.getDateTime(new Date(lastLogin), DateFormat.SHORT, A_CmsUI.get().getLocale());

            }

        });

        addGeneratedColumn(TableProperty.Created, new ColumnGenerator() {

            private static final long serialVersionUID = -6781906011584975559L;

            public Object generateCell(Table source, Object itemId, Object columnId) {

                long created = ((Long)source.getItem(itemId).getItemProperty(
                    TableProperty.Created).getValue()).longValue();
                return created == 0L
                ? ""
                : CmsDateUtil.getDateTime(new Date(created), DateFormat.SHORT, A_CmsUI.get().getLocale());

            }

        });

        setItemDescriptionGenerator(new ItemDescriptionGenerator() {

            private static final long serialVersionUID = 7367011213487089661L;

            public String generateDescription(Component source, Object itemId, Object propertyId) {

                if (TableProperty.STATUS.equals(propertyId)) {

                    return getStatusHelp(
                        (CmsUser)itemId,
                        ((Boolean)((Table)source).getItem(itemId).getItemProperty(
                            TableProperty.DISABLED).getValue()).booleanValue(),
                        ((Boolean)((Table)source).getItem(itemId).getItemProperty(
                            TableProperty.NEWUSER).getValue()).booleanValue());
                }
                return null;
            }
        });
        setVisibleColumns(
            TableProperty.STATUS,
            TableProperty.Name,
            TableProperty.FullName,
            TableProperty.OU,
            TableProperty.LastLogin,
            TableProperty.Created);
    }
1104463
def contextMenuEvent(self, event):
        """"""
        if self.model.showndata:
            self.refresh_menu()
            self.menu.popup(event.globalPos())
            event.accept()
        else:
            self.empty_ws_menu.popup(event.globalPos())
            event.accept()
856198
public void onClickOpen(CmsSitemapTreeNode node) {

        if (node.isOpen()) {
            node.setOpen(false);
        } else {
            if (!m_alreadyLoaded.containsKey(node)) {
                Object nodeData = node.getData();
                List<CmsSitemapTreeNodeData> children = m_treeDataProvider.getChildren(
                    (CmsSitemapTreeNodeData)nodeData);
                m_alreadyLoaded.put(node, null);
                if (children.isEmpty()) {
                    node.setOpenerVisible(false);
                } else {
                    for (CmsSitemapTreeNodeData child : children) {
                        CmsSitemapTreeNode childNode = createNode(child);
                        childNode.setData(child);
                        initEventHandlers(childNode);
                        node.getChildren().addComponent(childNode);
                    }
                }
            }
            node.setOpen(true);
        }
    }
515770
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {

        setValue(null);
        select(itemId);
        if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
            m_menu.setEntries(
                getMenuEntries(),
                Collections.singleton((((CmsPublishJobBase)getValue()).getPublishHistoryId()).getStringValue()));
            m_menu.openForTable(event, itemId, propertyId, CmsQueuedTable.this);
        } else if (event.getButton().equals(MouseButton.LEFT) && PROP_RESOURCES.equals(propertyId)) {
            showResourceDialog(((CmsPublishJobBase)getValue()).getPublishHistoryId().getStringValue());
        } else if (event.getButton().equals(MouseButton.LEFT) && PROP_PROJECT.equals(propertyId)) {
            if (!(getValue() instanceof CmsPublishJobEnqueued)) {
                showReportDialog((((CmsPublishJobBase)getValue()).getPublishHistoryId().getStringValue()));
            }
        }
    }
1016924
public void cmsEvent(CmsEvent event) {

        switch (event.getType()) {
            case I_CmsEventListener.EVENT_CLEAR_CACHES:
                flushMessageCache();
                m_editorDisplayOptions.clearCache();
                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_EVENT_CLEAR_CACHES_0));
                }
                break;
            default: // no operation
        }
    }
759264
void handleFileItemClick(ItemClickEvent event) {

        if (isEditing()) {
            stopEdit();

        } else if (!event.isCtrlKey() && !event.isShiftKey()) {
            // don't interfere with multi-selection using control key
            String itemId = (String)event.getItemId();
            CmsUUID structureId = getUUIDFromItemID(itemId);
            boolean openedFolder = false;
            if (event.getButton().equals(MouseButton.RIGHT)) {
                handleSelection(itemId);
                openContextMenu(event);
            } else {
                if ((event.getPropertyId() == null)
                    || CmsResourceTableProperty.PROPERTY_TYPE_ICON.equals(event.getPropertyId())) {
                    handleSelection(itemId);
                    openContextMenu(event);
                } else {
                    if (m_actionColumnProperty.equals(event.getPropertyId())) {
                        Boolean isFolder = (Boolean)event.getItem().getItemProperty(
                            CmsResourceTableProperty.PROPERTY_IS_FOLDER).getValue();
                        if ((isFolder != null) && isFolder.booleanValue()) {
                            if (m_folderSelectHandler != null) {
                                m_folderSelectHandler.onFolderSelect(structureId);
                            }
                            openedFolder = true;
                        } else {
                            try {
                                CmsObject cms = A_CmsUI.getCmsObject();
                                CmsResource res = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
                                m_currentResources = Collections.singletonList(res);
                                I_CmsDialogContext context = m_contextProvider.getDialogContext();
                                I_CmsDefaultAction action = OpenCms.getWorkplaceAppManager().getDefaultAction(
                                    context,
                                    m_menuBuilder);
                                if (action != null) {
                                    action.executeAction(context);
                                    return;
                                }
                            } catch (CmsVfsResourceNotFoundException e) {
                                LOG.info(e.getLocalizedMessage(), e);
                            } catch (CmsException e) {
                                LOG.error(e.getLocalizedMessage(), e);
                            }
                        }
                    } else {
                        I_CmsDialogContext context = m_contextProvider.getDialogContext();
                        if ((m_currentResources.size() == 1)
                            && m_currentResources.get(0).getStructureId().equals(structureId)
                            && (context instanceof I_CmsEditPropertyContext)
                            && ((I_CmsEditPropertyContext)context).isPropertyEditable(event.getPropertyId())) {

                            ((I_CmsEditPropertyContext)context).editProperty(event.getPropertyId());
                        }
                    }
                }
            }
            // update the item on click to show any available changes
            if (!openedFolder) {
                update(Collections.singletonList(structureId), false);
            }
        }
    }
872083
def OnTableChanged(self, event):
        """"""

        if hasattr(event, 'table'):
            self.SetValue(event.table)

        wx.TextCtrl.SetInsertionPoint(self, self.cursor_pos)

        event.Skip()
1155794
private void paintTableActions(final WTable table, final WebXmlRenderContext renderContext) {
		XmlStringBuilder xml = renderContext.getWriter();
		List<WButton> tableActions = table.getActions();

		if (!tableActions.isEmpty()) {
			boolean hasActions = false;

			for (WButton button : tableActions) {
				if (!button.isVisible()) {
					continue;
				}

				if (!hasActions) {
					hasActions = true;
					xml.appendTag("ui:actions");
				}

				xml.appendTag("ui:action");

				List<WTable.ActionConstraint> constraints = table.getActionConstraints(button);

				if (constraints != null) {
					for (WTable.ActionConstraint constraint : constraints) {
						int minRows = constraint.getMinSelectedRowCount();
						int maxRows = constraint.getMaxSelectedRowCount();
						String message = constraint.getMessage();
						String type = constraint.isError() ? "error" : "warning";

						xml.appendTagOpen("ui:condition");
						xml.appendOptionalAttribute("minSelectedRows", minRows > 0, minRows);
						xml.appendOptionalAttribute("maxSelectedRows", maxRows > 0, maxRows);
						xml.appendAttribute("selectedOnOther", this.selectedOnOther);
						xml.appendAttribute("type", type);
						xml.appendAttribute("message", I18nUtilities.format(null, message));
						xml.appendEnd();
					}
				}

				button.paint(renderContext);

				xml.appendEndTag("ui:action");
			}

			if (hasActions) {
				xml.appendEndTag("ui:actions");
			}
		}
	}
505728
public void openEditDialog(String siteRoot) {

        CmsEditSiteForm form;
        String caption;
        if (siteRoot != null) {
            form = new CmsEditSiteForm(m_rootCms, this, siteRoot);
            caption = CmsVaadinUtils.getMessageText(
                Messages.GUI_SITE_CONFIGURATION_EDIT_1,
                m_sitesTable.getContainer().getItem(siteRoot).getItemProperty(TableProperty.Title).getValue());
        } else {
            form = new CmsEditSiteForm(m_rootCms, this);
            caption = CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ADD_0);
        }
        openDialog(form, caption);
    }
993416
private void init(List<CmsRole> roles) {

        CmsRole.applySystemRoleOrder(roles);
        m_menu = new CmsContextMenu();
        m_menu.setAsTableContextMenu(this);

        m_container = new IndexedContainer();

        for (TableProperty prop : TableProperty.values()) {
            m_container.addContainerProperty(prop, prop.getType(), prop.getDefault());
            setColumnHeader(prop, prop.getName());
        }
        setContainerDataSource(m_container);
        setItemIconPropertyId(TableProperty.Icon);
        setRowHeaderMode(RowHeaderMode.ICON_ONLY);

        setColumnWidth(null, 40);
        setSelectable(true);

        setVisibleColumns(TableProperty.Name, TableProperty.OU);

        for (CmsRole role : roles) {

            Item item = m_container.addItem(role);
            item.getItemProperty(TableProperty.Name).setValue(role.getName(A_CmsUI.get().getLocale()));
            item.getItemProperty(TableProperty.Description).setValue(role.getDescription(A_CmsUI.get().getLocale()));
            item.getItemProperty(TableProperty.OU).setValue(role.getOuFqn());
        }

        addItemClickListener(new ItemClickListener() {

            private static final long serialVersionUID = 4807195510202231174L;

            public void itemClick(ItemClickEvent event) {

                setValue(null);
                select(event.getItemId());
                if (event.getButton().equals(MouseButton.RIGHT) || (event.getPropertyId() == null)) {
                    m_menu.setEntries(
                        getMenuEntries(),
                        Collections.singleton(((CmsRole)getValue()).getId().getStringValue()));
                    m_menu.openForTable(event, event.getItemId(), event.getPropertyId(), CmsRoleTable.this);
                } else if (event.getButton().equals(MouseButton.LEFT)
                    && event.getPropertyId().equals(TableProperty.Name)) {
                    updateApp((CmsRole)getValue());
                }

            }

        });
        setCellStyleGenerator(new CellStyleGenerator() {

            private static final long serialVersionUID = 1L;

            public String getStyle(Table source, Object itemId, Object propertyId) {

                if (TableProperty.Name.equals(propertyId)) {
                    return " " + OpenCmsTheme.HOVER_COLUMN;
                }

                return "";
            }
        });
        setVisibleColumns(TableProperty.Name, TableProperty.Description, TableProperty.OU);
    }
1165960
def contextMenuEvent(self, event):
        
        if self.contextMenuPolicy() == Qt.DefaultContextMenu:
            self.showMenu(event.pos())
        else:
            super(XOrbTreeWidget, self).contextMenuEvent(event)
338637
public void onClick(ClickEvent event) {
		GwtCommandDispatcher dispatcher = GwtCommandDispatcher.getInstance();
		SsecAccess.logout();
		dispatcher.logout();
	}
1351090
private void initContextMenu() {

        m_contextMenu.removeItems();
        MenuItem main = m_contextMenu.addItem("", null);
        main.setIcon(FontOpenCms.CONTEXT_MENU);
        main.setDescription(CmsVaadinUtils.getMessageText(Messages.GUI_MENU_TITLE_0));
        CmsContextMenuTreeBuilder treeBuilder = new CmsContextMenuTreeBuilder(getDialogContext());
        CmsTreeNode<I_CmsContextMenuItem> tree = treeBuilder.buildAll(
            OpenCms.getWorkplaceAppManager().getMenuItemProvider().getMenuItems());
        for (CmsTreeNode<I_CmsContextMenuItem> node : tree.getChildren()) {
            createMenuEntry(main, node, treeBuilder);
        }
    }
720108
private void showContextMenu(ContextMenuEvent e) {
        ContextMenu menu = view.getContextMenu();
        double xOffset = view.getContextMenuXOffset();
        double yOffset = view.getContextMenuYOffset();

        menu.show(view, e.getScreenX() + xOffset, e.getScreenY() + yOffset);
    }