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

📄 dvrecord.java

📁 介绍java核心技术的pio编程方法以及基本概念
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    /**     * return true if drop down arrow should be surppressed when list validation is used, false otherwise     * @return if drop down arrow should be surppressed when list validation is used, false otherwise     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public boolean getSurppresDropdownArrow()    {       return (this.opt_surppres_dropdown_arrow.isSet(this.field_option_flags));    }    /**     * set if a prompt window should appear when cell is selected     * @param type - true if a prompt window should appear when cell is selected, false otherwise     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public void setShowPromptOnCellSelected(boolean show)    {        this.field_option_flags =  this.opt_show_prompt_on_cell_selected.setBoolean(this.field_option_flags, show);    }    /**     * return true if a prompt window should appear when cell is selected, false otherwise     * @return if a prompt window should appear when cell is selected, false otherwise     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public boolean getShowPromptOnCellSelected()    {       return (this.opt_show_prompt_on_cell_selected.isSet(this.field_option_flags));    }    /**     * set if an error window should appear when an invalid value is entered in the cell     * @param type - true if an error window should appear when an invalid value is entered in the cell, false otherwise     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public void setShowErrorOnInvalidValue(boolean show)    {        this.field_option_flags =  this.opt_show_error_on_invalid_value.setBoolean(this.field_option_flags, show);    }    /**     * return true if an error window should appear when an invalid value is entered in the cell, false otherwise     * @return if an error window should appear when an invalid value is entered in the cell, false otherwise     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public boolean getShowErrorOnInvalidValue()    {       return (this.opt_show_error_on_invalid_value.isSet(this.field_option_flags));    }    /**     * set the condition operator     * @param type - condition operator     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public void setConditionOperator(int operator)    {        this.field_option_flags =  this.opt_condition_operator.setValue(this.field_option_flags, operator);    }    /**     * get the condition operator     * @return the condition operator     * @see org.apache.poi.hssf.util.HSSFDataValidation utility class     */    public int getConditionOperator()    {       return this.opt_condition_operator.getValue(this.field_option_flags);    }    // <-- end option flags    public void setFirstFormulaRPN( Stack rpn )    {        this.field_rpn_token_1 = rpn;    }    public void setFirstFormulaSize( short size )    {        this.field_size_first_formula = size;    }    public void setSecFormulaRPN( Stack rpn )    {        this.field_rpn_token_2 = rpn;    }    public void setSecFormulaSize( short size )    {        this.field_size_sec_formula = size;    }    public void setStringField( Integer type, String str_data )    {       if ( this._hash_strings == null )       {          this._hash_strings = new Hashtable();       }       StringHandler strHandler = new StringHandler();       if ( str_data == null )       {          str_data = "";       }       else       {          strHandler.setStringLength(str_data.length());       }       strHandler.setStringData(str_data);       strHandler.setUnicodeFlag((byte)0x00);       this._hash_strings.put( type, strHandler);    }    public String getStringField( Integer type )    {        return ((StringHandler)this._hash_strings.get(type)).getStringData();    }    public void setCellRangeAddress( HSSFCellRangeAddress range )    {        this.field_regions = range;    }    public HSSFCellRangeAddress getCellRangeAddress( )    {        return this.field_regions;    }    /**     * gets the option flags field.     * @return options - the option flags field     */    public int getOptionFlags()    {       return this.field_option_flags;    }    public String toString()    {      /** @todo DVRecord string representation */        StringBuffer buffer = new StringBuffer();        return buffer.toString();    }    public int serialize(int offset, byte [] data)    {        int size = this.getRecordSize();        LittleEndian.putShort(data, 0 + offset, sid);        LittleEndian.putShort(data, 2 + offset, ( short ) (size-4));        int pos = 4;        LittleEndian.putInt(data, pos + offset, this.getOptionFlags());        pos += 4;        pos += ((StringHandler)this._hash_strings.get( DVRecord.STRING_PROMPT_TITLE )).serialize(pos+offset, data);        pos += ((StringHandler)this._hash_strings.get( DVRecord.STRING_ERROR_TITLE )).serialize(pos+offset, data);        pos += ((StringHandler)this._hash_strings.get( DVRecord.STRING_PROMPT_TEXT )).serialize(pos+offset, data);        pos += ((StringHandler)this._hash_strings.get( DVRecord.STRING_ERROR_TEXT )).serialize(pos+offset, data);        LittleEndian.putShort(data, offset+pos, this.field_size_first_formula);        pos += 2;        LittleEndian.putShort(data, offset+pos, this.field_not_used_1);        pos += 2;        for (int k = 0; k < this.field_rpn_token_1.size(); k++)        {            Ptg ptg = ( Ptg ) this.field_rpn_token_1.get(k);            ptg.writeBytes(data, pos+offset);            pos += ptg.getSize();        }        LittleEndian.putShort(data, offset+pos, this.field_size_sec_formula);        pos += 2;        LittleEndian.putShort(data, offset+pos, this.field_not_used_2);        pos += 2;        if ( this.field_size_sec_formula > 0 )        {          for (int k = 0; k < this.field_rpn_token_2.size(); k++)          {              Ptg ptg = ( Ptg ) this.field_rpn_token_2.get(k);              ptg.writeBytes(data, pos+offset);              pos += ptg.getSize();          }        }        this.field_regions.serialize(pos+offset, data);        return size;    }    public int getRecordSize()    {        int size = 4+4+2+2+2+2;//header+options_field+first_formula_size+first_unused+sec_formula_size+sec+unused;        if ( this._hash_strings != null )        {            Enumeration enum_keys = this._hash_strings.keys();            while ( enum_keys.hasMoreElements() )            {                size += ((StringHandler)this._hash_strings.get( (Integer)enum_keys.nextElement() )).getSize();            }        }        size += this.field_size_first_formula+ this.field_size_sec_formula;        size += this.field_regions.getSize();        return size;    }    public short getSid()    {        return this.sid;    }        /**     * Clones the object. Uses serialisation, as the     *  contents are somewhat complex     */    public Object clone() {    	return cloneViaReserialise();    }    /**@todo DVRecord = Serializare */    private class StringHandler    {        private int     _string_length       = 0x0001;        private byte    _string_unicode_flag = 0x00;        private String  _string_data         = "0x00";        private int     _start_offset;        private int     _end_offset;        StringHandler()        {        }        StringHandler(RecordInputStream in)        {            this.fillFields(in);        }        protected void fillFields(RecordInputStream in)         {            this._string_length       = in.readUShort();             this._string_unicode_flag = in.readByte();             if (this._string_unicode_flag == 1)            {            	this._string_data = in.readUnicodeLEString(this._string_length);            }            else            {                this._string_data = in.readCompressedUnicode(this._string_length);            }        }        private void setStringData( String string_data )        {          this._string_data = string_data;        }        private String getStringData()        {            return this._string_data;        }        private int getEndOffset()        {            return this._end_offset;        }        public int serialize( int offset, byte[] data )        {            LittleEndian.putUShort(data, offset, this._string_length );            data[2 + offset] = this._string_unicode_flag;            if (this._string_unicode_flag == 1)            {                StringUtil.putUnicodeLE(this._string_data, data, 3 + offset);            }            else            {                StringUtil.putCompressedUnicode(this._string_data, data, 3 + offset);            }            return getSize();        }        private void setUnicodeFlag( byte flag )        {            this._string_unicode_flag = flag;        }        private void setStringLength( int len )        {           this._string_length = len;        }        private int getStringByteLength()        {            return (this._string_unicode_flag == 1) ? this._string_length * 2 : this._string_length;        }        public int getSize()        {            return 2 + 1 + getStringByteLength();        }    }}

⌨️ 快捷键说明

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