diff --git a/extra/jheidi/createTableEvents.ajl b/extra/jheidi/createTableEvents.ajl index 45255afa..03938304 100644 --- a/extra/jheidi/createTableEvents.ajl +++ b/extra/jheidi/createTableEvents.ajl @@ -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."); } diff --git a/extra/jheidi/createTableState.ajl b/extra/jheidi/createTableState.ajl index 1f4c3c40..df11e0be 100644 --- a/extra/jheidi/createTableState.ajl +++ b/extra/jheidi/createTableState.ajl @@ -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); diff --git a/extra/jheidi/fieldListEvents.ajl b/extra/jheidi/fieldListEvents.ajl index 69b600e2..456b881a 100644 --- a/extra/jheidi/fieldListEvents.ajl +++ b/extra/jheidi/fieldListEvents.ajl @@ -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")); } - - - - - - - - + \ No newline at end of file diff --git a/extra/jheidi/lib/ajl.jar b/extra/jheidi/lib/ajl.jar index 228b83ad..e2b37825 100644 Binary files a/extra/jheidi/lib/ajl.jar and b/extra/jheidi/lib/ajl.jar differ