Search in sources :

Example 1 with UserGroupMember

use of net.sourceforge.processdash.team.group.UserGroupMember in project processdash by dtuma.

the class GroupFilterMenu method setSelectedItem.

public void setSelectedItem(UserFilter selection) {
    if (selection instanceof UserGroup) {
        UserGroup g = (UserGroup) selection;
        setIcon(groupIcon);
        setText(g.toString());
    } else if (selection instanceof UserGroupMember) {
        UserGroupMember m = (UserGroupMember) selection;
        setIcon(personIcon);
        setText(m.toString());
    }
    boolean isChange = !NullSafeObjectUtils.EQ(selectedItem, selection);
    this.selectedItem = selection;
    if (isChange) {
        for (ChangeListener l : listeners.getListeners(ChangeListener.class)) l.stateChanged(new ChangeEvent(this));
    }
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) ChangeListener(javax.swing.event.ChangeListener) UserGroupMember(net.sourceforge.processdash.team.group.UserGroupMember) UserGroup(net.sourceforge.processdash.team.group.UserGroup)

Example 2 with UserGroupMember

use of net.sourceforge.processdash.team.group.UserGroupMember in project processdash by dtuma.

the class GroupMembershipSelector method setData.

/**
     * Update this object to begin a new editing session.
     * 
     * @param allPeople
     *            a list of all known individuals
     * @param selected
     *            a list of the individuals who should initially be selected
     */
public void setData(Set<UserGroupMember> allPeople, UserGroup selected) {
    // configure the checkboxes to be read-only, if needed
    setReadOnly(readOnlyCode != null && !selected.isCustom());
    // make a list of the people to display, and store it in the data model
    Set<UserGroupMember> fullSet = new HashSet();
    fullSet.addAll(allPeople);
    fullSet.addAll(selected.getMembers());
    List<UserGroupMember> fullList = new ArrayList<UserGroupMember>(fullSet);
    Collections.sort(fullList);
    setItems(fullList.toArray());
    // initialize the checkboxes to reflect the selected individuals
    for (int i = fullList.size(); i-- > 0; ) {
        UserGroupMember m = fullList.get(i);
        setChecked(i, selected.getMembers().contains(m));
    }
    clearDirty();
}
Also used : ArrayList(java.util.ArrayList) UserGroupMember(net.sourceforge.processdash.team.group.UserGroupMember) HashSet(java.util.HashSet)

Example 3 with UserGroupMember

use of net.sourceforge.processdash.team.group.UserGroupMember in project processdash by dtuma.

the class PlanSummaryNameHeader method writeUserGroupIcon.

/** Print text and icon for choosing a user group
     */
private void writeUserGroupIcon(String projectRoot) {
    if (!UserGroupManager.getInstance().isFilteringAvailable())
        return;
    boolean exporting = isExporting();
    if (!exporting)
        writeHyperlink("selectGroupFilter", getSnippetParams(false, false));
    // retrieve information about the filter that is in effect
    UserFilter f = UserGroupManagerDash.getInstance().getLocalFilter(projectRoot);
    boolean isPrivacyViolation = f instanceof UserGroupPrivacyBlock;
    // display an icon to represent this group filter
    out.print("<img border='0' src='/Images/userGroup");
    if (isPrivacyViolation)
        out.print("Privacy");
    else if (f instanceof UserGroupMember)
        out.print("Member");
    out.print(".png' ");
    if (isPrivacyViolation)
        out.print("title='Group filter blocked to protect data privacy' ");
    else if (!exporting)
        out.print("title='Filter to group' ");
    else if (!UserGroup.isEveryone(f))
        out.print("title='Group filter is in effect' ");
    out.print("style='margin: 0px 2px 0px 10px; position:relative; top:3px; width:22px; height:22px'>");
    if (!exporting)
        out.print("</a>");
    // display the name of the filter
    if (isPrivacyViolation)
        out.print("<span style='color:#888; font-weight:normal; text-decoration:line-through'>");
    out.print(HTMLUtils.escapeEntities(f.toString()));
    if (isPrivacyViolation)
        out.print("</span>");
    // display form elements to refresh the page as needed
    out.print("<input type='hidden' name='[DB_User_Group/Name]!'>");
    out.print("<input type='hidden' name='[User_Group/Privacy_Violation]!'>");
}
Also used : UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock) UserGroupMember(net.sourceforge.processdash.team.group.UserGroupMember)

