|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ /** * EditPanelHeaders.java * * * Created: Fri Feb 9 2001 * * @author Ana von Klopp * @author Simran Gleason * @version */ /** * Contains the Request sub-panel for the EditPanel */ package org.netbeans.modules.web.monitor.client; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ResourceBundle; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import org.openide.util.NbBundle; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.netbeans.modules.web.monitor.data.*; class EditPanelHeaders extends DataDisplay { private final static boolean debug = false; private DisplayTable headerTable = null; private MonitorData monitorData = null; private boolean setParams = false; // // Widgets // JButton newHeaderB; JButton editHeaderB; JButton deleteHeaderB; EditPanelHeaders() { super(); } // Replace this. Inefficient and prevents us from maintaining // sorting. void redisplayData() { setData(monitorData); this.revalidate(); this.repaint(); } void setData(MonitorData md) { this.monitorData = md; setHeaderTable(); if(debug) log("setData()"); // NOI18N this.removeAll(); int gridy = -1; int fullGridWidth = java.awt.GridBagConstraints.REMAINDER; addGridBagComponent(this, createTopSpacer(), 0, ++gridy, fullGridWidth, 1, 0, 0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, topSpacerInsets, 0, 0); String msg = NbBundle.getBundle(EditPanelHeaders.class).getString("MON_HTTP_Headers"); addGridBagComponent(this, createSortButtonLabel(msg, headerTable, NbBundle.getBundle(EditPanelHeaders.class).getString("MON_HTTP_Headers_2_Mnemonic").charAt(0), NbBundle.getBundle(EditPanelHeaders.class).getString("ACS_MON_HTTP_HeadersA11yDesc")), 0, ++gridy, 1, 1, 0, 0, java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, labelInsets, 0, 0); JScrollPane scrollpane = new JScrollPane(headerTable); addGridBagComponent(this, scrollpane, 0, ++gridy, fullGridWidth, 1, 1.0, 1.0, java.awt.GridBagConstraints.WEST, //java.awt.GridBagConstraints.HORIZONTAL, java.awt.GridBagConstraints.BOTH, tableInsets, 0, 0); newHeaderB = new JButton(NbBundle.getBundle(EditPanelHeaders.class).getString("MON_New_header")); newHeaderB.setMnemonic(NbBundle.getBundle(EditPanelHeaders.class).getString("MON_New_header_Mnemonic").charAt(0)); newHeaderB.setToolTipText(NbBundle.getBundle(EditPanelHeaders.class).getString("ACS_MON_New_headerA11yDesc")); newHeaderB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String title = NbBundle.getBundle(EditPanelHeaders.class).getString("MON_New_header"); ParamEditor pe = new ParamEditor("", "", //NOI18N ParamEditor.Editable.BOTH, ParamEditor.Condition.HEADER, title); if(debug) log("Now showing dialog");// NOI18N pe.showDialog(); if(debug) log("Dialog closed"); // NOI18N if (pe.getDialogOK()) { if(debug) log("Dialog returned OK"); // NOI18N String name = pe.getName(); int status = 0; if(name.equalsIgnoreCase("cookie")) status = monitorData.getRequestData().addCookie(pe.getValue()); else status = monitorData.getRequestData().getHeaders().addParam(pe.getName(), pe.getValue()); if(debug) log("Headers are " + // NOI18N monitorData.getRequestData().getHeaders().toString()); // if(status == 1) { / // The new value was added to an existing header // } // if(status == -1) { // The new value was not added because it was // already in there. //} redisplayData(); } }}); deleteHeaderB = new JButton(NbBundle.getBundle(EditPanelHeaders.class).getString("MON_Delete_header")); deleteHeaderB.setMnemonic(NbBundle.getBundle(EditPanelHeaders.class).getString("MON_Delete_header_Mnemonic").charAt(0)); deleteHeaderB.setToolTipText(NbBundle.getBundle(EditPanelHeaders.class).getString("MON_New_header_Mnemonic")); deleteHeaderB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int numRows = headerTable.getRowCount(); StringBuffer buf = new StringBuffer (NbBundle.getBundle(EditPanelHeaders.class).getString("MON_Confirm_Delete_Headers")); buf.append("\n"); // NOI18N for(int i=0; i |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.