package com.lgnortel.r4.r4equipment.management.olt.facility;
import java.awt.Color;
import java.util.Vector;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.TableColumn;
import com.lgnortel.r4.r4equipment.common.CheckBoxCellRenderer;
import com.lgnortel.r4.r4equipment.common.ManagementTableIF;
import com.lgnortel.r4.r4equipment.common.R4TableModel;
import com.lgnortel.r4.r4equipment.common.SimpleChildView;
import com.lgnortel.r4.r4equipment.common.TestLedCellEditor;
/**
* Copyright (c) 2010 LG-Nortel, Inc. All Rights Reserved.
*
* CONFIDENTIALITY AND LIMITED USE: This software, including any software of <br>
* third parties embodied herein, contains code, information, data and concepts <br>
* which are confidential and/or proprietary to LG-Nortel and such third <br>
* parties. This software is licensed for use solely in accordance with the <br>
* terms and conditions of the applicable license agreement with LG-Nortel or <br>
* its authorized distributor, and not for any other use or purpose. No <br>
* redistribution of this software by any party is permitted. <br>
*
* Title: FacilityBootEnvView.java<br>
* Description: <br>
* Copyright: Copyright(c) 2010 LG-NORTEL ALL Rights Reserved<br>
* Company: LG-Nortel<br>
*
* @author Jonghwa, Lee
* @version 1.0
* @created 2010. 1. 26.
* @modified 2010. 1. 26.
* @product EFA R4.0 EMS
* @sw_block Client Block
*/
public class FacilityBootEnvView extends SimpleChildView {
/**
*
*/
private static final long serialVersionUID = 6304818681039366954L;
public static final int COLUMN_SLOT = 0;
public static final int COLUMN_IMAGE = 1;
public static final int COLUMN_STARTUP = 3;
public static final int COLUMN_DEFAULT_BANK = 4;
public static final int COLUMN_SET = 9;
public static final String SOFTWARE = "sortware";
public FacilityBootEnvView(String title, ManagementTableIF controller) {
super(title, controller);
}
@Override
protected JScrollPane createTable(Vector<Object> header) {
model = new R4TableModel(header);
table.setModel(model);
table.setBackground(Color.white);
table.setSelectionBackground(new Color(204, 204, 255));
setTableCellCondition();
CheckBoxCellRenderer check_renderer = new CheckBoxCellRenderer();
TableColumn column = null;
for (int i = 0, n = model.getColumnCount(); i < n; i++) {
column = table.getColumnModel().getColumn(i);
if (i == COLUMN_SET) {
column.setCellEditor(new TestLedCellEditor(table));
column.setCellRenderer(check_renderer);
}
model.removeColumnCellEditable(i);
}
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
JScrollPane pane = new JScrollPane(table);
return pane;
}
protected void refresh(Object[] element) {
super.refresh(element);
if (element == null) {
return;
}
for(int row = 0, maxRow = model.getRowCount(); row < maxRow; row++) {
String image = model.getValueAt(row, COLUMN_IMAGE).toString();
if (image.equals("software")) {
model.setCellEditable(row, COLUMN_DEFAULT_BANK);
model.setCellEditable(row, COLUMN_STARTUP);
model.setCellEditable(row, COLUMN_SET);
}
}
}
}
|