⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 groupitem.java

📁 Java的面向对象数据库系统的源代码
💻 JAVA
字号:
//// You can redistribute this software and/or modify it under the terms of
// the Ozone Library License version 1 published by ozone-db.org.
//
// The original code and portions created by SMB are
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
//
package org.ozoneDB.adminGui.feature.account.groups;

import java.util.Vector;

import org.ozoneDB.adminGui.feature.account.AccountItem;
import org.ozoneDB.adminGui.feature.account.users.UserItem;


//#############################################################################
/**
 * This class creates groups objects that are loaded into the Groups tree.
 *
 * @author  <p align=center>Ibsen Ramos-Bonilla
 * <br>Copyright &copy 1997-@year@ by SMB GmbH. All Rights Reserved.</p>
 *
 * @version 1.0
 */
//#############################################################################

public class GroupItem extends AccountItem {

    /**
     * Overloaded constructor initializes the a new item.
     *
     * @param name - the item name.
     * @param id - the item id.
     */
    public GroupItem(String name, int id) {
        super(name, id);
    }

    /**
     * This method returns a list of names of users assigned to this group.
     *
     * @return Vector - list of account names.
     */
    public Vector getAssignedUsers() {
        Vector users = new Vector();

        //get all the assigned account names
        for (int i = 0; i < this.getChildCount(); i++) {
            users.add(this.getChildAt(i).toString());
        }

        return users;
    }

    /**
     * This method returns an account assigned to this group based on the account
     * name.
     *
     * @param name - the account name to look for.
     * @return UserItem - the account node.
     */
    public UserItem getUser(String name) {
        UserItem uItem = null;

        if (name != null) {
            for (int i = 0; i < this.getChildCount(); i++) {
                if (this.getChildAt(i).toString().equals(name)) {
                    uItem = (UserItem) this.getChildAt(i);
                    break;
                }
            }
        }
        return uItem;
    }

} //--------------------------------- E O F -----------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -