Package javax.swing.table

Examples of javax.swing.table.DefaultTableCellRenderer


        return UIutils.javaAlignementToForte(result);
    }

    public void setAlignment(int pAlignment) {
        if (this.renderer instanceof DefaultTableCellRenderer) {
            DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) this.renderer;
            dtcr.setHorizontalAlignment(UIutils
                    .forteAlignmentToJava(pAlignment));
        }
    }
View Full Code Here


        setName(String.format("SonarQube - %s", ProjectUtils.getInformation(projectContext.getProject()).getDisplayName()));
    }

    public void setSummary(Summary summary) {
        tableSummary.setTreeTableModel(new SummaryModel(summary, !showEmptySeverity.isSelected()));
        DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
        renderer.setHorizontalAlignment(JLabel.RIGHT);
        tableSummary.getColumn(1).setCellRenderer(renderer);
        listIssuesAction.setEnabled(false);
        showRuleInfoAction.setEnabled(false);
    }
View Full Code Here

     * TagId=58
     * isInherited=FALSE
     */
    public DefaultTableCellRenderer getqq_aList1Array_aList1Array_PictureGraphic58() {
        if (qq_aList1Array_aList1Array_PictureGraphic58 == null) {
            qq_aList1Array_aList1Array_PictureGraphic58 = new DefaultTableCellRenderer();
            qq_aList1Array_aList1Array_PictureGraphic58.setIcon(new ImageIcon(ArrayTester.class.getResource("ArrayTester.qq_aList1Array_aList1Array_PictureGraphic58.png")));
            qq_aList1Array_aList1Array_PictureGraphic58.setName("");
            qq_aList1Array_aList1Array_PictureGraphic58.setOpaque( true );
            ArrayFieldCellHelper.setUpCellEditor(qq_aList1Array_aList1Array_PictureGraphic58, qq_aList1, 8, false);
            qq_aList1Array_aList1Array_PictureGraphic58.setSize(new Dimension(16, 16));
View Full Code Here

        }
        return qq_aList1Array_aList1Array_PictureGraphic58;
    }

    public void setqq_aList1Array_aList1Array_PictureGraphic58(DefaultTableCellRenderer value) {
        DefaultTableCellRenderer oldValue = qq_aList1Array_aList1Array_PictureGraphic58;
        qq_aList1Array_aList1Array_PictureGraphic58 = value;
        this.qq_Listeners.firePropertyChange("qq_aList1Array_aList1Array_PictureGraphic58", oldValue, value);
    }
View Full Code Here

     * TagId=71
     * isInherited=FALSE
     */
    public DefaultTableCellRenderer getqq_aListArray_aListArray_PictureGraphic71() {
        if (qq_aListArray_aListArray_PictureGraphic71 == null) {
            qq_aListArray_aListArray_PictureGraphic71 = new DefaultTableCellRenderer();
            qq_aListArray_aListArray_PictureGraphic71.setIcon(new ImageIcon(ArrayTester.class.getResource("ArrayTester.qq_aListArray_aListArray_PictureGraphic71.png")));
            qq_aListArray_aListArray_PictureGraphic71.setName("");
            qq_aListArray_aListArray_PictureGraphic71.setOpaque( true );
            ArrayFieldCellHelper.setUpCellEditor(qq_aListArray_aListArray_PictureGraphic71, qq_aList, 8, false);
            qq_aListArray_aListArray_PictureGraphic71.setSize(new Dimension(16, 16));
View Full Code Here

        }
        return qq_aListArray_aListArray_PictureGraphic71;
    }

    public void setqq_aListArray_aListArray_PictureGraphic71(DefaultTableCellRenderer value) {
        DefaultTableCellRenderer oldValue = qq_aListArray_aListArray_PictureGraphic71;
        qq_aListArray_aListArray_PictureGraphic71 = value;
        this.qq_Listeners.firePropertyChange("qq_aListArray_aListArray_PictureGraphic71", oldValue, value);
    }
View Full Code Here

        method.setAccessible(true);
        return method.invoke(currentObject, (Object [])null);
    }

    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        DefaultTableCellRenderer renderer = (DefaultTableCellRenderer)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

        // Add whitespace to left and right of columns
        renderer.setBorder(new EmptyBorder(insets.top, insets.left + (iconSupported ? 0 : 8), insets.bottom, insets.right + 8));

        // Set the correct colours.  CraigM 27/11/2007
        // TF:05/05/2009:Corrected these dependent upon the hasRowHighlights property of a ListViewTable
        boolean ignoreSelection = (table instanceof ListViewTable) && (!((ListViewTable)table).getHasRowHighlights());
        if (isSelected && !ignoreSelection) {
            if (table.hasFocus()) {
                renderer.setBackground(table.getSelectionBackground());
                renderer.setForeground(table.getSelectionForeground());
            }
            else {
                renderer.setBackground(java.awt.Color.lightGray);
                renderer.setForeground(java.awt.Color.black);
            }
        }
        else {
            renderer.setBackground(table.getBackground());
            renderer.setForeground(table.getForeground());
        }

        // Display icon if defined for this column
        if(value instanceof DisplayNode) {
            try {
                // Get the real value via reflection. This will either be the text of
                // the object or an image data. The first case (text) will be when this
                // is column 0 in the array and we need to use the icon image with the
                // retrieved text, and the second case will be when there is an explicitly
                // mapped image associated with this column.
                //Object objValue = AlignedCellRenderer.expressionExecute(value, this.methodName, "().");
                Object objValue = AlignedCellRenderer.expressionExecute(value, this.methodName, ".");

                int iconHeight = 0;
                if (objValue != null && objValue instanceof ImageData) {
                    // This is a column defined as an image, it can contain no text
                    ImageData id = (ImageData)objValue;
                    renderer.setIcon(id.asScaledIconImage(ICON_WIDTH, ICON_HEIGHT));
                    iconHeight = ICON_HEIGHT;
                }
                else {
                    // display icon
                    // TF:24/7/07: In Forte, if there was no selected icon, the small icon would display, even if selected.
                    Icon icon = null;
                    ImageData image = ((DisplayNode)value).getDVSmallIcon();
                    // COLET 20/01/2009 : Check if the selected image is valid by checking isNull(). If its empty, use the small icon. This is what Forte did.
                    ImageData selectedImage = ((DisplayNode)value).getDVSelectedIcon();
                    if (isSelected && selectedImage != null && !selectedImage.isNull()) {
                        image = selectedImage;
                    }

                    // We have an icon
                    if(image != null) {
                        icon = image.asScaledIconImage(ICON_WIDTH, ICON_HEIGHT);
                        iconHeight = ICON_HEIGHT;
                    }

                    // We don't have an icon and we are the left column, however, some other row does, so pad the space with an invisible image.
                    else if (column == 0 && this.hasIconInColumn1(table)) {
                        icon = invisibleIcon;
                    }
                   
                    //COLET 20/01/2009 : Add some shading to the icon. Forte would have the icon painted like this.
                    //                   By default, Java wont paint the background colour over the icon. Lets mimic Forte.
                    if(icon != null && isSelected) {
                      icon = new AlphaBlendedIcon(icon, getBackground(), BLENDED_ICON_TRANSPARENCY);
                    }
                   
                    renderer.setIcon(icon);

                    if(objValue != null) {
                        renderer.setText(objValue.toString());

                        // If we don't have an icon and we are the left most column, pad the space.
                        if (icon == null && column == 0) {
                            renderer.setText(" " + renderer.getText());
                        }

                        // The column sorts by comparing DVNodeText on the display node,
                        // so this should be set using the displayed text
//                        DisplayNode node = (DisplayNode)value;
//                        TextData td = node.getDVNodeText();
//                        if(td == null || td.toString() == null || td.toString().length() == 0
//                            || !objValue.toString().equals(td.toString())) {
//                            node.setDVNodeText(objValue.toString());
//                        }
                    }
                }

                // set row height sufficient for icon
                int currentHeight = table.getRowHeight();
                int newHeight = Math.max(iconHeight, currentHeight);
                if(newHeight != currentHeight) {
                    table.setRowHeight(newHeight);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        else {
            renderer.setIcon(null);
        }

        // Don't have a completely blank cell, as this will cause the row highlighting to not work.  CraigM 14/09/2007.
        if (renderer.getIcon() == null && renderer.getText().length() == 0) {
            renderer.setText(" ");
        }
        return renderer;
    }
View Full Code Here

        this.name = name;
        setEditor(cellEditor);
        setRenderer(cellRenderer);

        if (cellRenderer instanceof DefaultTableCellRenderer){
            DefaultTableCellRenderer dtce = (DefaultTableCellRenderer)cellRenderer;
            this.setAlignment(UIutils.javaAlignementToForte(dtce.getHorizontalAlignment()));
        }
    }
View Full Code Here

    }

    public int getAlignment() {
        int result;
        if (this.renderer instanceof DefaultTableCellRenderer) {
            DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) this.renderer;
            result = dtcr.getHorizontalAlignment();
        } else {
            result = SwingConstants.LEFT;
        }
        return UIutils.javaAlignementToForte(result);
    }
View Full Code Here

        return UIutils.javaAlignementToForte(result);
    }

    public void setAlignment(int pAlignment) {
        if (this.renderer instanceof DefaultTableCellRenderer) {
            DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) this.renderer;
            dtcr.setHorizontalAlignment(UIutils
                    .forteAlignmentToJava(pAlignment));
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.table.DefaultTableCellRenderer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.