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

📄 molist.txt

📁 本文实现了一个特别的Java molist
💻 TXT
字号:
  File : ClusterMoListPanel.java
 *        Classname : ClusterMoListPanel
 *        Author(s) : ejiawen
 *          Created : 2005-08-15
 * 
 * Copyright (c) 2000 Telefonaktiebolaget LM Ericsson, Sweden.
 * All rights reserved.
 * The Copyright to the computer program(s) herein is the property of
 * Telefonaktiebolaget LM Ericsson, Sweden.
 * The program(s) may be used and/or copied with the written permission
 * from Telefonaktiebolaget LM Ericsson or in accordance with the terms
 * and conditions stipulated in the agreement/contract under which the
 * program(s) have been supplied.
 */


// --------- Package name ----------------------------------------------------

package GuiAdm.neConfig;

// --------- Import files ----------------------------------------------------

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import GuiCore.util.*;
import GuiCore.mo.*;
import GuiCore.widget.*;
import GuiCore.ui.*;
import GuiCore.ne.*;


/**
 * <br><dl><dt><b>Description:</b><dd>
 * This is the panel used for presenting mo-list
 * </dl>
 *
 *
 * <br><dl><dt><b>MT-Level:</b><dd>
 * </dl>
 *
 *
 * <br><dl><b>Examples:</b><pre>
 * </pre>
 *
 * @version $Id: ClusterMoListPanel.java,v 1.18 2000/11/23 17:02:56 epkdber Exp $
 * @see Interesting class
 */
public class ClusterMoListPanel extends MoListPanel
{	
// --------- Constructor ------------------------------------------------------  
    /**
     * Empty constructor
     */
    public ClusterMoListPanel()
    {
        super();
    }

    /**
     * Presents the MO-LIST attribute for the current NE
     *
     * <p><dd><dl><dt><b>Preconditions:</b><dd>The mo!=null</dl></dt>
     * @param mo The mo description of panel
     * @param condition The handler of the conditions in the attributes
     * @param listener The connection to the application
     * @param name The name of the panel
     * @param title the title of the panel, can be used for the name of the tab
     * @param parameter The extra parameter how to handle the class
     */
    public ClusterMoListPanel(Mo mo, MoAttributeCondition condition, NeInternalFrameListener listener,
                          String name, String title, String parameter) throws ErrorException
    {
        this(mo, mo, condition, listener, name, title, parameter);
    }
    
    /**
     * Presents the MO-LIST attribute for the current NE
     *
     * <p><dd><dl><dt><b>Preconditions:</b><dd>The mo!=null</dl></dt>
     * @param baseMo The mo containing descriptions of all submo
     * @param mo The mo description of panel
     * @param condition The handler of the conditions in the attributes
     * @param listener The connection to the application
     * @param name The name of the panel
     * @param title the title of the panel, can be used for the name of the tab
     * @param parameter The extra parameter how to handle the class
     */
    public ClusterMoListPanel(Mo baseMo, Mo mo, MoAttributeCondition condition, NeInternalFrameListener listener,
                          String name, String title, String parameter) throws ErrorException
    {
        super(mo, condition, listener, name, title, parameter);
        AttributePanel strategyPanel = (AttributePanel)((JViewport)((JScrollPane)((NeInternalFrame)listener).getContentPane().getComponent(2)).getComponent(0)).getComponent(0);
        final JwComboBox  strategyBox = (JwComboBox)strategyPanel.getComponent(1);
	final JwCheckBox  parallelBox = (JwCheckBox)strategyPanel.getComponent(3);
        final JwCheckBox autoBox = (JwCheckBox)strategyPanel.getComponent(8);
        
        final JwLabel RetryDurationLabel = (JwLabel)strategyPanel.getComponent(9);
        final JwTextField RetryDuration = (JwTextField)strategyPanel.getComponent(10);
        final JwLabel RespCodeLabel = (JwLabel)strategyPanel.getComponent(11);
        final JwTextField ResponseCode = (JwTextField)strategyPanel.getComponent(12);
  
        final JwComboBox provisioningBox =(JwComboBox)((JwPanel)((JViewport)((JScrollPane)myAttributeAndTablePanel.getComponent(1)).getComponent(0)).getComponent(0)).getComponent(3);
        strategyBox.addItemListener(new ItemListener(){
        	public void itemStateChanged(ItemEvent e)
        	{
        		
        		if(e.getStateChange()==ItemEvent.SELECTED) 
			{
				return;
			}
		
			if(strategyBox.getValue().equals("ActiveActiveNonQueuing")||strategyBox.getValue().equals("FafSdpRetry"))
			{
				if(autoBox.getValue().equals("1") )
				{
					autoBox.clear();
					autoBox.actionPerformed(null);
				}
					
				if(RetryDuration.isEnabled())
				{
					RetryDurationLabel.setEnabled(false);
					RetryDuration.setEnabled(false);
				}
				if(ResponseCode.isEnabled())
				{
					RespCodeLabel.setEnabled(false);
					ResponseCode.setEnabled(false);
				}
			}
			else if ( strategyBox.getValue().equals("SingleNeRetry") ) 
			{
				if ( ! RetryDuration.getValue().equals("0") )
				{
					RetryDuration.setValue("0");
				}

				if( RetryDuration.isEnabled())
				{
					RetryDurationLabel.setEnabled(false);
					RetryDuration.setEnabled(false);
				}

				if(autoBox.getValue().equals("1") )
				{
						
					if(!ResponseCode.isEnabled())
					{
						RespCodeLabel.setEnabled(true);
						ResponseCode.setEnabled(true);
					}
						
				}
			}
			else
			{
				if(autoBox.getValue().equals("1") )
				{
					if(!RetryDuration.isEnabled())
					{
						RetryDurationLabel.setEnabled(true);
						RetryDuration.setEnabled(true);
					}
						
					if(!ResponseCode.isEnabled())
					{
						RespCodeLabel.setEnabled(true);
						ResponseCode.setEnabled(true);
					}
						
				}
			}
			

			try 
			{
				if(strategyBox.getValue().equals("FafSdpRetry"))
				{
					provisioningBox.setData("ON,On");
				}
				else if(strategyBox.getValue().equals("ActiveActiveNonQueuing"))
				{
					provisioningBox.setData("ON,On|OFF,Off");
				}
				else
				{
					provisioningBox.setData("ON,On|OFF,Off|OFF-STORE,Off-Store");
				}
			} 
			catch (ErrorException e1) 
			{
				e1.printStackTrace();
			}
        	}
        });
    }

