📄 jahiafloatfield.java
字号:
// JahiaFloatField// YG 08.08.2001package org.jahia.data.fields;import java.util.*; // Vector, Calendarimport org.jahia.utils.*; import org.jahia.data.*; import org.jahia.params.*; // ParamBeanimport org.jahia.sharing.*; // JahiaDataSourceManagerimport org.jahia.exceptions.JahiaException;import org.jahia.registries.*; // Registriespublic class JahiaFloatField extends JahiaField implements JahiaSimpleField{ /*** * constructor * YG * */ public JahiaFloatField(Integer ID, Integer jahiaID, Integer pageID, Integer ctnid, Integer fieldDefID, Integer fieldType, Integer connectType, String fieldValue, Integer rank, Integer aclID ) { super(ID, jahiaID, pageID, ctnid, fieldDefID, fieldType, connectType, fieldValue, rank, aclID); } // end constructor public void load(int loadFlag, ParamBean jParams) throws JahiaException { switch (this.getConnectType()) { case (ConnectionTypes.LOCAL) : //this.setValue(this.getValue()); if (!this.getValue().equals("<empty>")) { this.setRawValue(this.getValue()); this.setValue(FormDataManager.getInstance().decode(this.getValue())); if (this.getValue() != null && !this.getValue().equals("")) { try { this.setObject(new Double( this.getValue() )); } catch (NumberFormatException e) { this.setObject(new Double( 0.0 )); this.setValue(""); } } else { this.setObject(new Double( 0.0 )); } } break; case (ConnectionTypes.DATASOURCE) : if ((loadFlag & LoadFlags.DATASOURCE) != 0) { this.setValue( JahiaDataSourceManager.getInstance(). fields().getInstance().getRemoteFieldValue( this.getValue() )); if (this.getValue() != null && !this.getValue().equals("")) { try { this.setObject(new Double( this.getValue() )); } catch (NumberFormatException e) { this.setObject(new Double( 0.0 )); this.setValue(""); } } else { this.setObject(new Double( 0.0 )); } } } } public void save(ParamBean jParams) throws JahiaException { ; } public void delete(ParamBean jParams) throws JahiaException { ; } /** * Returns an hashtable of indexable attributes , pairs [attribute name/value]. * Returned pairs: * ("value",val) the float value * * @return Hashtable a map of indexable attributes , pairs [attribute name/value] */ public Hashtable getIndexableAttributes(){ Hashtable hash = new Hashtable(); hash.put("value",getValue()); return hash; } public String getEngineName() { return "org.jahia.engines.shared.Float_Field"; } public String getFieldContent4Ranking() { return this.getValue(); } public String getIconNameOff() { return "r_off"; } public String getIconNameOn() { return "r_on"; } public JahiaField cloneField(int newctnid, int newPageID, int clonedAclID, boolean childrenCloned) throws JahiaException { JahiaField clonedField = ServicesRegistry.getInstance().getJahiaFieldService(). createJahiaField(0, this.getJahiaID(), newPageID, newctnid, this.getFieldDefID(), this.getType(), this.getConnectType(), this.getValue(), this.getRank(), clonedAclID ); //toDebug("cloneField(): value = "+this.getValue()); if (clonedField == null) { throw new JahiaException ("Could not clone field.", "Could not instanciate a new JahiaField object.", JahiaException.PAGE_ERROR, JahiaException.CRITICAL); } clonedField.setRawValue(this.getRawValue()); clonedField.setObject( this.getObject() ); clonedField.setProperties( (Hashtable)(this.getProperties()).clone() ); return clonedField; } public Object clone() { Object objItem = this.getObject(); JahiaFloatField ff = new JahiaFloatField (new Integer(ID), new Integer(jahiaID), new Integer(pageID), new Integer(ctnid), new Integer(fieldDefID), new Integer(fieldType), new Integer(connectType), fieldValue, new Integer(rank), new Integer(aclID) ); ff.setObject(objItem); return ff; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -