1 19 package org.openharmonise.swing.datefield; 20 21 30 public class DateBlock { 31 32 35 private DateFormatBlock m_formatBlock = null; 36 37 40 private int m_nStartPos = -1; 41 42 45 private int m_nLength = -1; 46 47 50 private String m_sValue = ""; 51 52 55 private String m_sPreviousValue = ""; 56 57 64 public DateBlock(DateFormatBlock formatBlock, int nStartPos, String sValue) { 65 super(); 66 this.m_formatBlock = formatBlock; 67 this.m_nStartPos = nStartPos; 68 this.m_sValue = sValue; 69 this.m_sPreviousValue = sValue; 70 71 this.setup(); 72 } 73 74 79 public void setPreviousValue(String sPreviousValue) { 80 this.m_sPreviousValue = sPreviousValue; 81 } 82 83 88 public String getPreviousValue() { 89 return this.m_sPreviousValue; 90 } 91 92 96 private void setup() { 97 } 98 99 104 public int getStartPos() { 105 return this.m_nStartPos; 106 } 107 108 113 public void setStartPos(int nStartPos) { 114 this.m_nStartPos = nStartPos; 115 } 116 117 122 public int getLength() { 123 return this.m_sValue.length(); 124 } 125 126 131 public String getValue() { 132 return this.m_sValue; 133 } 134 135 140 public void setValue(String sValue) { 141 this.m_sValue = sValue; 142 } 143 144 149 public DateFormatBlock getFormatBlock() { 150 return this.m_formatBlock; 151 } 152 153 158 public boolean hasValue() { 159 return (!this.getFormatBlock().isActiveBlock() || !this.m_sValue.trim().equalsIgnoreCase(this.m_formatBlock.getEntryFormat().trim())); 160 } 161 162 166 public void clear() { 167 this.m_sValue = this.m_formatBlock.getClearedValue(); 168 this.m_sPreviousValue = this.m_formatBlock.getClearedValue(); 169 } 170 } 171 | Popular Tags |