package com.lgnortel.profile.ont.assign;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import com.lgnortel.lib.table.SortFilterModel;
import com.lgnortel.netconf.wdmpon.Msp;
import com.lgnortel.profile.common.ProfileComplexIF;
import com.lgnortel.profile.common.ProfileUpdateIF;
import com.lgnortel.r4.r4equipment.common.CommandResponseInterface;
/**
*
* 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>
*
* Company: LG-Nortel<br>
* Title: ONTCesView.java<br>
* Description: <br>
* Copyright: Copyright(c) 2010 LG-NORTEL ALL Rights Reserved<br>
* Company: LG-Nortel<br>
*
* @author SangHee, Kim
* @version 0.1
* @created 2010. 1. 7.
* @modified 2010. 1. 7.
* @product R4 EMS 4.0
* @sw_block CLIENT BLOCK
*/
public class ONTCesView extends JPanel implements CommandResponseInterface {
/**
*
*/
private static final long serialVersionUID = -4248332336889000417L;
private ONTCesDeletionView cesDeletion = null;
private ONTCesAssignmentView cesAssignment = null;
private JTabbedPane pnlTab;
private int pnlTabPrevious = 0;
private int viewId;
public ONTCesView() {
jbInit();
}
public void changeAssignView(ProfileUpdateIF complexIf, String nodeName, boolean mFlag, String profileName) {
try {
cesAssignment.changeViewState(complexIf, nodeName, mFlag, profileName);
} catch (Exception e) {
e.printStackTrace();
}
}
public void changeDeletionView(ProfileComplexIF complexIf, String nodeName, boolean mFlag, String profileName) {
try {
cesDeletion.changeViewState(complexIf, nodeName, mFlag, profileName);
} catch (Exception e) {
e.printStackTrace();
}
}
public void setSelectDeletionTab(int indexTab) {
pnlTab.setSelectedIndex(indexTab);
}
public void requestInitialCmd() {
cesAssignment.get();
}
private void jbInit() {
cesAssignment = new ONTCesAssignmentView("Assignment Manager");
cesDeletion = new ONTCesDeletionView("Deletion Manager");
pnlTab = new JTabbedPane();
pnlTab.add("Assignment Manager", cesAssignment);
pnlTab.add("Deletion Manager", cesDeletion);
pnlTab.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (pnlTabPrevious == pnlTab.getSelectedIndex())
return;
pnlTabPrevious = pnlTab.getSelectedIndex();
switch (pnlTab.getSelectedIndex()) {
case 0:
refreshAssignCellInfo();
// cesAssignment.setCellEditable();
break;
case 1:
refreshDeletionCellInfo();
// cesDeletion.setCellEditable();
break;
}
}
});
this.setLayout(new GridBagLayout());
this.add(pnlTab, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0));
}
@Override
public boolean cmdResponse(int currentCmdCnt, int userId, int nodeId, int cmdCode, Object[] data, int result, String errMessage) {
CommandResponseInterface com = (CommandResponseInterface) pnlTab.getSelectedComponent();
com.cmdResponse(currentCmdCnt, userId, nodeId, cmdCode, data, result, errMessage);
return false;
}
public void setViewId(int viewId) {
this.viewId = viewId;
cesAssignment.setViewId(viewId);
cesDeletion.setViewId(viewId);
}
/**
* get the view id.
*
* @return
*/
public int getViewId() {
return viewId;
}
public SortFilterModel getDeletionModel() {
return cesDeletion.getModel();
}
public SortFilterModel getSetModel() {
return cesAssignment.getModel();
}
public void setMsp(Msp msp) {
cesAssignment.setMsp(msp);
}
public void refreshDeletionInfo() {
cesDeletion.get();
}
public void refreshAssignInfo() {
cesAssignment.get();
}
public void refreshAssignCellInfo() {
cesAssignment.refreshCellInfo();
}
public void refreshDeletionCellInfo() {
cesDeletion.refreshCellInfo();
}
}
|