Package simplesheet.style

Examples of simplesheet.style.Style


    @Override
    public Component getSheetCellRendererComponent(SheetTable table, TableCell value,
            boolean isSelected, boolean hasFocus) {

        Style style = value.getStyle();
        cellValue = value.getValue();

        foreground = (style != null && style.getForeground() != null)
                ? style.getForeground() : table.getForeground();

        background = (style != null)
                ? style.getBackground() : null;

        font = (style != null && style.getFont() != null)
                ? style.getFont() : table.getFont();

        textAlign = (style != null)
                ? style.getTextAlign() : TextAlign.undefined;

        textVAlign = (style != null)
                ? style.getTextVAlign(): TextVAlign.undefined;

        border = (style != null && style.getBorder() != null)
                ? style.getBorder() : null;

        margin = (style != null && style.getMargin() != null)
                ? style.getMargin() : defaultMargin;

        if(hasFocus) {
            border = focusedBorder;
        }
        if (isSelected && !hasFocus) {
View Full Code Here


    public int getPreferredWidth(SheetTable table, Graphics g, TableCell cell) {
        if(cell == null || cell.getValue() == null) {
            return -1;
        }
        FontMetrics fontMetrics = getFontMetrics(table, g, cell);
        Style style = cell.getStyle();
        margin = (style != null  &&  style.getMargin() != null)
                ? style.getMargin() :  defaultMargin;

        return scaleInset(margin.left + margin.right, fontMetrics.getHeight())
               + fontMetrics.stringWidth(cell.getValue().toString());
    }
View Full Code Here

    public int getPreferredHeight(SheetTable table, Graphics g, TableCell cell, int width) {
        if(cell == null || cell.getValue() == null) {
            return -1;
        }
        FontMetrics fontMetrics = getFontMetrics(table, g, cell);
        Style style = cell.getStyle();
        margin = (style != null  &&  style.getMargin() != null)
                ? style.getMargin() :  defaultMargin;
        return scaleInset(margin.top + margin.bottom, fontMetrics.getHeight())
               + fontMetrics.getHeight();
    }
View Full Code Here

     * @param cell
     * @return
     */
    private static FontMetrics getFontMetrics(SheetTable table, Graphics g, TableCell cell) {
        Font oldFont = g.getFont();
        Style style = cell.getStyle();
        Font cellFont = (style != null  &&  style.getFont() != null)
                ? style.getFont() : table.getFont();
        g.setFont(cellFont);
        FontMetrics fontMetrics = g.getFontMetrics();
        g.setFont(oldFont);
        return fontMetrics;
    }
View Full Code Here

            if(tableCell instanceof SheetCell) {
                SheetCell sc = (SheetCell) tableCell;
                savedStream = new Element("save");
                sc.getCellFormat().saveState(savedStream);
            }
            Style style = tableCell.getStyle();

            //iterate dest
            int dif = (anchor.row < lead.row) ? 1 : -1;
            int dif2 = (anchor.col < lead.col) ? 1 : -1;
            int failed = 0;
View Full Code Here

                }
            }
            if (style == null) {
                return;
            }
            Style newStyle = iCell.getStyle();
            if (autoFill.isCopyStyle() && newStyle == null) {
                newStyle = new StyleDefault();
            }
            if (autoFill.isCopyColor()) {
                newStyle.setForeground(style.getForeground());
                newStyle.setBackground(style.getBackground());
            }
            if (autoFill.isCopyFont()) {
                newStyle.setFont(style.getFont());
            }
            if (autoFill.isCopyMargin()) {
                newStyle.setMargin(style.getMargin());
            }
            if (autoFill.isCopyBorder()) {
                newStyle.setBorder(style.getBorder());
            }
            if (autoFill.isCopyAlign()) {
                newStyle.setTextAlign(style.getTextAlign());
                newStyle.setTextVAlign(style.getTextVAlign());
            }
            iCell.setStyle(newStyle);
        }
View Full Code Here

    public StyleDefault() {
    }

    public Style Clone() {
        Style clone = new StyleDefault();
        clone.setBackground(background);
        clone.setForeground(foreground);
        clone.setFont(font);
        clone.setTextAlign(textAlign);
        clone.setTextVAlign(textVAlign);
        clone.setBorder(cellBorder);
        clone.setMargin(margin);
        return clone;
    }
View Full Code Here

TOP

Related Classes of simplesheet.style.Style

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.