mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
85 lines
2.0 KiB
Plaintext
85 lines
2.0 KiB
Plaintext
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
WindowContext context = argObj("windowContext");
|
|
|
|
Combo combo = context.get("/types");
|
|
String selection = combo.getText();
|
|
log.debug("selection is: " + selection);
|
|
|
|
HashObject defSizeMap = combo.getProperty("defSizeMap");
|
|
HashObject typeMap = combo.getProperty("typeStateMap");
|
|
Object[] widgets = combo.getProperty("widgets");
|
|
|
|
int[] currentState = combo.getProperty("currentCheckState");
|
|
int[] typeState = (int[])typeMap.getObject(selection);
|
|
|
|
if ( typeState== null )
|
|
return;
|
|
|
|
log.debug("currentState: " + currentState);
|
|
|
|
/*((JCheckBox)context.get("/primary")).setSelected(false);
|
|
((JCheckBox)context.get("/index")).setSelected(false);
|
|
((JCheckBox)context.get("/unique")).setSelected(false);
|
|
((JCheckBox)context.get("/notNull")).setSelected(false);
|
|
((JCheckBox)context.get("/autoInc")).setSelected(false);*/
|
|
|
|
for ( int i = 0; i < widgets.length; i++ )
|
|
{
|
|
if ( currentState == null || (currentState[i] != typeState[i]) )
|
|
{
|
|
boolean enabled = typeState[i] >0;
|
|
boolean selected = typeState[i] == 2;
|
|
|
|
((JComponent)widgets[i]).setEnabled(enabled);
|
|
|
|
if ( widgets[i] instanceof JCheckBox )
|
|
{
|
|
((JCheckBox)widgets[i]).setSelected(selected);
|
|
((JCheckBox)widgets[i]).updateUI();
|
|
}
|
|
else if ( widgets[i] instanceof Field )
|
|
{
|
|
String value = "";
|
|
if ( i == 3 )
|
|
{
|
|
value = defSizeMap.get(selection) == null ? "" :
|
|
defSizeMap.get(selection);
|
|
Text t = context.get("/Length/Set:");
|
|
t.style(selected? Font.BOLD : Font.PLAIN);
|
|
|
|
}
|
|
((Field)widgets[i]).setText(value);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
//ucommented for now this just confuses things
|
|
// combo.setProperty("currentCheckState", typeState);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|