Example 4 with UserGroupMember

use of net.sourceforge.processdash.team.group.UserGroupMember in project processdash by dtuma.

the class EVReport method printFilterInfo.

public static void printFilterInfo(PrintWriter out, EVTaskFilter filter, EVReportSettings settings, boolean exporting, boolean textOnly) {
    String labelFilter = (filter == null ? null : filter.getAttribute(EVLabelFilter.LABEL_FILTER_ATTR));
    String pathFilter = (filter == null ? null : filter.getAttribute(EVHierarchicalFilter.HIER_FILTER_ATTR));
    UserFilter groupFilter = (settings == null ? null : settings.getUserGroupFilter());
    if (labelFilter == null && pathFilter == null && groupFilter == null)
        return;
    out.print("<h2 style='position:relative; left:-10px'>");
    if (labelFilter != null) {
        if (!textOnly)
            out.print("<img border=0 src='/Images/filter.png' " + "style='margin: 0px 2px 0px 10px; position:relative; top:3px' " + "width='16' height='23' title=\"");
        out.print(resources.getHTML("Report.Filter_Tooltip"));
        out.print(textOnly ? " - " : "\">");
        out.print(HTMLUtils.escapeEntities(labelFilter));
    }
    if (pathFilter != null) {
        if (!textOnly)
            out.print("<img border=0 src='/Images/hier.png' " + "style='margin: 0px 2px 0px 10px; position:relative; top:3px' " + "width='16' height='23' title=\"");
        out.print(resources.getHTML("Report.Filter_Tooltip"));
        out.print(textOnly ? " - " : "\">");
        out.print(HTMLUtils.escapeEntities(pathFilter));
    }
    if (groupFilter != null) {
        boolean isPrivacyViolation = groupFilter instanceof UserGroupPrivacyBlock;
        // display an icon to represent this group filter
        if (!textOnly) {
            boolean showGroupHyperlink = !exporting && (settings.getParameters().containsKey(//
            EVReportSettings.GROUP_FILTER_PARAM) || settings.getParameters().containsKey(EVReportSettings.GROUP_FILTER_AUTO_PARAM));
            if (showGroupHyperlink)
                out.print("<a href='../team/setup/selectGroupFilter'>");
            out.print("<img border=0 src='/Images/userGroup");
            if (isPrivacyViolation)
                out.print("Privacy");
            else if (groupFilter instanceof UserGroupMember)
                out.print("Member");
            out.print(".png' ");
            if (isPrivacyViolation)
                out.print("title='Group filter blocked to protect data privacy' ");
            else if (showGroupHyperlink)
                out.print("title='Filter to group' ");
            out.print("style='margin: 0px 2px 0px 10px; position:relative; top:3px' " + "width='23' height='23'>");
            if (showGroupHyperlink)
                out.print("</a>");
        }
        // display the name of the filter
        if (isPrivacyViolation)
            out.print("<span style='color:#888; font-weight:normal; text-decoration:line-through'>");
        out.print(HTMLUtils.escapeEntities(groupFilter.toString()));
        if (isPrivacyViolation)
            out.print("</span>");
    }
    out.println("</h2>");
}
Also used : UserFilter(net.sourceforge.processdash.team.group.UserFilter) UserGroupPrivacyBlock(net.sourceforge.processdash.team.group.UserGroupPrivacyBlock) UserGroupMember(net.sourceforge.processdash.team.group.UserGroupMember)

Aggregations

UserGroupMember (net.sourceforge.processdash.team.group.UserGroupMember)4 UserFilter (net.sourceforge.processdash.team.group.UserFilter)2 UserGroupPrivacyBlock (net.sourceforge.processdash.team.group.UserGroupPrivacyBlock)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ChangeListener (javax.swing.event.ChangeListener)1 UserGroup (net.sourceforge.processdash.team.group.UserGroup)1