⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cellvalue.java

📁 实现JAVA界面的代码GWT
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   CellValue.java

package jxl.write.biff;

import common.Assert;
import common.Logger;
import jxl.*;
import jxl.biff.*;
import jxl.biff.drawing.ComboBox;
import jxl.biff.drawing.Comment;
import jxl.biff.formula.FormulaException;
import jxl.format.CellFormat;
import jxl.write.*;

// Referenced classes of package jxl.write.biff:
//            WritableSheetImpl, ColumnInfoRecord, RowRecord, WritableWorkbookImpl, 
//            Styles, SharedStrings

public abstract class CellValue extends WritableRecordData
    implements WritableCell
{

    private static Logger logger;
    private int row;
    private int column;
    private XFRecord format;
    private FormattingRecords formattingRecords;
    private boolean referenced;
    private WritableSheetImpl sheet;
    private WritableCellFeatures features;
    private boolean copied;
    static Class class$jxl$write$biff$CellValue; /* synthetic field */

    protected CellValue(Type t, int c, int r)
    {
        this(t, c, r, ((CellFormat) (WritableWorkbook.NORMAL_STYLE)));
        copied = false;
    }

    protected CellValue(Type t, Cell c)
    {
        this(t, c.getColumn(), c.getRow());
        copied = true;
        format = (XFRecord)c.getCellFormat();
        if(c.getCellFeatures() != null)
        {
            features = new WritableCellFeatures(c.getCellFeatures());
            features.setWritableCell(this);
        }
    }

    protected CellValue(Type t, int c, int r, CellFormat st)
    {
        super(t);
        row = r;
        column = c;
        format = (XFRecord)st;
        referenced = false;
        copied = false;
    }

    protected CellValue(Type t, int c, int r, CellValue cv)
    {
        super(t);
        row = r;
        column = c;
        format = cv.format;
        referenced = false;
        copied = false;
        if(cv.features != null)
        {
            features = new WritableCellFeatures(cv.features);
            features.setWritableCell(this);
        }
    }

    public void setCellFormat(CellFormat cf)
    {
        format = (XFRecord)cf;
        if(!referenced)
        {
            return;
        } else
        {
            Assert.verify(formattingRecords != null);
            addCellFormat();
            return;
        }
    }

    public int getRow()
    {
        return row;
    }

    public int getColumn()
    {
        return column;
    }

    public boolean isHidden()
    {
        ColumnInfoRecord cir = sheet.getColumnInfo(column);
        if(cir != null && cir.getWidth() == 0)
            return true;
        RowRecord rr = sheet.getRowInfo(row);
        return rr != null && (rr.getRowHeight() == 0 || rr.isCollapsed());
    }

    public byte[] getData()
    {
        byte mydata[] = new byte[6];
        IntegerHelper.getTwoBytes(row, mydata, 0);
        IntegerHelper.getTwoBytes(column, mydata, 2);
        IntegerHelper.getTwoBytes(format.getXFIndex(), mydata, 4);
        return mydata;
    }

    void setCellDetails(FormattingRecords fr, SharedStrings ss, WritableSheetImpl s)
    {
        referenced = true;
        sheet = s;
        formattingRecords = fr;
        addCellFormat();
        addCellFeatures();
    }

    final boolean isReferenced()
    {
        return referenced;
    }

    final int getXFIndex()
    {
        return format.getXFIndex();
    }

    public CellFormat getCellFormat()
    {
        return format;
    }

    void incrementRow()
    {
        row++;
        if(features != null)
        {
            Comment c = features.getCommentDrawing();
            if(c != null)
            {
                c.setX(column);
                c.setY(row);
            }
        }
    }

    void decrementRow()
    {
        row--;
        if(features != null)
        {
            Comment c = features.getCommentDrawing();
            if(c != null)
            {
                c.setX(column);
                c.setY(row);
            }
            if(features.hasDropDown())
                logger.warn("need to change value for drop down drawing");
        }
    }

    void incrementColumn()
    {
        column++;
        if(features != null)
        {
            Comment c = features.getCommentDrawing();
            if(c != null)
            {
                c.setX(column);
                c.setY(row);
            }
        }
    }

    void decrementColumn()
    {
        column--;
        if(features != null)
        {
            Comment c = features.getCommentDrawing();
            if(c != null)
            {
                c.setX(column);
                c.setY(row);
            }
        }
    }

    void columnInserted(Sheet sheet1, int i, int j)
    {
    }

    void columnRemoved(Sheet sheet1, int i, int j)
    {
    }

    void rowInserted(Sheet sheet1, int i, int j)
    {
    }

    void rowRemoved(Sheet sheet1, int i, int j)
    {
    }

    protected WritableSheetImpl getSheet()
    {
        return sheet;
    }

    private void addCellFormat()
    {
        Styles styles = sheet.getWorkbook().getStyles();
        format = styles.getFormat(format);
        try
        {
            if(!format.isInitialized())
                formattingRecords.addStyle(format);
        }
        catch(NumFormatRecordsException e)
        {
            logger.warn("Maximum number of format records exceeded.  Using default format.");
            format = styles.getNormalStyle();
        }
    }

    public CellFeatures getCellFeatures()
    {
        return features;
    }

    public WritableCellFeatures getWritableCellFeatures()
    {
        return features;
    }

    public void setCellFeatures(WritableCellFeatures cf)
    {
        if(features != null)
            logger.warn("current cell features not null - overwriting");
        features = cf;
        cf.setWritableCell(this);
        if(referenced)
            addCellFeatures();
    }

    public final void addCellFeatures()
    {
        if(features == null)
            return;
        if(copied)
        {
            copied = false;
            return;
        }
        if(features.getComment() != null)
        {
            Comment comment = new Comment(features.getComment(), column, row);
            comment.setWidth(features.getCommentWidth());
            comment.setHeight(features.getCommentHeight());
            sheet.addDrawing(comment);
            sheet.getWorkbook().addDrawing(comment);
            features.setCommentDrawing(comment);
        }
        if(features.hasDataValidation())
        {
            try
            {
                features.getDVParser().setCell(column, row, sheet.getWorkbook(), sheet.getWorkbook(), sheet.getWorkbookSettings());
            }
            catch(FormulaException e)
            {
                Assert.verify(false);
            }
            sheet.addValidationCell(this);
            if(!features.hasDropDown())
                return;
            if(sheet.getComboBox() == null)
            {
                ComboBox cb = new ComboBox();
                sheet.addDrawing(cb);
                sheet.getWorkbook().addDrawing(cb);
                sheet.setComboBox(cb);
            }
            features.setComboBox(sheet.getComboBox());
        }
    }

    public final void removeComment(Comment c)
    {
        sheet.removeDrawing(c);
    }

    final void setCopied(boolean c)
    {
        copied = c;
    }

    static Class class$(String x0)
    {
        return Class.forName(x0);
        ClassNotFoundException x1;
        x1;
        throw new NoClassDefFoundError(x1.getMessage());
    }

    static 
    {
        logger = Logger.getLogger(class$jxl$write$biff$CellValue != null ? class$jxl$write$biff$CellValue : (class$jxl$write$biff$CellValue = class$("jxl.write.biff.CellValue")));
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -