1 19 20 29 30 package org.netbeans.modules.web.monitor.client; 31 32 import javax.swing.*; import javax.swing.table.*; import java.awt.Component ; 35 import java.awt.FlowLayout ; 36 import java.awt.Dimension ; 37 38 import java.awt.Component ; 39 import java.awt.Container ; 40 import java.awt.GridBagLayout ; 41 import java.awt.GridBagConstraints ; 42 import java.awt.Insets ; 43 44 import org.netbeans.modules.web.monitor.data.*; 45 import org.openide.util.NbBundle; 46 import java.util.*; 47 48 49 public class HeaderDisplay extends DataDisplay { 50 51 private final static boolean debug = false; 52 53 private DisplayTable dt = null; 54 55 public HeaderDisplay() { 56 57 super(); 58 } 59 60 61 public void setData(DataRecord md) { 65 66 if(debug) System.out.println("in HeaderDisplay.setData()"); 68 this.removeAll(); 69 if (md == null) 70 return; 71 72 this.setLayout(new GridBagLayout ()); 73 74 int gridy = -1; 75 double tableWeightX = 1.0; 76 double tableWeightY = 0; 77 int fullGridWidth = java.awt.GridBagConstraints.REMAINDER; 78 79 RequestData rd = md.getRequestData(); 81 Param[] params = rd.getHeaders().getParam(); 82 String msg; 83 Component hLabel; 84 DisplayTable headerTable = null; 85 86 if(params == null || params.length == 0) { 87 msg = NbBundle.getBundle(HeaderDisplay.class).getString("MON_No_headers"); 88 hLabel = createDataLabel(msg); 89 } else { 90 msg = NbBundle.getBundle(HeaderDisplay.class).getString("MON_HTTP_Headers"); 91 headerTable = new DisplayTable(params, true); 92 headerTable.getAccessibleContext().setAccessibleName(NbBundle.getBundle(HeaderDisplay.class).getString("ACS_MON_HTTP_HeadersTableA11yName")); 93 headerTable.setToolTipText(NbBundle.getBundle(HeaderDisplay.class).getString("ACS_MON_HTTP_HeadersTableA11yDesc")); 94 hLabel = createSortButtonLabel(msg, headerTable, NbBundle.getBundle(HeaderDisplay.class).getString("MON_HTTP_Headers_Mnemonic").charAt(0), NbBundle.getBundle(HeaderDisplay.class).getString("ACS_MON_HTTP_HeadersA11yDesc")); 95 } 96 97 addGridBagComponent(this, createTopSpacer(), 0, ++gridy, 98 fullGridWidth, 1, 0, 0, 99 java.awt.GridBagConstraints.WEST, 100 java.awt.GridBagConstraints.NONE, 101 topSpacerInsets, 102 0, 0); 103 104 addGridBagComponent(this, hLabel, 0, ++gridy, 105 1, 1, 0, 0, 106 java.awt.GridBagConstraints.WEST, 107 java.awt.GridBagConstraints.NONE, 108 labelInsets, 109 0, 0); 110 111 112 if(params != null && params.length > 0) { 113 addGridBagComponent(this, headerTable, 0, ++gridy, 114 fullGridWidth, 1, tableWeightX, tableWeightY, 115 java.awt.GridBagConstraints.WEST, 116 java.awt.GridBagConstraints.HORIZONTAL, 117 tableInsets, 118 0, 0); 119 } 120 121 addGridBagComponent(this, Box.createGlue(), 0, ++gridy, 122 1, 1, 1.0, 1.0, 123 java.awt.GridBagConstraints.WEST, 124 java.awt.GridBagConstraints.BOTH, 125 zeroInsets, 126 0, 0); 127 128 this.setMaximumSize(this.getPreferredSize()); 129 this.repaint(); 130 } 131 } | Popular Tags |