001: /**
002: * Copyright 2005 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: */package com.sun.portal.admin.console.search;
013:
014: import java.util.*;
015:
016: public class ResourceDescriptionAttributeBean {
017:
018: public String key = "";
019: public List values = new ArrayList();
020: public List newValues = new ArrayList();
021: public boolean apply = false;
022: public boolean editable = false;
023:
024: public void initialize(String key, List values, boolean editable) {
025: this .key = key;
026: this .editable = editable;
027: this .apply = false;
028:
029: this .values = new ArrayList();
030: this .newValues = new ArrayList();
031: int total = values.size();
032: if (total > 0
033: && (total != 1 || !((String) values.get(0)).equals(""))) {
034: for (int index = 0; index < total; index++) {
035: String value = (String) values.get(index);
036: this .values.add(value);
037: this .newValues.add(value);
038: }
039: }
040: }
041:
042: public String getKey() {
043: return key;
044: }
045:
046: public void setKey(String key) {
047: this .key = key;
048: }
049:
050: public String[] getValues() {
051: int total = values.size();
052: String[] strings = new String[total];
053: for (int index = 0; index < total; index++) {
054: strings[index] = (String) values.get(index);
055: }
056: return strings;
057: }
058:
059: public void setValues(String[] values) {
060: this .values = new ArrayList();
061: for (int index = 0; index < values.length; index++) {
062: this .values.set(index, values[index]);
063: }
064: }
065:
066: public String getValueList() {
067: if (values.size() == 0) {
068: return "";
069: } else {
070: return values.toString();
071: }
072: }
073:
074: public String[] getNewValues() {
075: int total = newValues.size();
076: String[] strings = new String[total];
077: for (int index = 0; index < total; index++) {
078: strings[index] = (String) newValues.get(index);
079: }
080: return strings;
081: }
082:
083: public void setNewValues(String[] newValues) {
084: this .newValues = new ArrayList();
085: for (int index = 0; index < newValues.length; index++) {
086: this .newValues.set(index, newValues[index]);
087: }
088: }
089:
090: public String getNewValueList() {
091: if (newValues.size() == 0) {
092: return "";
093: } else {
094: return newValues.toString();
095: }
096: }
097:
098: public boolean getEditable() {
099: return editable;
100: }
101:
102: public void setEditable(boolean value) {
103: this .editable = value;
104: }
105:
106: public boolean getApply() {
107: return apply;
108: }
109:
110: public void setApply(boolean apply) {
111: this .apply = apply;
112: }
113:
114: public boolean changed() {
115: return (newValues.equals(values)) ? false : true;
116: }
117:
118: }
|