mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
82 lines
2.7 KiB
Plaintext
82 lines
2.7 KiB
Plaintext
import javax.swing.*;
|
|
import java.util.*;
|
|
|
|
WindowContext context = argObj("windowContext");
|
|
|
|
Combo types = context.get("/types");
|
|
|
|
String[] typesArray = new String[] { "tinyint", "mediumint", "int", "bigint", "float", "double","decimal","date",
|
|
"time", "year", "datetime", "timestamp", "char", "varchar", "tinytext", "mediumtext", "text", "longtext",
|
|
"binary", "varbinary", "tinyblob", "blob", "mediumblob", "longblob", "enum", "set", "bit",
|
|
"point", "linestring", "polygon", "geometry", "multipoint", "multilinestring", "multipolygon",
|
|
"geometrycollection" };
|
|
|
|
types.setModel(new DefaultComboBoxModel(typesArray));
|
|
types.events("typeChangeEvents");
|
|
|
|
Object[] widgets = new Object[] { context.get("/binary"), context.get("/unsigned"), context.get("/zeroFill"),
|
|
context.get("/lengthSet"), context.get("/defaultValue") };
|
|
|
|
// p, i, u, b, u, z, n, a, l
|
|
int[] ZERO_6 = new int[] { 0, 2, 1, 1, 1 };
|
|
int[] SEVEN = new int[] { 0, 2, 1, 2, 1 };
|
|
int[] EIGHT_12 = new int[] { 0, 0, 0, 1, 1 };
|
|
int[] THIRT_14 = new int[] { 1, 0, 0, 2, 1 };
|
|
int[] FIFT_18 = new int[] { 1, 0, 0, 0, 0 };
|
|
int[] NINT_20 = new int[] { 0, 0, 0, 2, 1 };
|
|
int[] TWEN1_24 = new int[] { 0, 0, 0, 0, 0 };
|
|
int[] TWEN5_26 = new int[] { 0, 0, 0, 1, 1 };
|
|
int[] TWEN7 = new int[] { 0, 0, 0, 0, 1 };
|
|
int[] TWEN8 = new int[] { 0, 0, 0, 0, 1 };
|
|
|
|
HashObject typeMap = new HashObject();
|
|
HashObject defSizeMap = new HashObject();
|
|
|
|
types.setProperty("typeStateMap", typeMap);
|
|
types.setProperty("defSizeMap", defSizeMap);
|
|
types.setProperty("widgets", widgets);
|
|
|
|
for (int i=0; i < typesArray.length; i++)
|
|
{
|
|
if (i < 6)
|
|
typeMap.put(typesArray[i], ZERO_6);
|
|
else if ( i == 6 )
|
|
typeMap.put(typesArray[i], SEVEN);
|
|
else if ( i < 12 )
|
|
typeMap.put(typesArray[i], EIGHT_12);
|
|
else if ( i < 14 )
|
|
typeMap.put(typesArray[i], THIRT_14);
|
|
else if ( i < 18 )
|
|
typeMap.put(typesArray[i], FIFT_18);
|
|
else if ( i < 20 )
|
|
typeMap.put(typesArray[i], NINT_20);
|
|
else if ( i < 23 )
|
|
typeMap.put(typesArray[i], TWEN1_24);
|
|
else if ( i < 26 )
|
|
typeMap.put(typesArray[i], TWEN5_26);
|
|
else if ( i == 26 )
|
|
typeMap.put(typesArray[i], TWEN7);
|
|
else
|
|
typeMap.put(typesArray[i], TWEN8);
|
|
}
|
|
|
|
defSizeMap.put(typesArray[12], "50");
|
|
defSizeMap.put(typesArray[13], "50");
|
|
defSizeMap.put(typesArray[18], "50");
|
|
defSizeMap.put(typesArray[19], "50");
|
|
defSizeMap.put(typesArray[24], "'Y', 'N'");
|
|
defSizeMap.put(typesArray[25], "'Y', 'N'");
|
|
defSizeMap.put(typesArray[26], "'Y', 'N'");
|
|
|
|
types.select("tinyint");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|