Files
HeidiSQL/extra/jheidi/createTableDialogOracle.ajl

144 lines
3.7 KiB
Plaintext

import java.awt.Dimension;
import java.awt.Component;
import javax.swing.*;
import java.util.List;
WindowContext parentContext = argObj("windowContext");
Dialog dlg = new Dialog((Frame)parentContext.get("/"), "createTableDialog", "Create Table");
WindowContext context = dlg.getWindowContext();
context.put("db", parentContext.get("db"));
context.put("vendor", parentContext.get("vendor"));
dlg.events("createTableEventsOracle");
dlg.tabLayout()
.icon("images/table.gif")
.insets(10, 10)
.text("Name:", 73)
.setTab()
.field("tableName", 200)
.setTab()
.nextRow()
.tab(1)
.text("Schema:")
.tab(2)
.combo("databases", new String[] {"databases", "There"}, 200)
.nextRow()
.tab(1)
.text("Comment:")
.tab(2)
.field("comment", 200)
.nextRow()
.vspace(5)
.line(595)
.nextRow()
.tab(1)
.text("Columns:")
.nextRow()
.tab(1)
.field("fieldName", 180)
.baseline()
.space(5)
.button("Add", 75)
.setTab()
.space(16)
.vspace(-10)
.groupbox("Column Properties",307,230)
.nextRow()
.vspace(3)
.tab(1)
.listbox("fields", new String[] {}, 180, 186)
.tab(3)
.button("Rename", 75)
.space(38)
.vspace(-13)
.text("Type:", 88)
.setTab()
.combo("types", new String[] {"VARCHAR"}, 170)
.setTab()
.nextRow()
.tab(4)
.text("Length/Set:")
.tab(5)
.field("lengthSet", 170)
.nextRow()
.tab(4)
.text("Default:")
.tab(5)
.field("defaultValue", 170)
.nextRow()
.vspace(LF.isWin?20:10)
.tab(4)
.space(LF.isWin?5:0)
.checkbox("primary", "Primary", 90, false)
.setTab()
.checkbox("index", "Index", 88, false)
.setTab()
.checkbox("notNull", "Not Null", 70, false)
.setTab()
.nextRow();
dlg.baseline((Component)context.get("/Rename"));
dlg.tab(3)
.vspace(1)
.button("Remove", 75)
.nextRow()
.vspace(1)
.tab(3)
.imageButton("Up", "images/up.gif", 75)
.nextRow()
.tab(3)
.vspace(1)
.imageButton("Down", "images/down.gif", 75)
.nextRow();
dlg.baseline((Component)context.get("/fieldsScrollPane"));
dlg.vspace(193)
.line(595)
.nextRow()
.vspace(5)
.space(364)
.button("Create", 110)
.space(5)
.button("Cancel", 110);
Text lbl = context.get("/gbColumn Properties");
JScrollPane listBox = context.get("/fieldsScrollPane");
Field field = context.get("/fieldName");
Text txt = context.get("/Length/Set:");
txt.setText("Length (n[,n]):");
lbl.setPreferredSize(new Dimension(lbl.getPreferredSize().width, listBox.getPreferredSize().height + field.getPreferredSize().height + 21));
//because of this side by side layout we cant use default taborder :(
String[] tabs = new String [] { "/tableName", "/databases", "/comment", "/fieldName", "/fields", "/Add", "/Rename", "/Remove", "/Up", "/Down", "/types", "/lengthSet", "/defaultValue",
"/primary", "/index", "/notNull", "/Create", "/Cancel" };
new TabOrder(dlg, tabs);
((Field)context.get("/tableName")).setText("TableName");
((ListBox)context.get("/fields")).events("fieldListEventsOracle");
final DB db = context.get("db");
final HashObject resultMap = new HashObject();
Combo combo = context.get("/databases");
ComboUtils.populate(combo, (List<String>) parentContext.get("dbsOrSchemas"));
if ( parentContext.get("currentDB") != null )
{
combo.select((String)parentContext.get("currentDB"));
}
HashObject newArgs = new HashObject();
newArgs.put("windowContext", context);
script("initTypes$oracle", newArgs);
dlg.visible();
return context.get("dlgResult");