Return-Path: Delivered-To: apmail-logging-general-archive@www.apache.org Received: (qmail 25282 invoked from network); 26 Oct 2010 06:32:51 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Oct 2010 06:32:51 -0000 Received: (qmail 48257 invoked by uid 500); 26 Oct 2010 06:32:51 -0000 Delivered-To: apmail-logging-general-archive@logging.apache.org Received: (qmail 48111 invoked by uid 500); 26 Oct 2010 06:32:49 -0000 Mailing-List: contact general-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Logging General" List-Id: Delivered-To: mailing list general@logging.apache.org Received: (qmail 48102 invoked by uid 99); 26 Oct 2010 06:32:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Oct 2010 06:32:48 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Oct 2010 06:32:47 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 7729323888FE; Tue, 26 Oct 2010 06:31:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1027377 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java Date: Tue, 26 Oct 2010 06:31:49 -0000 To: general@logging.apache.org From: sdeboy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101026063149.7729323888FE@eris.apache.org> Author: sdeboy Date: Tue Oct 26 06:31:49 2010 New Revision: 1027377 URL: http://svn.apache.org/viewvc?rev=1027377&view=rev Log: Reverting commit adding support for 'basic' rendering in tablemodel Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java?rev=1027377&r1=1027376&r2=1027377&view=diff ============================================================================== --- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java (original) +++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java Tue Oct 26 06:31:49 2010 @@ -188,17 +188,8 @@ public class TableColorizingRenderer ext int colIndex = tableColumn.getModelIndex() + 1; //no event, use default renderer - - JLabel basicComponent = null; - boolean basic = (!wrap && !highlightSearchMatchText && !logPanelPreferenceModel.isShowMillisDeltaAsGap()); - if (basic || loggingEventWrapper == null) { - Component rendererComponent = super.getTableCellRendererComponent(table, value, false, false, row, col); - if (!(rendererComponent instanceof JLabel) || loggingEventWrapper == null) { - return rendererComponent; - } - basicComponent = (JLabel)rendererComponent; - basicComponent.setFont(levelTextPane.getFont()); - setBasicComponentBorder(basicComponent, isSelected, table, col); + if (loggingEventWrapper == null) { + return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); } long delta = 0; if (row > 0) { @@ -212,9 +203,6 @@ public class TableColorizingRenderer ext switch (colIndex) { case ChainsawColumns.INDEX_THROWABLE_COL_NAME: if (value instanceof String[] && ((String[])value).length > 0){ - if (basic) { - basicComponent.setText(((String[])value)[0]); - } else { Style tabStyle = singleLineTextPane.getLogicalStyle(); StyleConstants.setTabSet(tabStyle, tabs); //set the 1st tab at position 3 @@ -227,20 +215,11 @@ public class TableColorizingRenderer ext } else { singleLineTextPane.setText(((String[])value)[0]); } - } } else { - if (basic) { - basicComponent.setText(""); - } else { - singleLineTextPane.setText(""); - } - } - if (basic) { - component = basicComponent; - } else { - layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); - component = generalPanel; + singleLineTextPane.setText(""); } + layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); + component = generalPanel; break; case ChainsawColumns.INDEX_LOGGER_COL_NAME: String logger = value.toString(); @@ -252,88 +231,49 @@ public class TableColorizingRenderer ext break; } } - if (basic) { - basicComponent.setText(logger.substring(startPos + 1)); - component = basicComponent; - } else { singleLineTextPane.setText(logger.substring(startPos + 1)); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.LOGGER_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_ID_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.PROP_FIELD + "LOG4JID"), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_CLASS_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.CLASS_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_FILE_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.FILE_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_LINE_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.LINE_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_NDC_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.NDC_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_THREAD_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.THREAD_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_TIMESTAMP_COL_NAME: //timestamp matches contain the millis..not the display text..just highlight if we have a match for the timestamp field - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { Set timestampMatches = (Set)matches.get(LoggingEventFieldResolver.TIMESTAMP_FIELD); if (timestampMatches != null && timestampMatches.size() > 0) { singleLineTextPane.setText(value.toString()); @@ -343,26 +283,16 @@ public class TableColorizingRenderer ext } layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_METHOD_COL_NAME: - if (basic) { - basicComponent.setText(value.toString()); - component = basicComponent; - } else { singleLineTextPane.setText(value.toString()); setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.METHOD_FIELD), (StyledDocument) singleLineTextPane.getDocument()); layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; case ChainsawColumns.INDEX_LOG4J_MARKER_COL_NAME: case ChainsawColumns.INDEX_MESSAGE_COL_NAME: String thisString = value.toString().trim(); - if (basic) { - basicComponent.setText(thisString); - component = basicComponent; - } else { JTextPane textPane = wrap ? multiLineTextPane : singleLineTextPane; JComponent textPaneContainer = wrap ? multiLinePanel : generalPanel; textPane.setText(thisString); @@ -443,52 +373,28 @@ public class TableColorizingRenderer ext } component = textPaneContainer; - } break; case ChainsawColumns.INDEX_LEVEL_COL_NAME: if (levelUseIcons) { - if (basic) { - basicComponent.setText(""); - basicComponent.setIcon((Icon)iconMap.get(value.toString())); - if (!toolTipsVisible) { - basicComponent.setToolTipText(value.toString()); - } - } else { - levelTextPane.setText(""); - levelTextPane.insertIcon((Icon) iconMap.get(value.toString())); - if (!toolTipsVisible) { - levelTextPane.setToolTipText(value.toString()); - } + levelTextPane.setText(""); + levelTextPane.insertIcon((Icon) iconMap.get(value.toString())); + if (!toolTipsVisible) { + levelTextPane.setToolTipText(value.toString()); } } else { - if (basic) { - basicComponent.setText(value.toString()); - if (!toolTipsVisible) { - basicComponent.setToolTipText(null); - } - } else { - levelTextPane.setText(value.toString()); - setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.LEVEL_FIELD), (StyledDocument) levelTextPane.getDocument()); - if (!toolTipsVisible) { - levelTextPane.setToolTipText(null); - } + levelTextPane.setText(value.toString()); + setHighlightAttributesInternal(matches.get(LoggingEventFieldResolver.LEVEL_FIELD), (StyledDocument) levelTextPane.getDocument()); + if (!toolTipsVisible) { + levelTextPane.setToolTipText(null); } } if (toolTipsVisible) { - if (basic) { - basicComponent.setToolTipText(label.getToolTipText()); - } else { levelTextPane.setToolTipText(label.getToolTipText()); - } - } - if (basic) { - component = basicComponent; - } else { - levelTextPane.setForeground(label.getForeground()); - levelTextPane.setBackground(label.getBackground()); - layoutRenderingPanel(levelPanel, levelTextPane, delta, isSelected, width, col, table); - component = levelPanel; } + levelTextPane.setForeground(label.getForeground()); + levelTextPane.setBackground(label.getBackground()); + layoutRenderingPanel(levelPanel, levelTextPane, delta, isSelected, width, col, table); + component = levelPanel; break; //remaining entries are properties @@ -507,26 +413,13 @@ public class TableColorizingRenderer ext if (thisProp != null) { String propKey = LoggingEventFieldResolver.PROP_FIELD + thisProp.toUpperCase(); Set propKeyMatches = (Set)matches.get(propKey); - String propertyValue = loggingEventWrapper.getLoggingEvent().getProperty(thisProp); - if (basic) { - basicComponent.setText(propertyValue); - } else { - singleLineTextPane.setText(propertyValue); + singleLineTextPane.setText(loggingEventWrapper.getLoggingEvent().getProperty(thisProp)); setHighlightAttributesInternal(propKeyMatches, (StyledDocument) singleLineTextPane.getDocument()); - } } else { - if (basic) { - basicComponent.setText(""); - } else { singleLineTextPane.setText(""); - } } - if (basic) { - component = basicComponent; - } else { layoutRenderingPanel(generalPanel, singleLineTextPane, delta, isSelected, width, col, table); component = generalPanel; - } break; } @@ -561,40 +454,16 @@ public class TableColorizingRenderer ext component.setForeground(foreground); //update the background & foreground of the jtextpane using styles - if (!basic) { - if (multiLineTextPane != null) - { - updateColors(multiLineTextPane, background, foreground); - } - updateColors(levelTextPane, background, foreground); - updateColors(singleLineTextPane, background, foreground); + if (multiLineTextPane != null) + { + updateColors(multiLineTextPane, background, foreground); } - return component; - } + updateColors(levelTextPane, background, foreground); + updateColors(singleLineTextPane, background, foreground); - private void setBasicComponentBorder(JComponent component, boolean isSelected, JTable table, int col) { - setComponentBorder(component, isSelected, table, col, 0); + return component; } - private void setComponentBorder(JComponent component, boolean isSelected, JTable table, int col, long delta) { - if (delta == 0 || !logPanelPreferenceModel.isShowMillisDeltaAsGap()) { - if (col == 0) { - component.setBorder(getLeftBorder(isSelected, delta)); - } else if (col == table.getColumnCount() - 1) { - component.setBorder(getRightBorder(isSelected, delta)); - } else { - component.setBorder(getMiddleBorder(isSelected, delta)); - } - } else { - if (col == 0) { - component.setBorder(getLeftBorder(isSelected, 0)); - } else if (col == table.getColumnCount() - 1) { - component.setBorder(getRightBorder(isSelected, 0)); - } else { - component.setBorder(getMiddleBorder(isSelected, 0)); - } - } - } private void layoutRenderingPanel(JComponent container, JComponent bottomComponent, long delta, boolean isSelected, int width, int col, JTable table) { container.removeAll();