    /**
     * Presents the MO-LIST attribute for the current NE
     *
     * <p><dd><dl><dt><b>Preconditions:</b><dd>The mo!=null</dl></dt>
     * @param baseMo The mo containing descriptions of all submo
     * @param mo The mo description of panel
     * @param condition The handler of the conditions in the attributes
     * @param neApplListener The connection to the application
     * @param listener The listener when a button is pressed or line is selected.
     * @param name The name of the panel
     * @param title the title of the panel, can be used for the name of the tab
     * @param parameter The extra parameter how to handle the class
     */
    public ClusterMoListPanel(Mo baseMo, Mo mo, MoAttributeCondition condition, NeInternalFrameListener neApplListener,
                       NeInternalFrameListener listener, String name, String title, String parameter) throws ErrorException
    {
        super(mo, condition, neApplListener, name, title, parameter);	
	
    }

    /**
     * Creates a new ClusterMoListPanel instance
     *
     * @param mo The mo description of panel
     * @param condition The handler of the conditions in the attributes
     * @param listener The connection to the NEFrame
     * @param name The name of the panel
     * @param title the title of the panel, can be used for the name of the tab
     * @param parameter The extra parameter how to handle the class
     */
    public Object clone(Mo mo, MoAttributeCondition condition, NeInternalFrameListener listener,
                        String name, String title, String parameter)throws ErrorException
    {
        try
        {
            return new ClusterMoListPanel(mo, condition, listener, name, title, parameter);
        }
        catch(ErrorException err)
        {
            Globals.setError(err,"-1", Globals.getNls("general","FAILED_TO_CLONE","Failed to clone:") + " ClusterMoListPanel", "",
                             "clone(Mo, MoAttributeCondition, NeApplListener, String)",this);
        }
        return null;	
    }

// --------- Public Member functions -----------------------------------------
    /**
     * The change button is pressed, change a line in the Table
     */
    public void changeButtonPressed()
    {				
		// See the TR HG13636 for more about the following code.
		// ... 
		// <Item Name="NE">
		//     <Type>MO_LIST</Type>
		//     <Mo>ne</Mo>
		//     <Attribute>name,provisioningState</Attribute>
		// </Item>
		// ...
		// <Item Name="NE">
		//     <Type>PANEL</Type>
		//     <Class>GuiAdm.neConfig.ClusterMoListPanel</Class>
		//     <Parameter>ne;TABLE:name,provisioningState;ATTRIBUTE:name,provisioningState</Parameter>
		// </Item>
		// ...
		String provisioningStateName = "provisioningState";
		// identName = "name"
		String identName  = (String)myAttributeAndTablePanel.myTablePanel.myIdentifierName.get(0);
		
		SubMoDataModel model = new SubMoDataModel(myAttributeAndTablePanel.myCurrentMo);
		String newValue = model.getValue(identName);
			
		int selectedIndex = myAttributeAndTablePanel.myTablePanel.getSelectedIndex();		
		for (int i=0; i<myAttributeAndTablePanel.myTablePanel.myModel.getRowCount() ; i++)	
        {	
			String tableValue = myAttributeAndTablePanel.myTablePanel.myModel.getValue(i, identName);
			if (tableValue==null)
			{
				continue;
			}

			if( tableValue.equals(newValue) ) // in the table items
			{
				if( selectedIndex != i )//not the selected items in the table, set it be selected
				{
					String newState = model.getValue(provisioningStateName);
					// reset the selected row in the table
					myAttributeAndTablePanel.myTablePanel.setSelectedIndex(i);
					myAttributeAndTablePanel.myCurrentMo.setAttributeValue(provisioningStateName,newState);
				}
				break;
			}
		}	
		super.changeButtonPressed();
    }

// --------- Private Member functions ----------------------------------------
    /**
     * This method return the nls text.
     *
     * @param nlsId The name of the nls text  (eg. OK_BUTTON)
     * @param defaultString default value used it the nls nr is not defined
     */
    private static String getNls(String nlsId, String defaultString)
    {
        return Globals.getNls("GuiCore.ne.ClusterMoListPanel", nlsId, defaultString);
    }

⌨️ 快捷键说明

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