aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2018-05-25 03:22:43 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2018-05-25 03:22:43 +0000
commit9fc9133e7ac8aa072020f6100fce1ff37b6e504a (patch)
treed6e6fff91b734d3f954919fb043f44c47ef8d4b1 /src/main/java
parenta0e9ce63ee510723c60d2db8ce6569c2cca356ea (diff)
parentf5659151a36e02a82b6b52795cb9788ad2c74a4d (diff)
downloadjackcess-9fc9133e7ac8aa072020f6100fce1ff37b6e504a.tar.gz
jackcess-9fc9133e7ac8aa072020f6100fce1ff37b6e504a.zip
merge trunk changes through r1152
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/exprs@1153 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/PropertyMap.java150
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java27
-rw-r--r--src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java10
3 files changed, 173 insertions, 14 deletions
diff --git a/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java b/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
index c93d896..516a098 100644
--- a/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
+++ b/src/main/java/com/healthmarketscience/jackcess/PropertyMap.java
@@ -47,6 +47,10 @@ public interface PropertyMap extends Iterable<PropertyMap.Property>
public static final String ALLOW_MULTI_VALUE_PROP = "AllowMultipleValues";
public static final String ROW_SOURCE_TYPE_PROP = "RowSourceType";
public static final String ROW_SOURCE_PROP = "RowSource";
+ public static final String DISPLAY_CONTROL_PROP = "DisplayControl";
+ public static final String TEXT_FORMAT_PROP = "TextFormat";
+ public static final String IME_MODE_PROP = "IMEMode";
+ public static final String IME_SENTENCE_MODE_PROP = "IMESentenceMode";
public String getName();
@@ -113,7 +117,7 @@ public interface PropertyMap extends Iterable<PropertyMap.Property>
* tolerated and ignored).
*/
public void putAll(Iterable<? extends Property> props);
-
+
/**
* Removes the property with the given name
*
@@ -128,8 +132,8 @@ public interface PropertyMap extends Iterable<PropertyMap.Property>
/**
* Info about a property defined in a PropertyMap.
- */
- public interface Property
+ */
+ public interface Property
{
public String getName();
@@ -153,4 +157,144 @@ public interface PropertyMap extends Iterable<PropertyMap.Property>
*/
public void setValue(Object newValue);
}
+
+ /**
+ * Interface for enums which can be used as property values.
+ */
+ public interface EnumValue
+ {
+ /**
+ * @return the property value which should be stored in the db
+ */
+ public Object getValue();
+ }
+
+ /**
+ * Enum value constants for the DisplayControl property
+ */
+ public enum DisplayControl implements EnumValue
+ {
+ BOUND_OBJECT_FRAME(108),
+ CHECK_BOX(106),
+ COMBO_BOX(111),
+ COMMAND_BUTTON(104),
+ CUSTOM_CONTROL(119),
+ EMPTY_CELL(127),
+ IMAGE(103),
+ LABEL(100),
+ LINE(102),
+ LIST_BOX(110),
+ NAVIGATION_BUTTON(130),
+ NAVIGATION_CONTROL(129),
+ OBJECT_FRAME(114),
+ OPTION_BUTTON(105),
+ OPTION_GROUP(107),
+ PAGE(124),
+ PAGE_BREAK(118),
+ RECTANGLE(101),
+ SUB_FORM(112),
+ TAB_CTL(123),
+ TEXT_BOX(109),
+ TOGGLE_BUTTON(122),
+ WEB_BROWSER(128);
+
+ private final Short _value;
+
+ private DisplayControl(int value) {
+ _value = (short)value;
+ }
+
+ public Short getValue() {
+ return _value;
+ }
+
+ @Override
+ public String toString() {
+ return name() + "[" + _value + "]";
+ }
+ }
+
+ /**
+ * Enum value constants for the TextFormat property
+ */
+ public enum TextFormat implements EnumValue
+ {
+ HTMLRICHTEXT(1),
+ PLAIN(0);
+
+ private final Byte _value;
+
+ private TextFormat(int value) {
+ _value = (byte)value;
+ }
+
+ public Byte getValue() {
+ return _value;
+ }
+
+ @Override
+ public String toString() {
+ return name() + "[" + _value + "]";
+ }
+ }
+
+ /**
+ * Enum value constants for the IMEMode property
+ */
+ public enum IMEMode implements EnumValue
+ {
+ NOCONTROL(0),
+ ON(1),
+ OFF(2),
+ DISABLE(3),
+ HIRAGANA(4),
+ KATAKANA(5),
+ KATAKANAHALF(6),
+ ALPHAFULL(7),
+ ALPHA(8),
+ HANGULFULL(9),
+ HANGUL(10);
+
+ private final Byte _value;
+
+ private IMEMode(int value) {
+ _value = (byte)value;
+ }
+
+ public Byte getValue() {
+ return _value;
+ }
+
+ @Override
+ public String toString() {
+ return name() + "[" + _value + "]";
+ }
+ }
+
+ /**
+ * Enum value constants for the IMESentenceMode property
+ */
+ public enum IMESentenceMode implements EnumValue
+ {
+ NORMAL(0),
+ PLURAL(1),
+ SPEAKING(2),
+ NONE(3);
+
+ private final Byte _value;
+
+ private IMESentenceMode(int value) {
+ _value = (byte)value;
+ }
+
+ public Byte getValue() {
+ return _value;
+ }
+
+ @Override
+ public String toString() {
+ return name() + "[" + _value + "]";
+ }
+ }
+
}
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java
index 137426c..be3a249 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/PropertyMapImpl.java
@@ -55,11 +55,15 @@ public class PropertyMapImpl implements PropertyMap
DEFAULT_TYPES.put(DESCRIPTION_PROP, new PropDef(DataType.MEMO, false));
DEFAULT_TYPES.put(RESULT_TYPE_PROP, new PropDef(DataType.BYTE, true));
DEFAULT_TYPES.put(EXPRESSION_PROP, new PropDef(DataType.MEMO, true));
+ DEFAULT_TYPES.put(DISPLAY_CONTROL_PROP, new PropDef(DataType.INT, false));
+ DEFAULT_TYPES.put(TEXT_FORMAT_PROP, new PropDef(DataType.BYTE, false));
+ DEFAULT_TYPES.put(IME_MODE_PROP, new PropDef(DataType.BYTE, false));
+ DEFAULT_TYPES.put(IME_SENTENCE_MODE_PROP, new PropDef(DataType.BYTE, false));
}
private final String _mapName;
private final short _mapType;
- private final Map<String,Property> _props =
+ private final Map<String,Property> _props =
new LinkedHashMap<String,Property>();
private final PropertyMaps _owner;
@@ -122,8 +126,8 @@ public class PropertyMapImpl implements PropertyMap
for(Property prop : props) {
put(prop);
}
- }
-
+ }
+
public PropertyImpl put(Property prop) {
return put(prop.getName(), prop.getType(), prop.getValue(), prop.isDdl());
}
@@ -131,7 +135,7 @@ public class PropertyMapImpl implements PropertyMap
/**
* Puts a property into this map with the given information.
*/
- public PropertyImpl put(String name, DataType type, Object value,
+ public PropertyImpl put(String name, DataType type, Object value,
boolean isDdl) {
PropertyImpl prop = (PropertyImpl)createProperty(name, type, value, isDdl);
_props.put(DatabaseImpl.toLookupName(name), prop);
@@ -153,7 +157,7 @@ public class PropertyMapImpl implements PropertyMap
@Override
public String toString() {
return toString(this);
- }
+ }
public static String toString(PropertyMap map) {
StringBuilder sb = new StringBuilder();
@@ -173,12 +177,17 @@ public class PropertyMapImpl implements PropertyMap
public static Property createProperty(String name, DataType type, Object value) {
return createProperty(name, type, value, false);
}
-
- public static Property createProperty(String name, DataType type,
+
+ public static Property createProperty(String name, DataType type,
Object value, boolean isDdl) {
// see if this is a builtin property that we already understand
PropDef pd = DEFAULT_TYPES.get(name);
+ if(value instanceof PropertyMap.EnumValue) {
+ // convert custom enum to stored value
+ value = ((PropertyMap.EnumValue)value).getValue();
+ }
+
if(pd != null) {
// update according to the default info
type = ((type == null) ? pd._type : type);
@@ -211,13 +220,13 @@ public class PropertyMapImpl implements PropertyMap
" with value " + value);
}
}
-
+
return new PropertyImpl(name, type, value, isDdl);
}
/**
* Info about a property defined in a PropertyMap.
- */
+ */
static final class PropertyImpl implements PropertyMap.Property
{
private final String _name;
diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java
index 7e996e1..c084ae8 100644
--- a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java
+++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java
@@ -1679,12 +1679,18 @@ public class TableImpl implements Table, PropertyMaps.Owner
umapBuf.putShort(getRowStartOffset(umapRowNum, format), (short)rowStart);
umapBuf.put(rowStart, UsageMap.MAP_TYPE_INLINE);
+ int dataOffset = rowStart + 1;
if(firstUsedPage != null) {
// fill in the first used page of the usage map
- umapBuf.putInt(rowStart + 1, firstUsedPage);
- umapBuf.put(rowStart + 5, (byte)1);
+ umapBuf.putInt(dataOffset, firstUsedPage);
+ dataOffset += 4;
+ umapBuf.put(dataOffset, (byte)1);
+ dataOffset++;
}
+ // zero remaining row data
+ ByteUtil.clearRange(umapBuf, dataOffset, (rowStart + umapRowLength));
+
rowStart -= umapRowLength;
++umapRowNum;
}