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);
    }
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 ) ; }
initializes table.

@param roles list of user