📄 accountitem.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;
import java.util.Vector;
//#############################################################################
/**
* This class creates users/groups objects that are loaded into the Groups tree.
*
* @author <p align=center>Ibsen Ramos-Bonilla
* <br>Copyright © 1997-@year@ by SMB GmbH. All Rights Reserved.</p>
*
* @version 1.0
*/
//#############################################################################
public class AccountItem {
/** The name associated with this item. */
private String name = null;
/** The id associated with this item. */
private int id = 0;
/** Identifies the associated item as part of the admin group. */
private boolean admin = false;
/** The list of children associated with this item. */
private Vector children = new Vector();
/**
* Overloaded constructor initializes the a new item.
*
* @param name - the item name.
* @param id - the item id.
*/
public AccountItem(String name, int id) {
//initialize the group item
this.name = name;
this.id = id;
}
/**
* This method returns the group item name.
*
* @return String - group item name.
*/
public String toString() {
return this.name;
}
/**
* This method returns the group item id.
*
* @return int - group item id.
*/
public int getId() {
return this.id;
}
/**
* This method returns a flag indicating if the account is admin.
*
* @return boolean - TRUE = is admin.
* FALSE = is not admin.
*/
public boolean isAdmin() {
return this.admin;
}
/**
* This method returns number of children for this item.
*
* @param item - the selected child.
* @return int - number of children.
*/
public int getIndexOfChild(AccountItem item) {
//index of selected child
if (this.children != null)
return this.children.indexOf(item);
//no index for selected child
else
return -1;
}
/**
* This method returns the specific child at a selected location.
*
* @param i - the selected position of a child.
* @return GroupItem - child.
*/
public AccountItem getChildAt(int i) {
//child at selected location
if (this.children != null)
return (AccountItem) this.children.elementAt(i);
//no child at selected location
else
return null;
}
/**
* This method returns number of children for this item.
*
* @return int - number of children.
*/
public int getChildCount() {
//children available
if (this.children != null)
return this.children.size();
//no children available
else
return 0;
}
/**
* This method sets this object child objects.
*
* @param children - item children.
*/
public void setChildren(Vector children) {
this.children = children;
if (this.children == null)
this.children = new Vector();
}
/**
* This method returns this object child objects.
*
* @return Vector - object item children.
*/
public Vector getChildren() {
return this.children;
}
/**
* This method adds a new children node to the parent.
*
* @param item - the account item node being added to the parent.
*/
public void addChild(AccountItem item) {
this.children.add(item);
}
/**
* This method removes a children node from the parent.
*
* @param item - the account item node being removed from the parent.
*/
public void removeChild(AccountItem item) {
this.children.remove(item);
}
} //--------------------------------- E O F -----------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -