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

📄 rowselectbean.java

📁 IBM RSA下的JSF开发示例
💻 JAVA
字号:
/* RowSelectBean.java
 * Created on Jan 3, 2005
 *
 * A Bean to store which rows of a data table are selected to be used with Row Action Select.
 */
package com.ibm.samples.rowActionSelect;

import java.util.Collection;
import java.util.ArrayList;

/**
 * @author cmjaun
 */
public class RowSelectBean {

	private boolean[] boolRows = new boolean[50]; // boolean array must be large enough to hold all rows
	private int[] intRows = new int[0]; // int array will be created large enough to hold all selected rows
	private Collection listRows = new ArrayList(); // a collection to hold Map objects
	private EmployeeBean[] employees = new EmployeeBean[4];
	
	public RowSelectBean() {
		// Add Values to the Employee Bean
		
		EmployeeBean e1 = new EmployeeBean();
		e1.setName("Mike");
		e1.setId(114326);
		e1.setDepartment("Shipping");
		e1.setSelected(false);
		
		EmployeeBean e2 = new EmployeeBean();
		e2.setName("Jason");
		e2.setId(164643);
		e2.setDepartment("PR");
		e2.setSelected(false);
		
		EmployeeBean e3 = new EmployeeBean();
		e3.setName("Stephanie");
		e3.setId(264673);
		e3.setDepartment("Executive");
		e3.setSelected(false);
		
		EmployeeBean e4 = new EmployeeBean();
		e4.setName("Sandra");
		e4.setId(263473);
		e4.setDepartment("Sales");
		e4.setSelected(false);
		
		employees[0] = e1;
		employees[1] = e2;
		employees[2] = e3;
		employees[3] = e4;
	}
	/**
	 * @return Returns the boolRows.
	 */
	public boolean[] getBoolRows() {
		return boolRows;
	}
	/**
	 * @param boolRows The boolRows to set.
	 */
	public void setBoolRows(boolean[] boolRows) {
		this.boolRows = boolRows;
	}
	/**
	 * @return Returns the intRows.
	 */
	public int[] getIntRows() {
		return intRows;
	}
	/**
	 * @param intRows The intRows to set.
	 */
	public void setIntRows(int[] intRows) {
		this.intRows = intRows;
	}
	/*
	 * @return Returns the listRows.
	 */
	public Collection getListRows() {
		return listRows;
	}
	/**
	 * @param listRows The listRows to set.
	 */
	public void setListRows(Collection listRows) {
		this.listRows = listRows;
	}
	/**
	 * @return Returns the employees.
	 */
	public EmployeeBean[] getEmployees() {
		return employees;
	}
	/**
	 * @param employees The employees to set.
	 */
	public void setEmployees(EmployeeBean[] employees) {
		this.employees = employees;
	}
	/**
	 * The deleteEmployee method is called to remove an employee from the array of EmployeeBean beans if
	 * they were selected by the user.
	 */
	public void deleteEmployee() {
		int counter = 0;
		EmployeeBean[] tempBean = new EmployeeBean[ employees.length ];
		for( int i = 0; i < employees.length; i++ ) {
			if( !(employees[i].isSelected()) ) {
				tempBean[counter] = employees[i];
				counter++;
			}
		}
		employees = new EmployeeBean[counter];
		for( int j = 0; j < counter; j++) {
			employees[j] = tempBean[j];
		}
	}
}

⌨️ 快捷键说明

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