mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
create table field list broken
This commit is contained in:
@@ -171,18 +171,23 @@
|
||||
ListBox l = context.get("/fields");
|
||||
ListDataModel model = (ListDataModel)l.getModel();
|
||||
String fieldName = f.getText();
|
||||
if ( fieldName != null )
|
||||
{
|
||||
fieldName = fieldName.trim();
|
||||
}
|
||||
|
||||
if ( fieldName != null && (fieldName.trim().length() > 0) &&
|
||||
!model.contains(fieldName.trim()))
|
||||
if ( fieldName != null && (fieldName.length() > 0) &&
|
||||
!model.contains(fieldName))
|
||||
{
|
||||
model.add(fieldName);
|
||||
l.setSelectedIndex(model.indexOf(fieldName));
|
||||
context.put("addField", true);
|
||||
l.setSelectedIndex(model.indexOf(fieldName)); //why isnt this firing?
|
||||
}
|
||||
else if ( fieldName == null || fieldName.trim().length() == 0 )
|
||||
else if ( fieldName == null || fieldName.length() == 0 )
|
||||
{
|
||||
d.popupMessage("Create Table", "Please enter a field name to add.");
|
||||
}
|
||||
else if ( model.contains(fieldName.trim()) )
|
||||
else if ( model.contains(fieldName) )
|
||||
{
|
||||
d.popupMessage("Create Table", "Field name '" + fieldName.trim() + "' already exists in this table.");
|
||||
}
|
||||
|
||||
@@ -4,16 +4,10 @@
|
||||
|
||||
HashObject ho = l.getProperty(arg("fieldKey"));
|
||||
|
||||
if ( ho == null )
|
||||
{
|
||||
ho = new HashObject();
|
||||
l.setProperty(arg("fieldKey"), ho);
|
||||
}
|
||||
|
||||
log.debug("storing props for: " + arg("fieldKey"));
|
||||
|
||||
//put all values in col map
|
||||
log.debug("ho:" + ho);
|
||||
log.debug("ho (before store):" + ho);
|
||||
ho.put("type", ((Combo)context.get("/types")).getText());
|
||||
ho.put("length", ((Field)context.get("/lengthSet")).getText());
|
||||
ho.put("default", ((Field)context.get("/defaultValue")).getText());
|
||||
@@ -25,7 +19,7 @@
|
||||
ho.put("binary", ((CheckBox)context.get("/binary")).isSelected());
|
||||
ho.put("unsigned", ((CheckBox)context.get("/unsigned")).isSelected());
|
||||
ho.put("zeroFill", ((CheckBox)context.get("/zeroFill")).isSelected());
|
||||
|
||||
log.debug("ho (after store):" + ho);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,58 +5,41 @@
|
||||
String lastSel = l.getProperty("lastSel");
|
||||
String item = (String)l.getSelectedValue();
|
||||
|
||||
boolean addingNewItem = context.get("addField") != null;
|
||||
context.put("addField", null);
|
||||
|
||||
if ( lastSel == null )
|
||||
log.debug("adding new?:" + addingNewItem);
|
||||
log.debug("curItem:" + item);
|
||||
log.debug("lastSel:" + lastSel);
|
||||
|
||||
if ( addingNewItem )
|
||||
{
|
||||
l.setProperty("lastSel", item);
|
||||
HashObject ho = new HashObject();
|
||||
ho.put("colName", item);
|
||||
l.setProperty(item, ho);
|
||||
}
|
||||
else
|
||||
|
||||
args().put("fieldKey", addingNewItem? item : lastSel);
|
||||
script("createTableState", args());
|
||||
|
||||
l.setProperty("lastSel", item);
|
||||
HashObject ho = l.getProperty(item);
|
||||
|
||||
if ( ho != null && !item.equals(lastSel) )
|
||||
{
|
||||
if ( !lastSel.equals(item) )
|
||||
{
|
||||
args().put("fieldKey", lastSel);
|
||||
script("createTableState", args());
|
||||
|
||||
l.setProperty("lastSel", item);
|
||||
HashObject ho = l.getProperty(item);
|
||||
log.debug("getting props for: " + item);
|
||||
if ( ho != null )
|
||||
{
|
||||
log.debug("populating props for: " + item);
|
||||
((Combo)context.get("/types")).select(ho.get("type"));
|
||||
((Field)context.get("/lengthSet")).setText(ho.get("length"));
|
||||
((Field)context.get("/defaultValue")).setText(ho.get("default"));
|
||||
((JCheckBox)context.get("/primary")).setSelected((Boolean)ho.getObject("primary"));
|
||||
((JCheckBox)context.get("/unique")).setSelected((Boolean)ho.getObject("unique"));
|
||||
((JCheckBox)context.get("/index")).setSelected((Boolean)ho.getObject("index"));
|
||||
((JCheckBox)context.get("/notNull")).setSelected((Boolean)ho.getObject("notNull"));
|
||||
((JCheckBox)context.get("/autoInc")).setSelected((Boolean)ho.getObject("autoInc"));
|
||||
((JCheckBox)context.get("/binary")).setSelected((Boolean)ho.getObject("binary"));
|
||||
((JCheckBox)context.get("/unsigned")).setSelected((Boolean)ho.getObject("unsigned"));
|
||||
((JCheckBox)context.get("/zeroFill")).setSelected((Boolean)ho.getObject("zeroFill"));
|
||||
}
|
||||
else
|
||||
{
|
||||
log.debug("no props yet for: " + item + " clearing fields setting new props");
|
||||
//set the type to clear the fields
|
||||
((Combo)context.get("/types")).setProperty("currentCheckState", null);
|
||||
((Combo)context.get("/types")).select(((Combo)context.get("/types")).getText());
|
||||
l.setProperty(item, new HashObject());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
log.debug("populating props for: " + item);
|
||||
((Combo)context.get("/types")).select(ho.get("type"));
|
||||
((Field)context.get("/lengthSet")).setText(ho.get("length"));
|
||||
((Field)context.get("/defaultValue")).setText(ho.get("default"));
|
||||
((JCheckBox)context.get("/primary")).setSelected((Boolean)ho.getObject("primary"));
|
||||
((JCheckBox)context.get("/unique")).setSelected((Boolean)ho.getObject("unique"));
|
||||
((JCheckBox)context.get("/index")).setSelected((Boolean)ho.getObject("index"));
|
||||
((JCheckBox)context.get("/notNull")).setSelected((Boolean)ho.getObject("notNull"));
|
||||
((JCheckBox)context.get("/autoInc")).setSelected((Boolean)ho.getObject("autoInc"));
|
||||
((JCheckBox)context.get("/binary")).setSelected((Boolean)ho.getObject("binary"));
|
||||
((JCheckBox)context.get("/unsigned")).setSelected((Boolean)ho.getObject("unsigned"));
|
||||
((JCheckBox)context.get("/zeroFill")).setSelected((Boolean)ho.getObject("zeroFill"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user