Jelajahi Sumber

input working more or less

Benjamin Van Ryseghem 11 tahun lalu
induk
melakukan
2de09a3004

+ 11 - 0
js/Helios-Commands-Browser.deploy.js

@@ -287,6 +287,17 @@ smalltalk.HLMoveMethodToCommand.klass);
 
 
 smalltalk.addClass('HLMoveMethodToClassCommand', smalltalk.HLMoveMethodToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+"_displayLabel",
+smalltalk.method({
+selector: "displayLabel",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return "select a class";
+}, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLMoveMethodToClassCommand)})},
+messageSends: []}),
+smalltalk.HLMoveMethodToClassCommand);
+
 smalltalk.addMethod(
 "_execute",
 smalltalk.method({

+ 16 - 0
js/Helios-Commands-Browser.js

@@ -402,6 +402,22 @@ smalltalk.HLMoveMethodToCommand.klass);
 
 
 smalltalk.addClass('HLMoveMethodToClassCommand', smalltalk.HLMoveMethodToCommand, [], 'Helios-Commands-Browser');
+smalltalk.addMethod(
+"_displayLabel",
+smalltalk.method({
+selector: "displayLabel",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
return "select a class";
+}, function($ctx1) {$ctx1.fill(self,"displayLabel",{},smalltalk.HLMoveMethodToClassCommand)})},
+args: [],
+source: "displayLabel\x0a\x09^ 'select a class'",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLMoveMethodToClassCommand);
+
 smalltalk.addMethod(
 "_execute",
 smalltalk.method({

+ 111 - 68
js/Helios-KeyBindings.deploy.js

@@ -245,6 +245,7 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
var $2,$3,$4,$5,$1;
 $2=_st((smalltalk.HLBindingInput || HLBindingInput))._new();
 _st($2)._label_(_st(_st(self)._command())._inputLabel());
+_st($2)._ghostText_(_st(_st(self)._command())._displayLabel());
 _st($2)._callback_((function(val,errorBlock){
 return smalltalk.withContext(function($ctx2) {
$3=_st(self)._command();
 _st($3)._input_(val);
@@ -256,7 +257,7 @@ $5=_st($2)._yourself();
 $1=$5;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
-messageSends: ["label:", "inputLabel", "command", "new", "callback:", "input:", "errorBlock:", "execute", "yourself"]}),
+messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "callback:", "input:", "errorBlock:", "execute", "yourself"]}),
 smalltalk.HLBindingAction);
 
 smalltalk.addMethod(
@@ -472,24 +473,37 @@ smalltalk.HLBindingGroup);
 
 
 
-smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'inputText', 'wrapper', 'binder'], 'Helios-KeyBindings');
+smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'inputText', 'wrapper', 'binder', 'ghostText', 'isFinal'], 'Helios-KeyBindings');
 smalltalk.addMethod(
 "_applyOn_",
 smalltalk.method({
 selector: "applyOn:",
 fn: function (aKeyBinder){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $early={};
-try {
-_st(self)._evaluate_onError_(_st(self)._input(),(function(){
+return smalltalk.withContext(function($ctx1) { 
_st(self)._isFinal_(true);
+_st(self)._inputText_(_st(_st(_st(self)._input())._asJQuery())._val());
+_st(self)._evaluate_onError_(_st(self)._inputText(),(function(){
 return smalltalk.withContext(function($ctx2) {
_st(self)._errorStatus();
 _st(self)._refresh();
-throw $early=[false];
+return _st(self)._isFinal_(false);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-return self}
-catch(e) {if(e===$early)return e[0]; throw e}
-}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
-messageSends: ["evaluate:onError:", "input", "errorStatus", "refresh"]}),
+return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
+messageSends: ["isFinal:", "inputText:", "val", "asJQuery", "input", "evaluate:onError:", "inputText", "errorStatus", "refresh"]}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_atKey_",
+smalltalk.method({
+selector: "atKey:",
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(aKey).__eq((13));
+if(! smalltalk.assert($1)){
+return nil;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
+messageSends: ["ifFalse:", "="]}),
 smalltalk.HLBindingInput);
 
 smalltalk.addMethod(
@@ -556,6 +570,30 @@ return self}, function($ctx1) {$ctx1.fill(self,"evaluate:onError:",{aString:aStr
 messageSends: ["value:value:", "callback"]}),
 smalltalk.HLBindingInput);
 
+smalltalk.addMethod(
+"_ghostText",
+smalltalk.method({
+selector: "ghostText",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=self["@ghostText"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
+messageSends: []}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_ghostText_",
+smalltalk.method({
+selector: "ghostText:",
+fn: function (aText){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@ghostText"]=aText;
+return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
+messageSends: []}),
+smalltalk.HLBindingInput);
+
 smalltalk.addMethod(
 "_input",
 smalltalk.method({
@@ -563,10 +601,10 @@ selector: "input",
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(_st(self["@input"])._asJQuery())._val();
+$1=self["@input"];
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
-messageSends: ["val", "asJQuery"]}),
+messageSends: []}),
 smalltalk.HLBindingInput);
 
 smalltalk.addMethod(
@@ -610,6 +648,54 @@ return smalltalk.withContext(function($ctx1) { 
return true;
 messageSends: []}),
 smalltalk.HLBindingInput);
 
+smalltalk.addMethod(
+"_isFinal",
+smalltalk.method({
+selector: "isFinal",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $2,$1;
+$2=self["@isFinal"];
+if(($receiver = $2) == nil || $receiver == undefined){
+self["@isFinal"]=smalltalk.HLBinding.fn.prototype._isFinal.apply(_st(self), []);
+$1=self["@isFinal"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
+messageSends: ["ifNil:", "isFinal"]}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_isFinal_",
+smalltalk.method({
+selector: "isFinal:",
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@isFinal"]=aBoolean;
+return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
+messageSends: []}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_privateRenderOn_html_",
+smalltalk.method({
+selector: "privateRenderOn:html:",
+fn: function (aBinder,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+$1=_st(html)._input();
+_st($1)._class_("controls");
+_st($1)._type_("text");
+_st($1)._placeholder_(_st(self)._ghostText());
+$2=_st($1)._with_(_st(self)._inputText());
+self["@input"]=$2;
+_st(_st(self["@input"])._asJQuery())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"privateRenderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
+messageSends: ["class:", "input", "type:", "placeholder:", "ghostText", "with:", "inputText", "focus", "asJQuery"]}),
+smalltalk.HLBindingInput);
+
 smalltalk.addMethod(
 "_refresh",
 smalltalk.method({
@@ -624,12 +710,9 @@ return $2;
 } else {
 $1;
 };
-_st(_st(self["@wrapper"])._asJQuery())._empty();
-_st((function(html){
-return smalltalk.withContext(function($ctx2) {
return _st(self)._renderActionFor_html_(self["@binder"],html);
-}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+_st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
 return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
-messageSends: ["ifNil:", "empty", "asJQuery", "appendToJQuery:", "renderActionFor:html:"]}),
+messageSends: ["ifNil:", "class:", ",", "status"]}),
 smalltalk.HLBindingInput);
 
 smalltalk.addMethod(
@@ -647,66 +730,26 @@ messageSends: []}),
 smalltalk.HLBindingInput);
 
 smalltalk.addMethod(
-"_renderActionFor_html_",
+"_renderOn_html_",
 smalltalk.method({
-selector: "renderActionFor:html:",
-fn: function (aBinder,html){
+selector: "renderOn:html:",
+fn: function (aBinder,root){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$2,$4,$5,$3,$6;
+return smalltalk.withContext(function($ctx1) { 
var $1;
 self["@binder"]=aBinder;
 $1=self["@wrapper"];
 if(($receiver = $1) == nil || $receiver == undefined){
-self["@wrapper"]=_st(html)._span();
+self["@wrapper"]=_st(root)._span();
 self["@wrapper"];
 } else {
 $1;
 };
-$2=self["@wrapper"];
-_st($2)._class_(_st("control-group ").__comma(_st(self)._status()));
-$3=_st($2)._with_((function(){
-return smalltalk.withContext(function($ctx2) {
$4=_st(html)._input();
-_st($4)._class_("input");
-_st($4)._placeholder_(_st(self)._displayLabel());
-$5=_st($4)._with_(_st(self)._inputText());
-self["@input"]=$5;
-return self["@input"];
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-_st(self["@input"])._onKeyPress_((function(event){
-return smalltalk.withContext(function($ctx2) {
$6=_st(_st(event)._keyCode()).__eq((13));
-if(smalltalk.assert($6)){
-return _st(self)._applyOn_(aBinder);
-};
-}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
-_st(_st(self["@input"])._asJQuery())._focus();
-return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
-messageSends: ["ifNil:", "span", "class:", ",", "status", "with:", "input", "placeholder:", "displayLabel", "inputText", "onKeyPress:", "ifTrue:", "applyOn:", "=", "keyCode", "focus", "asJQuery"]}),
-smalltalk.HLBindingInput);
-
-smalltalk.addMethod(
-"_renderOn_html_",
-smalltalk.method({
-selector: "renderOn:html:",
-fn: function (aBinder,html){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$3,$4,$2,$5;
-$1=_st(html)._span();
-_st($1)._class_("command");
-$2=_st($1)._with_((function(){
-return smalltalk.withContext(function($ctx2) {
$3=_st(html)._input();
-_st($3)._class_("search-query");
-$4=_st($3)._placeholder_(_st(self)._displayLabel());
-self["@input"]=$4;
-return self["@input"];
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-_st(self["@input"])._onKeyPress_((function(event){
-return smalltalk.withContext(function($ctx2) {
$5=_st(_st(event)._keyCode()).__eq((13));
-if(smalltalk.assert($5)){
-return _st(self)._applyOn_(aBinder);
-};
-}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
-_st(_st(self["@input"])._asJQuery())._focus();
-return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
-messageSends: ["class:", "span", "with:", "input", "placeholder:", "displayLabel", "onKeyPress:", "ifTrue:", "applyOn:", "=", "keyCode", "focus", "asJQuery"]}),
+_st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
return _st(self)._privateRenderOn_html_(self["@binder"],html);
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,root:root},smalltalk.HLBindingInput)})},
+messageSends: ["ifNil:", "span", "class:", ",", "status", "appendToJQuery:", "asJQuery", "privateRenderOn:html:"]}),
 smalltalk.HLBindingInput);
 
 smalltalk.addMethod(

+ 147 - 79
js/Helios-KeyBindings.js

@@ -336,6 +336,7 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
var $2,$3,$4,$5,$1;
 $2=_st((smalltalk.HLBindingInput || HLBindingInput))._new();
 _st($2)._label_(_st(_st(self)._command())._inputLabel());
+_st($2)._ghostText_(_st(_st(self)._command())._displayLabel());
 _st($2)._callback_((function(val,errorBlock){
 return smalltalk.withContext(function($ctx2) {
$3=_st(self)._command();
 _st($3)._input_(val);
@@ -348,8 +349,8 @@ $1=$5;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"inputBinding",{},smalltalk.HLBindingAction)})},
 args: [],
-source: "inputBinding\x0a\x09^ HLBindingInput new\x0a\x09\x09label: self command inputLabel;\x0a\x09\x09callback: [ :val :errorBlock | \x0a\x09\x09\x09self command \x0a\x09\x09\x09\x09input: val;\x0a\x09\x09\x09\x09errorBlock: errorBlock;\x0a\x09\x09\x09\x09execute ];\x0a\x09\x09yourself",
-messageSends: ["label:", "inputLabel", "command", "new", "callback:", "input:", "errorBlock:", "execute", "yourself"],
+source: "inputBinding\x0a\x09^ HLBindingInput new\x0a\x09\x09label: self command inputLabel;\x0a\x09\x09ghostText: self command displayLabel;\x0a\x09\x09callback: [ :val :errorBlock | \x0a\x09\x09\x09self command \x0a\x09\x09\x09\x09input: val;\x0a\x09\x09\x09\x09errorBlock: errorBlock;\x0a\x09\x09\x09\x09execute ];\x0a\x09\x09yourself",
+messageSends: ["label:", "inputLabel", "command", "new", "ghostText:", "displayLabel", "callback:", "input:", "errorBlock:", "execute", "yourself"],
 referencedClasses: ["HLBindingInput"]
 }),
 smalltalk.HLBindingAction);
@@ -637,7 +638,7 @@ smalltalk.HLBindingGroup);
 
 
 
-smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'inputText', 'wrapper', 'binder'], 'Helios-KeyBindings');
+smalltalk.addClass('HLBindingInput', smalltalk.HLBinding, ['input', 'callback', 'status', 'inputText', 'wrapper', 'binder', 'ghostText', 'isFinal'], 'Helios-KeyBindings');
 smalltalk.addMethod(
 "_applyOn_",
 smalltalk.method({
@@ -645,19 +646,37 @@ selector: "applyOn:",
 category: 'actions',
 fn: function (aKeyBinder){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $early={};
-try {
-_st(self)._evaluate_onError_(_st(self)._input(),(function(){
+return smalltalk.withContext(function($ctx1) { 
_st(self)._isFinal_(true);
+_st(self)._inputText_(_st(_st(_st(self)._input())._asJQuery())._val());
+_st(self)._evaluate_onError_(_st(self)._inputText(),(function(){
 return smalltalk.withContext(function($ctx2) {
_st(self)._errorStatus();
 _st(self)._refresh();
-throw $early=[false];
+return _st(self)._isFinal_(false);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-return self}
-catch(e) {if(e===$early)return e[0]; throw e}
-}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
+return self}, function($ctx1) {$ctx1.fill(self,"applyOn:",{aKeyBinder:aKeyBinder},smalltalk.HLBindingInput)})},
 args: ["aKeyBinder"],
-source: "applyOn: aKeyBinder\x0a\x09self \x0a\x09\x09evaluate: self input \x0a\x09\x09onError: [ \x0a\x09\x09\x09self errorStatus.\x0a\x09\x09\x09self refresh.\x0a\x09\x09\x09^ false ]",
-messageSends: ["evaluate:onError:", "input", "errorStatus", "refresh"],
+source: "applyOn: aKeyBinder\x0a\x0a\x09self isFinal: true.\x0a\x09self inputText: self input asJQuery val.\x0a\x09self \x0a\x09\x09evaluate: self inputText\x0a\x09\x09onError: [ \x0a\x09\x09\x09self errorStatus.\x0a\x09\x09\x09self refresh.\x0a\x09\x09\x09self isFinal: false ]",
+messageSends: ["isFinal:", "inputText:", "val", "asJQuery", "input", "evaluate:onError:", "inputText", "errorStatus", "refresh"],
+referencedClasses: []
+}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_atKey_",
+smalltalk.method({
+selector: "atKey:",
+category: 'accessing',
+fn: function (aKey){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=_st(aKey).__eq((13));
+if(! smalltalk.assert($1)){
+return nil;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"atKey:",{aKey:aKey},smalltalk.HLBindingInput)})},
+args: ["aKey"],
+source: "atKey: aKey\x0a\x09aKey = 13 ifFalse: [ ^ nil ]",
+messageSends: ["ifFalse:", "="],
 referencedClasses: []
 }),
 smalltalk.HLBindingInput);
@@ -751,6 +770,40 @@ referencedClasses: []
 }),
 smalltalk.HLBindingInput);
 
+smalltalk.addMethod(
+"_ghostText",
+smalltalk.method({
+selector: "ghostText",
+category: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1;
+$1=self["@ghostText"];
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"ghostText",{},smalltalk.HLBindingInput)})},
+args: [],
+source: "ghostText\x0a\x09^ ghostText",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_ghostText_",
+smalltalk.method({
+selector: "ghostText:",
+category: 'accessing',
+fn: function (aText){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@ghostText"]=aText;
+return self}, function($ctx1) {$ctx1.fill(self,"ghostText:",{aText:aText},smalltalk.HLBindingInput)})},
+args: ["aText"],
+source: "ghostText: aText\x0a\x09ghostText := aText",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLBindingInput);
+
 smalltalk.addMethod(
 "_input",
 smalltalk.method({
@@ -759,12 +812,12 @@ category: 'accessing',
 fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
var $1;
-$1=_st(_st(self["@input"])._asJQuery())._val();
+$1=self["@input"];
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"input",{},smalltalk.HLBindingInput)})},
 args: [],
-source: "input\x0a\x09^ input asJQuery val",
-messageSends: ["val", "asJQuery"],
+source: "input\x0a\x09^ input",
+messageSends: [],
 referencedClasses: []
 }),
 smalltalk.HLBindingInput);
@@ -825,6 +878,69 @@ referencedClasses: []
 }),
 smalltalk.HLBindingInput);
 
+smalltalk.addMethod(
+"_isFinal",
+smalltalk.method({
+selector: "isFinal",
+category: 'testing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $2,$1;
+$2=self["@isFinal"];
+if(($receiver = $2) == nil || $receiver == undefined){
+self["@isFinal"]=smalltalk.HLBinding.fn.prototype._isFinal.apply(_st(self), []);
+$1=self["@isFinal"];
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isFinal",{},smalltalk.HLBindingInput)})},
+args: [],
+source: "isFinal\x0a\x09^ isFinal ifNil: [ isFinal := super isFinal ]",
+messageSends: ["ifNil:", "isFinal"],
+referencedClasses: []
+}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_isFinal_",
+smalltalk.method({
+selector: "isFinal:",
+category: 'testing',
+fn: function (aBoolean){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
self["@isFinal"]=aBoolean;
+return self}, function($ctx1) {$ctx1.fill(self,"isFinal:",{aBoolean:aBoolean},smalltalk.HLBindingInput)})},
+args: ["aBoolean"],
+source: "isFinal: aBoolean\x0a\x09isFinal := aBoolean",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLBindingInput);
+
+smalltalk.addMethod(
+"_privateRenderOn_html_",
+smalltalk.method({
+selector: "privateRenderOn:html:",
+category: 'rendering',
+fn: function (aBinder,html){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
var $1,$2;
+$1=_st(html)._input();
+_st($1)._class_("controls");
+_st($1)._type_("text");
+_st($1)._placeholder_(_st(self)._ghostText());
+$2=_st($1)._with_(_st(self)._inputText());
+self["@input"]=$2;
+_st(_st(self["@input"])._asJQuery())._focus();
+return self}, function($ctx1) {$ctx1.fill(self,"privateRenderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
+args: ["aBinder", "html"],
+source: "privateRenderOn: aBinder html: html\x0a\x0a\x09input := html input\x0a\x09\x09class: 'controls';\x0a\x09\x09type: 'text';\x0a\x09\x09placeholder: self ghostText;\x0a\x09\x09with: self inputText.\x0a\x09\x09\x09\x09\x0a\x09\x22input onKeyPress: [ :event |\x0a\x09\x09event keyCode = 13 \x0a\x09\x09\x09ifTrue: [ self applyOn: aBinder ] ].\x0a\x09\x22\x09\x09\x09\x0a\x09input asJQuery focus",
+messageSends: ["class:", "input", "type:", "placeholder:", "ghostText", "with:", "inputText", "focus", "asJQuery"],
+referencedClasses: []
+}),
+smalltalk.HLBindingInput);
+
 smalltalk.addMethod(
 "_refresh",
 smalltalk.method({
@@ -840,14 +956,11 @@ return $2;
 } else {
 $1;
 };
-_st(_st(self["@wrapper"])._asJQuery())._empty();
-_st((function(html){
-return smalltalk.withContext(function($ctx2) {
return _st(self)._renderActionFor_html_(self["@binder"],html);
-}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+_st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
 return self}, function($ctx1) {$ctx1.fill(self,"refresh",{},smalltalk.HLBindingInput)})},
 args: [],
-source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a    \x0a\x09wrapper asJQuery empty.\x0a    [ :html | self renderActionFor: binder html: html ] appendToJQuery: wrapper asJQuery",
-messageSends: ["ifNil:", "empty", "asJQuery", "appendToJQuery:", "renderActionFor:html:"],
+source: "refresh\x0a\x09wrapper ifNil: [ ^ self ].\x0a    \x0a\x09wrapper class: 'control-group ', self status.",
+messageSends: ["ifNil:", "class:", ",", "status"],
 referencedClasses: []
 }),
 smalltalk.HLBindingInput);
@@ -872,74 +985,29 @@ referencedClasses: []
 smalltalk.HLBindingInput);
 
 smalltalk.addMethod(
-"_renderActionFor_html_",
+"_renderOn_html_",
 smalltalk.method({
-selector: "renderActionFor:html:",
+selector: "renderOn:html:",
 category: 'rendering',
-fn: function (aBinder,html){
+fn: function (aBinder,root){
 var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$2,$4,$5,$3,$6;
+return smalltalk.withContext(function($ctx1) { 
var $1;
 self["@binder"]=aBinder;
 $1=self["@wrapper"];
 if(($receiver = $1) == nil || $receiver == undefined){
-self["@wrapper"]=_st(html)._span();
+self["@wrapper"]=_st(root)._span();
 self["@wrapper"];
 } else {
 $1;
 };
-$2=self["@wrapper"];
-_st($2)._class_(_st("control-group ").__comma(_st(self)._status()));
-$3=_st($2)._with_((function(){
-return smalltalk.withContext(function($ctx2) {
$4=_st(html)._input();
-_st($4)._class_("input");
-_st($4)._placeholder_(_st(self)._displayLabel());
-$5=_st($4)._with_(_st(self)._inputText());
-self["@input"]=$5;
-return self["@input"];
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-_st(self["@input"])._onKeyPress_((function(event){
-return smalltalk.withContext(function($ctx2) {
$6=_st(_st(event)._keyCode()).__eq((13));
-if(smalltalk.assert($6)){
-return _st(self)._applyOn_(aBinder);
-};
-}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
-_st(_st(self["@input"])._asJQuery())._focus();
-return self}, function($ctx1) {$ctx1.fill(self,"renderActionFor:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
-args: ["aBinder", "html"],
-source: "renderActionFor: aBinder html: html\x0a\x09binder := aBinder.\x0a\x09wrapper ifNil: [ wrapper := html span ].\x0a\x09\x0a\x09wrapper\x0a\x09\x09class: 'control-group ', self status; \x0a\x09\x09with: [\x0a\x09\x09\x09input := html input\x0a\x09\x09\x09\x09class: 'input';\x0a\x09\x09\x09\x09placeholder: self displayLabel;\x0a\x09\x09\x09\x09with: self inputText ].\x0a\x09\x09\x09\x09\x0a\x09input onKeyPress: [ :event |\x0a\x09\x09event keyCode = 13 \x0a\x09\x09\x09ifTrue: [ self applyOn: aBinder ] ].\x0a\x09\x09\x09\x09\x0a\x09input asJQuery focus",
-messageSends: ["ifNil:", "span", "class:", ",", "status", "with:", "input", "placeholder:", "displayLabel", "inputText", "onKeyPress:", "ifTrue:", "applyOn:", "=", "keyCode", "focus", "asJQuery"],
-referencedClasses: []
-}),
-smalltalk.HLBindingInput);
-
-smalltalk.addMethod(
-"_renderOn_html_",
-smalltalk.method({
-selector: "renderOn:html:",
-category: 'accessing',
-fn: function (aBinder,html){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
var $1,$3,$4,$2,$5;
-$1=_st(html)._span();
-_st($1)._class_("command");
-$2=_st($1)._with_((function(){
-return smalltalk.withContext(function($ctx2) {
$3=_st(html)._input();
-_st($3)._class_("search-query");
-$4=_st($3)._placeholder_(_st(self)._displayLabel());
-self["@input"]=$4;
-return self["@input"];
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}));
-_st(self["@input"])._onKeyPress_((function(event){
-return smalltalk.withContext(function($ctx2) {
$5=_st(_st(event)._keyCode()).__eq((13));
-if(smalltalk.assert($5)){
-return _st(self)._applyOn_(aBinder);
-};
-}, function($ctx2) {$ctx2.fillBlock({event:event},$ctx1)})}));
-_st(_st(self["@input"])._asJQuery())._focus();
-return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,html:html},smalltalk.HLBindingInput)})},
-args: ["aBinder", "html"],
-source: "renderOn: aBinder html: html\x0a\x09html span \x0a\x09\x09class: 'command'; \x0a\x09\x09with: [\x0a\x09\x09\x09input := html input\x0a\x09\x09\x09\x09class: 'search-query';\x0a\x09\x09\x09\x09placeholder: self displayLabel ].\x0a\x09\x09\x09\x09\x0a\x09input onKeyPress: [:event |\x0a\x09\x09event keyCode = 13 ifTrue: [\x0a\x09\x09\x09self applyOn: aBinder ] ].\x0a\x09\x09\x09\x09\x0a\x09input asJQuery focus",
-messageSends: ["class:", "span", "with:", "input", "placeholder:", "displayLabel", "onKeyPress:", "ifTrue:", "applyOn:", "=", "keyCode", "focus", "asJQuery"],
+_st(self["@wrapper"])._class_(_st("control-group ").__comma(_st(self)._status()));
+_st((function(html){
+return smalltalk.withContext(function($ctx2) {
return _st(self)._privateRenderOn_html_(self["@binder"],html);
+}, function($ctx2) {$ctx2.fillBlock({html:html},$ctx1)})}))._appendToJQuery_(_st(self["@wrapper"])._asJQuery());
+return self}, function($ctx1) {$ctx1.fill(self,"renderOn:html:",{aBinder:aBinder,root:root},smalltalk.HLBindingInput)})},
+args: ["aBinder", "root"],
+source: "renderOn: aBinder html: root\x0a\x09binder := aBinder.\x0a\x09wrapper ifNil: [ wrapper := root span ].\x0a\x09\x0a\x09wrapper class: 'control-group ', self status.\x0a\x09\x0a\x09[:html | self privateRenderOn: binder html: html ] appendToJQuery: wrapper asJQuery",
+messageSends: ["ifNil:", "span", "class:", ",", "status", "appendToJQuery:", "asJQuery", "privateRenderOn:html:"],
 referencedClasses: []
 }),
 smalltalk.HLBindingInput);

+ 32 - 28
st/Helios-Commands-Browser.st

@@ -1,7 +1,7 @@
 Smalltalk current createPackage: 'Helios-Commands-Browser'!
 HLModelCommand subclass: #HLBrowserCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLBrowserCommand class methodsFor: 'instance creation'!
 
@@ -12,8 +12,8 @@ for: aBrowserModel
 ! !
 
 HLBrowserCommand subclass: #HLBrowserGoToCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLBrowserGoToCommand class methodsFor: 'accessing'!
 
@@ -26,8 +26,8 @@ label
 ! !
 
 HLBrowserGoToCommand subclass: #HLGoToClassesCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLGoToClassesCommand methodsFor: 'executing'!
 
@@ -48,8 +48,8 @@ label
 ! !
 
 HLBrowserGoToCommand subclass: #HLGoToMethodsCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLGoToMethodsCommand methodsFor: 'executing'!
 
@@ -70,8 +70,8 @@ label
 ! !
 
 HLBrowserGoToCommand subclass: #HLGoToPackagesCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLGoToPackagesCommand methodsFor: 'executing'!
 
@@ -92,8 +92,8 @@ label
 ! !
 
 HLBrowserGoToCommand subclass: #HLGoToProtocolsCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLGoToProtocolsCommand methodsFor: 'executing'!
 
@@ -114,8 +114,8 @@ label
 ! !
 
 HLBrowserGoToCommand subclass: #HLGoToSourceCodeCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLGoToSourceCodeCommand methodsFor: 'executing'!
 
@@ -136,8 +136,8 @@ label
 ! !
 
 HLBrowserCommand subclass: #HLMoveToCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLMoveToCommand class methodsFor: 'accessing'!
 
@@ -150,8 +150,8 @@ label
 ! !
 
 HLMoveToCommand subclass: #HLMoveMethodToCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLMoveMethodToCommand methodsFor: 'testing'!
 
@@ -170,11 +170,15 @@ label
 ! !
 
 HLMoveMethodToCommand subclass: #HLMoveMethodToClassCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLMoveMethodToClassCommand methodsFor: 'accessing'!
 
+displayLabel
+	^ 'select a class'
+!
+
 inputLabel
 	^ 'Move method to class:'
 ! !
@@ -202,8 +206,8 @@ label
 ! !
 
 HLMoveMethodToCommand subclass: #HLMoveMethodToProtocolCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLMoveMethodToProtocolCommand methodsFor: 'executing'!
 
@@ -222,8 +226,8 @@ label
 ! !
 
 HLBrowserCommand subclass: #HLToggleCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLToggleCommand class methodsFor: 'accessing'!
 
@@ -236,8 +240,8 @@ label
 ! !
 
 HLToggleCommand subclass: #HLToggleClassSideCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLToggleClassSideCommand methodsFor: 'executing'!
 
@@ -258,8 +262,8 @@ label
 ! !
 
 HLToggleCommand subclass: #HLToggleInstanceSideCommand
- instanceVariableNames: ''
- package: 'Helios-Commands-Browser'!
+	instanceVariableNames: ''
+	package: 'Helios-Commands-Browser'!
 
 !HLToggleInstanceSideCommand methodsFor: 'executing'!
 

+ 49 - 36
st/Helios-KeyBindings.st

@@ -98,6 +98,7 @@ command: aCommand
 inputBinding
 	^ HLBindingInput new
 		label: self command inputLabel;
+		ghostText: self command displayLabel;
 		callback: [ :val :errorBlock | 
 			self command 
 				input: val;
@@ -197,11 +198,15 @@ isActive
 ! !
 
 HLBinding subclass: #HLBindingInput
-	instanceVariableNames: 'input callback status inputText wrapper binder'
+	instanceVariableNames: 'input callback status inputText wrapper binder ghostText isFinal'
 	package: 'Helios-KeyBindings'!
 
 !HLBindingInput methodsFor: 'accessing'!
 
+atKey: aKey
+	aKey = 13 ifFalse: [ ^ nil ]
+!
+
 callback
 	^ callback ifNil: [ callback := [ :value | ] ]
 !
@@ -210,8 +215,16 @@ callback: aBlock
 	callback := aBlock
 !
 
+ghostText
+	^ ghostText
+!
+
+ghostText: aText
+	ghostText := aText
+!
+
 input
-	^ input asJQuery val
+	^ input
 !
 
 inputText
@@ -222,21 +235,6 @@ inputText: aText
 	inputText := aText
 !
 
-renderOn: aBinder html: html
-	html span 
-		class: 'command'; 
-		with: [
-			input := html input
-				class: 'search-query';
-				placeholder: self displayLabel ].
-				
-	input onKeyPress: [:event |
-		event keyCode = 13 ifTrue: [
-			self applyOn: aBinder ] ].
-				
-	input asJQuery focus
-!
-
 status
 	^ status ifNil: [ status := 'info' ]
 !
@@ -248,12 +246,15 @@ status: aStatus
 !HLBindingInput methodsFor: 'actions'!
 
 applyOn: aKeyBinder
+
+	self isFinal: true.
+	self inputText: self input asJQuery val.
 	self 
-		evaluate: self input 
+		evaluate: self inputText
 		onError: [ 
 			self errorStatus.
 			self refresh.
-			^ false ]
+			self isFinal: false ]
 !
 
 errorStatus
@@ -277,36 +278,48 @@ release
 
 !HLBindingInput methodsFor: 'rendering'!
 
+privateRenderOn: aBinder html: html
+
+	input := html input
+		class: 'controls';
+		type: 'text';
+		placeholder: self ghostText;
+		with: self inputText.
+				
+	"input onKeyPress: [ :event |
+		event keyCode = 13 
+			ifTrue: [ self applyOn: aBinder ] ].
+	"			
+	input asJQuery focus
+!
+
 refresh
 	wrapper ifNil: [ ^ self ].
     
-	wrapper asJQuery empty.
-    [ :html | self renderActionFor: binder html: html ] appendToJQuery: wrapper asJQuery
+	wrapper class: 'control-group ', self status.
 !
 
-renderActionFor: aBinder html: html
+renderOn: aBinder html: root
 	binder := aBinder.
-	wrapper ifNil: [ wrapper := html span ].
+	wrapper ifNil: [ wrapper := root span ].
 	
-	wrapper
-		class: 'control-group ', self status; 
-		with: [
-			input := html input
-				class: 'input';
-				placeholder: self displayLabel;
-				with: self inputText ].
-				
-	input onKeyPress: [ :event |
-		event keyCode = 13 
-			ifTrue: [ self applyOn: aBinder ] ].
-				
-	input asJQuery focus
+	wrapper class: 'control-group ', self status.
+	
+	[:html | self privateRenderOn: binder html: html ] appendToJQuery: wrapper asJQuery
 ! !
 
 !HLBindingInput methodsFor: 'testing'!
 
 isActive
 	^ true
+!
+
+isFinal
+	^ isFinal ifNil: [ isFinal := super isFinal ]
+!
+
+isFinal: aBoolean
+	isFinal := aBoolean
 ! !
 
 Object subclass: #HLKeyBinder