package com.lgnortel.r3.r3equipment.r3l3;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import com.lgnortel.network.networkview.MainMenuBar;
import com.lgnortel.platform.model.LabelMenuMgr;
import com.lgnortel.platform.model.NetworkMgr;
import com.lgnortel.rmi.common.EmsCode;
/**
* Copyright (c) 2008 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: CmdTotalPPPoEView.java<br>
* Description: PPPoE function frame. <br>
* Copyright: Copyright(c) 2008 LG-NORTEL ALL Rights Reserved<br>
* Company: LG-Nortel<br>
*
* @author kim sang hee
* @version 0.1
* @created 2009. 1. 22.
* @modified 2009. 1. 22.
* @product EFA4.0 EMS
* @sw_block client block
*/
public class CmdTotalPPPoEView extends JFrame {
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel pnlContent = null;
public CmdPPPoEView pnlPPPoE;
private JButton btnClose = null;
private String sTitle = null;
int viewId;
int neId;
int shelfId;
LabelMenuMgr labelMenuMgr = LabelMenuMgr.getInstance();
NetworkMgr networkMgr = NetworkMgr.getInstance();
protected ImageIcon closeImg, closeImgDeact, closeImgRoll;
/**
* the constructor.
*
* @param _neId
* the node id.
* @param _shelfId
* the shelf id.
*/
public CmdTotalPPPoEView(int _neId, int _shelfId) {
try {
this.sTitle = labelMenuMgr.getMenu("PPPOE_MENU");
this.neId = _neId;
this.shelfId = _shelfId;
closeImg = new ImageIcon(getClass().getClassLoader().getResource("image/btn_close_normal.gif"));
closeImgDeact = new ImageIcon(getClass().getClassLoader().getResource("image/btn_close_deact.gif"));
closeImgRoll = new ImageIcon(getClass().getClassLoader().getResource("image/btn_close_rollover.gif"));
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* the constructor.
*
* @param neId
* the node id.
* @param shelfIdLocal
* the shelf id.
* @param slotId
* the slot id.
*/
public CmdTotalPPPoEView(int neId, int shelfId, int slotId, int portId) {
this(neId, shelfId);
}
/**
* Request Initial Data
*/
public void requestInitialCmd() {
pnlPPPoE.getPPPoE();
}
/**
* set the view id.
*
* @param lViewId
* the view id.
*/
public void setViewId(int _viewId) {
this.viewId = _viewId;
pnlPPPoE.setViewId(_viewId);
}
/**
* get the view id.
*
* @return a int value for view id.
*/
public int getViewId() {
return viewId;
}
private void jbInit() throws Exception {
btnClose = new JButton();
btnClose.setPreferredSize(new Dimension(72, 25));
btnClose.setMinimumSize(new Dimension(72, 25));
btnClose.setMaximumSize(new Dimension(72, 25));
btnClose.addActionListener(eventHandler);
btnClose.setIcon(closeImg);
btnClose.setRolloverIcon(closeImgRoll);
pnlPPPoE = new CmdPPPoEView(neId, shelfId);
pnlContent = new JPanel();
pnlContent.setLayout(new GridBagLayout());
pnlContent.add(pnlPPPoE, new GridBagConstraints(1, 1, 6, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0));
pnlContent.add(btnClose, new GridBagConstraints(6, 2, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10, 6, 1, 6), 0, 0));
initialize();
}
/**
* the response method.
*
* @param viewId
* the view id.
* @param userId
* the user id.
* @param nodeId
* the node id.
* @param cmdCode
* the command code.
* @param data
* the Object array for the data.
* @param result
* the int value about the result.
* @return the true if call the method.
*/
public boolean cmdResponse(int viewId, int userId, int nodeId, int cmdCode, Object[] data, int result) {
switch (cmdCode) {
case EmsCode.CMD_RTRV_PPPOE:
case EmsCode.CMD_SET_PPPOE:
pnlPPPoE.cmdResponse(viewId, userId, nodeId, cmdCode, data, result);
break;
default:
break;
}
return true;
}
private void close() {
MainMenuBar mainMenuBar = MainMenuBar.getInstance();
mainMenuBar.removeCommand(viewId);
dispose();
}
IvjEventHandler eventHandler = new IvjEventHandler();
/**
*
* Title: CmdTotalPPPoEView.java<br>
* Description: Event Handler Class<br>
* Copyright: Copyright(c) 2008 LG-NORTEL ALL Rights Reserved<br>
* Company: LG-Nortel<br>
*
* @author kim sang hee
* @version 0.1
* @created 2009. 1. 22.
* @modified 2009. 1. 22.
* @product EFA4.0 EMS
* @sw_block client block
*/
class IvjEventHandler implements java.awt.event.ActionListener {
public void actionPerformed(ActionEvent e) {
java.lang.Object src = e.getSource();
if (src == btnClose) {
close();
}
}
}
protected void processWindowEvent(WindowEvent e) {
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
close();
}
}
private void initialize() {
try {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setSize(1024, 750);
setLocation(100, 0);
setResizable(true);
setContentPane(pnlContent);
setTitle(sTitle);
} catch (java.lang.Throwable ivjExc) {
handleException(ivjExc);
}
}
private void handleException(java.lang.Throwable exception) {
System.out.println("--------------------- Exception ---------------------");
}
}
|