Re: T5 Error in 5.0.5 palette.js

2007-10-04 Thread Joel Wiegman

Just tacking onto the thread that a patch is available for the problem
discussed in this thread:

https://issues.apache.org/jira/browse/TAPESTRY-1745

Seems like a pretty unintrusive fix... Anxiously awaiting for a committer to
test and include...



Howard Lewis Ship wrote:
 
 Please add this as an issue in JIRA if you have not done so already.
 
 On 8/28/07, Daniel Jue [EMAIL PROTECTED] wrote:

 When using the Palette component, I am getting a Javascript error in IE,

 Line: 183
 Char: 1
 Error: Expected identifier, string or number
 Code: 0

 
   reorderSelected : function(movers,  before) {
 movers.each (function(option) { this.selected.add(option, before);
 }.bind(this));

 this.updateHidden();
 this.updateButtons();
   },
 };

 Line 183 is the line after the };

 I think the extra comma after the end of the reorderSelected code block
 is
 to blame.
 For me it was causing an error in IE6 which prevented me from using the
 select button in the Palette.

 I removed the extra comma, but then when I highlight some items and
 click
 the select button, I get a Type Mismatch error on the comma at the end of
 this function:

   moveOption : function(option, to, atEnd) {
 var before = null;

 if (!atEnd) {
   var optionOrder = this.valueToOrderIndex[option.value];
   var candidate = $A(to.options).find(function (o) {
 return this.valueToOrderIndex[o.value]  optionOrder;
 }.bind(this));
   if (candidate) before = candidate;
 }

 to.add(option, before);
   },

 Is the T5 Palette working fine for anyone using IE?
 The IE Version I am testing is
 6.0.2900.2180.xpsp_sp2_gdr.070227-2254


 Everything works fine in Firefox, of course.

 
 
 
 -- 
 Howard M. Lewis Ship
 Partner and Senior Architect at Feature50
 
 Creator Apache Tapestry and Apache HiveMind
 
 

-- 
View this message in context: 
http://www.nabble.com/T5-Error-in-5.0.5-palette.js-tf4344484.html#a13042126
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Error in 5.0.5 palette.js

2007-09-12 Thread Howard Lewis Ship
Please add this as an issue in JIRA if you have not done so already.

On 8/28/07, Daniel Jue [EMAIL PROTECTED] wrote:

 When using the Palette component, I am getting a Javascript error in IE,

 Line: 183
 Char: 1
 Error: Expected identifier, string or number
 Code: 0

 
   reorderSelected : function(movers,  before) {
 movers.each (function(option) { this.selected.add(option, before);
 }.bind(this));

 this.updateHidden();
 this.updateButtons();
   },
 };

 Line 183 is the line after the };

 I think the extra comma after the end of the reorderSelected code block is
 to blame.
 For me it was causing an error in IE6 which prevented me from using the
 select button in the Palette.

 I removed the extra comma, but then when I highlight some items and
 click
 the select button, I get a Type Mismatch error on the comma at the end of
 this function:

   moveOption : function(option, to, atEnd) {
 var before = null;

 if (!atEnd) {
   var optionOrder = this.valueToOrderIndex[option.value];
   var candidate = $A(to.options).find(function (o) {
 return this.valueToOrderIndex[o.value]  optionOrder;
 }.bind(this));
   if (candidate) before = candidate;
 }

 to.add(option, before);
   },

 Is the T5 Palette working fine for anyone using IE?
 The IE Version I am testing is
 6.0.2900.2180.xpsp_sp2_gdr.070227-2254


 Everything works fine in Firefox, of course.




-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind


Re: T5 Error in 5.0.5 palette.js

2007-09-12 Thread Daniel Jue
I have not added a JIRA, but here is the EnhancedPalette I whipped up
using other people's code. =)

http://wiki.apache.org/tapestry/Tapestry5EnhancedPalette?action=show

Daniel Jue

On 9/12/07, Howard Lewis Ship [EMAIL PROTECTED] wrote:
 Please add this as an issue in JIRA if you have not done so already.

 On 8/28/07, Daniel Jue [EMAIL PROTECTED] wrote:
 
  When using the Palette component, I am getting a Javascript error in IE,
 
  Line: 183
  Char: 1
  Error: Expected identifier, string or number
  Code: 0
 
  
reorderSelected : function(movers,  before) {
  movers.each (function(option) { this.selected.add(option, before);
  }.bind(this));
 
  this.updateHidden();
  this.updateButtons();
},
  };
 
  Line 183 is the line after the };
 
  I think the extra comma after the end of the reorderSelected code block is
  to blame.
  For me it was causing an error in IE6 which prevented me from using the
  select button in the Palette.
 
  I removed the extra comma, but then when I highlight some items and
  click
  the select button, I get a Type Mismatch error on the comma at the end of
  this function:
 
moveOption : function(option, to, atEnd) {
  var before = null;
 
  if (!atEnd) {
var optionOrder = this.valueToOrderIndex[option.value];
var candidate = $A(to.options).find(function (o) {
  return this.valueToOrderIndex[o.value]  optionOrder;
  }.bind(this));
if (candidate) before = candidate;
  }
 
  to.add(option, before);
},
 
  Is the T5 Palette working fine for anyone using IE?
  The IE Version I am testing is
  6.0.2900.2180.xpsp_sp2_gdr.070227-2254
 
 
  Everything works fine in Firefox, of course.
 



 --
 Howard M. Lewis Ship
 Partner and Senior Architect at Feature50

 Creator Apache Tapestry and Apache HiveMind


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Error in 5.0.5 palette.js

2007-09-12 Thread Nick Westgate

There is a JIRA:
https://issues.apache.org/jira/browse/TAPESTRY-1745

Cheers,
Nick.


Howard Lewis Ship wrote:

Please add this as an issue in JIRA if you have not done so already.

On 8/28/07, Daniel Jue [EMAIL PROTECTED] wrote:

When using the Palette component, I am getting a Javascript error in IE,

Line: 183
Char: 1
Error: Expected identifier, string or number
Code: 0


  reorderSelected : function(movers,  before) {
movers.each (function(option) { this.selected.add(option, before);
}.bind(this));

this.updateHidden();
this.updateButtons();
  },
};

Line 183 is the line after the };

I think the extra comma after the end of the reorderSelected code block is
to blame.
For me it was causing an error in IE6 which prevented me from using the
select button in the Palette.

I removed the extra comma, but then when I highlight some items and
click
the select button, I get a Type Mismatch error on the comma at the end of
this function:

  moveOption : function(option, to, atEnd) {
var before = null;

if (!atEnd) {
  var optionOrder = this.valueToOrderIndex[option.value];
  var candidate = $A(to.options).find(function (o) {
return this.valueToOrderIndex[o.value]  optionOrder;
}.bind(this));
  if (candidate) before = candidate;
}

to.add(option, before);
  },

Is the T5 Palette working fine for anyone using IE?
The IE Version I am testing is
6.0.2900.2180.xpsp_sp2_gdr.070227-2254


Everything works fine in Firefox, of course.







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Error in 5.0.5 palette.js

2007-09-11 Thread Joel Wiegman

Did anyone find a workaround for this?  Is there a JIRA defect for it?

As much as I like Firefox, Internet Explorer is unfortunately the browser of
choice still.  Shame that the palette doesn't work with it.




Daniel Jue wrote:
 
 When using the Palette component, I am getting a Javascript error in IE,
 
 Line: 183
 Char: 1
 Error: Expected identifier, string or number
 Code: 0
 
 
   reorderSelected : function(movers,  before) {
 movers.each (function(option) { this.selected.add(option, before);
 }.bind(this));
 
 this.updateHidden();
 this.updateButtons();
   },
 };
 
 Line 183 is the line after the };
 
 I think the extra comma after the end of the reorderSelected code block is
 to blame.
 For me it was causing an error in IE6 which prevented me from using the
 select button in the Palette.
 
 I removed the extra comma, but then when I highlight some items and
 click
 the select button, I get a Type Mismatch error on the comma at the end of
 this function:
 
   moveOption : function(option, to, atEnd) {
 var before = null;
 
 if (!atEnd) {
   var optionOrder = this.valueToOrderIndex[option.value];
   var candidate = $A(to.options).find(function (o) {
 return this.valueToOrderIndex[o.value]  optionOrder;
 }.bind(this));
   if (candidate) before = candidate;
 }
 
 to.add(option, before);
   },
 
 Is the T5 Palette working fine for anyone using IE?
 The IE Version I am testing is
 6.0.2900.2180.xpsp_sp2_gdr.070227-2254
 
 
 Everything works fine in Firefox, of course.
 
 

-- 
View this message in context: 
http://www.nabble.com/T5-Error-in-5.0.5-palette.js-tf4344484.html#a12618996
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Error in 5.0.5 palette.js

2007-08-28 Thread Martin Reurings
Without having a look at the rest of the code I can tell you without a 
doubt you are on the right track there.
When using Object Notation Firefox has some weird parsing error which 
allows it to successfully parse an object that has the illegal syntax 
you just highlighted. Make no mistake though, only Firefox is capable of 
this, Opera probably chokes on it and I know Safari will for sure.


If you'd be developing using Eclipse it may help to open up that JS code 
in JSEclipse (Free download from Adobe), it has a reasonably 
well-behaving syntax checker, it might help you fixing up the syntax :)


Daniel Jue wrote:

When using the Palette component, I am getting a Javascript error in IE,

Line: 183
Char: 1
Error: Expected identifier, string or number
Code: 0


  reorderSelected : function(movers,  before) {
movers.each (function(option) { this.selected.add(option, before);
}.bind(this));

this.updateHidden();
this.updateButtons();
  },
};

Line 183 is the line after the };

I think the extra comma after the end of the reorderSelected code block is
to blame.
For me it was causing an error in IE6 which prevented me from using the
select button in the Palette.

I removed the extra comma, but then when I highlight some items and click
the select button, I get a Type Mismatch error on the comma at the end of
this function:

  moveOption : function(option, to, atEnd) {
var before = null;

if (!atEnd) {
  var optionOrder = this.valueToOrderIndex[option.value];
  var candidate = $A(to.options).find(function (o) {
return this.valueToOrderIndex[o.value]  optionOrder;
}.bind(this));
  if (candidate) before = candidate;
}

to.add(option, before);
  },

Is the T5 Palette working fine for anyone using IE?
The IE Version I am testing is
6.0.2900.2180.xpsp_sp2_gdr.070227-2254


Everything works fine in Firefox, of course.

  


--
(   /'  _/_ __  _ _
|/|///)(/(/(//_(-/
   _/
E-mail: [EMAIL PROTECTED]
Website: http://www.windgazer.nl

The trouble with doing something right the first time, is nobody
appreciates how difficult it was.
  -- Unknown Artist


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Error in 5.0.5 palette.js

2007-08-28 Thread Daniel Jue
I am using JS Eclipse, however I am no javascript wizard. :-)
JSEclipse didn't complaint about the extra comma!

I just had a look at the T4 pallet js (from the apache trunk) and it does
not have a comma after the end of the function listing.  However, the T4
version is way different and uses some dojo constructs as well as some
deprecation handling at the bottom.

https://svn.apache.org/repos/asf/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/


Here is the full T5 version, as of T5.0.5:


Tapestry.Palette = Class.create();
Tapestry.Palette.prototype = {
  initialize : function(id, reorder, naturalOrder) {
this.reorder = reorder;
// The SELECT elements

  this.avail = $(id + :avail);
  this.selected = $(id);

  this.hidden = $(id + :values);

  // Seperator used for values in the hidden field.
  this.sep = ;;

  // The BUTTON elements
  this.select = $(id + :select);
  this.deselect = $(id + :deselect);

  if (this.reorder) {
this.up = $(id + :up);
this.down = $(id + :down);
  }

  this.valueToOrderIndex = {};

  naturalOrder.split(this.sep).each(function (value, i) {
this.valueToOrderIndex[value] = i; }.bind(this));

  this.bindEvents();
  },

  bindEvents : function() {
var updateButtons = this.updateButtons.bindAsEventListener(this);
Event.observe(this.avail, change, updateButtons);
Event.observe(this.selected, change, updateButtons);

var selectClicked = this.selectClicked.bindAsEventListener(this);
Event.observe(this.select, click, selectClicked);
Event.observe(this.avail, dblclick, selectClicked);

var deselectClicked = this.deselectClicked.bindAsEventListener(this);

Event.observe(this.deselect, click, deselectClicked);
Event.observe(this.selected, dblclick, deselectClicked);

if (this.reorder) {
  Event.observe(this.up, click, this.moveUpClicked.bindAsEventListener
(this));
  Event.observe(this.down, click,
this.moveDownClicked.bindAsEventListener(this));
}
  },

  updateButtons: function() {
this.select.disabled = this.avail.selectedIndex  0;

var nothingSelected = this.selected.selectedIndex  0;

this.deselect.disabled = nothingSelected;

if (this.reorder) {
  this.up.disabled = nothingSelected || this.allSelectionsAtTop();
  this.down.disabled = nothingSelected || this.allSelectionsAtBottom();
}
  },

  indexOfLastSelection : function(select) {
if (select.selectedIndex  0) return -1;

for (var i = select.options.length - 1; i = select.selectedIndex; i--)
{
  if (select.options[i].selected) return i;
}

return -1;
  },

  allSelectionsAtTop: function() {
var last = this.indexOfLastSelection(this.selected);
var options = $A(this.selected.options);

return ! options.slice(0, last).any(function (o) { return ! o.selected;
});
  },

  allSelectionsAtBottom : function() {
var options = $A(this.selected.options);

// Make sure that all elements from the (first) selectedIndex to the end
are also selected.
return options.slice(this.selected.selectedIndex).all(function(o) {
return o.selected; });
  },

  selectClicked : function(event) {
 this.transferOptions(this.avail, this.selected, this.reorder);
  },

  deselectClicked : function(event) {
 this.transferOptions(this.selected, this.avail, false);
  },

  transferOptions : function (from, to, atEnd) {
// from: SELECT to move option(s) from (those that are selected)
// to: SELECT to add option(s) to
// atEnd : if true, add at end, otherwise by natural sort order
var toOptions = $A(to.options);

toOptions.each(function(option) { option.selected = false; });

var movers = this.removeSelectedOptions(from);
this.moveOptions(movers, to, atEnd);

  },

  updateHidden : function() {
// Every value in the selected list (whether enabled or not) is combined
to form the value.
var values = $A(this.selected).map(function(o) { return o.value; });

this.hidden.value = values.join(this.sep);
  },

  moveUpClicked : function(event) {
var pos = this.selected.selectedIndex - 1;
var movers = this.removeSelectedOptions(this.selected);

var before = pos  0 ? this.selected.options[0] : this.selected.options
[pos];

this.reorderSelected(movers, before);

Event.stop(event);
  },

  removeSelectedOptions : function(select) {
var movers = [];
var options = select.options;

for (var i = select.selectedIndex; i  select.length; i++) {
  var option = options[i];
  if (option.selected) {
select.remove(i--);
movers.push(option);
  }
}

return movers;
  },

  moveOptions : function(movers, to, atEnd) {

movers.each(function(option) { this.moveOption(option, to, atEnd);
}.bind(this));

this.updateHidden();
this.updateButtons();
  },

  moveOption : function(option, to, atEnd) {
var before = null;
if (!atEnd) {
  

Re: T5 Error in 5.0.5 palette.js

2007-08-28 Thread Martin Reurings
I suppose I'd have to make the time to test through the Palette 
component to figure this one out. The syntax appears to be correct 
(apart from the trailing comma you already identified) and the lack of 
comments obscures a lot of what's going on.


There's some (to me) really obscure eventhandling going on which doesn't 
really help in understanding what could be going wrong :) My guess would 
be that IE doesn't change the state of something quite in the way 
FireFox would (judging from the bug you already solved it wasn't tested 
in anything else) and as a result you now don't have a set of objects to 
move, or something along those lines. Think along the lines of events 
which in FF are global, while in IE they only fire on the element.


Probably the best way to get some clarity is by adding a few alerts in 
some key places and compare the results of those alert between FF and 
IE. Just because it works in FF doesn't mean it's correct BTW.


I'm certain it's not a matter of syntax though!

Daniel Jue wrote:

I am using JS Eclipse, however I am no javascript wizard. :-)
JSEclipse didn't complaint about the extra comma!

I just had a look at the T4 pallet js (from the apache trunk) and it does
not have a comma after the end of the function listing.  However, the T4
version is way different and uses some dojo constructs as well as some
deprecation handling at the bottom.

https://svn.apache.org/repos/asf/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/


Here is the full T5 version, as of T5.0.5:


Tapestry.Palette = Class.create();
Tapestry.Palette.prototype = {
  initialize : function(id, reorder, naturalOrder) {
this.reorder = reorder;
// The SELECT elements

  this.avail = $(id + :avail);
  this.selected = $(id);

  this.hidden = $(id + :values);

  // Seperator used for values in the hidden field.
  this.sep = ;;

  // The BUTTON elements
  this.select = $(id + :select);
  this.deselect = $(id + :deselect);

  if (this.reorder) {
this.up = $(id + :up);
this.down = $(id + :down);
  }

  this.valueToOrderIndex = {};

  naturalOrder.split(this.sep).each(function (value, i) {
this.valueToOrderIndex[value] = i; }.bind(this));

  this.bindEvents();
  },

  bindEvents : function() {
var updateButtons = this.updateButtons.bindAsEventListener(this);
Event.observe(this.avail, change, updateButtons);
Event.observe(this.selected, change, updateButtons);

var selectClicked = this.selectClicked.bindAsEventListener(this);
Event.observe(this.select, click, selectClicked);
Event.observe(this.avail, dblclick, selectClicked);

var deselectClicked = this.deselectClicked.bindAsEventListener(this);

Event.observe(this.deselect, click, deselectClicked);
Event.observe(this.selected, dblclick, deselectClicked);

if (this.reorder) {
  Event.observe(this.up, click, this.moveUpClicked.bindAsEventListener
(this));
  Event.observe(this.down, click,
this.moveDownClicked.bindAsEventListener(this));
}
  },

  updateButtons: function() {
this.select.disabled = this.avail.selectedIndex  0;

var nothingSelected = this.selected.selectedIndex  0;

this.deselect.disabled = nothingSelected;

if (this.reorder) {
  this.up.disabled = nothingSelected || this.allSelectionsAtTop();
  this.down.disabled = nothingSelected || this.allSelectionsAtBottom();
}
  },

  indexOfLastSelection : function(select) {
if (select.selectedIndex  0) return -1;

for (var i = select.options.length - 1; i = select.selectedIndex; i--)
{
  if (select.options[i].selected) return i;
}

return -1;
  },

  allSelectionsAtTop: function() {
var last = this.indexOfLastSelection(this.selected);
var options = $A(this.selected.options);

return ! options.slice(0, last).any(function (o) { return ! o.selected;
});
  },

  allSelectionsAtBottom : function() {
var options = $A(this.selected.options);

// Make sure that all elements from the (first) selectedIndex to the end
are also selected.
return options.slice(this.selected.selectedIndex).all(function(o) {
return o.selected; });
  },

  selectClicked : function(event) {
 this.transferOptions(this.avail, this.selected, this.reorder);
  },

  deselectClicked : function(event) {
 this.transferOptions(this.selected, this.avail, false);
  },

  transferOptions : function (from, to, atEnd) {
// from: SELECT to move option(s) from (those that are selected)
// to: SELECT to add option(s) to
// atEnd : if true, add at end, otherwise by natural sort order
var toOptions = $A(to.options);

toOptions.each(function(option) { option.selected = false; });

var movers = this.removeSelectedOptions(from);
this.moveOptions(movers, to, atEnd);

  },

  updateHidden : function() {
// Every value in the selected list (whether enabled or not) is combined
to form the value.

Re: T5 Error in 5.0.5 palette.js

2007-08-28 Thread Thiago H. de Paula Figueiredo
Em Tue, 28 Aug 2007 20:51:30 -0300, Martin Reurings [EMAIL PROTECTED]  
escreveu:


Probably the best way to get some clarity is by adding a few alerts in  
some key places and compare the results of those alert between FF and  
IE. Just because it works in FF doesn't mean it's correct BTW.


T5's Palette buttons do not work on Opera either. They are rendered with  
disabled=disabled, something that is very strange. The same is rendered  
to Firefox, but in Firefox it works. It seems to me that Opera is doing  
the right thing (ignoring clicks in a button declared with  
disabled=disabled). Am I right?


Thiago

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Error in 5.0.5 palette.js

2007-08-28 Thread Martin Reurings
Actually throwing an onclick event (which is what I assume is being 
used) on a disabled item isn't forbidden by specification.


But, it shouldn't be the cause of Opera's unwillingness to function. In 
the updateButtons method the disabled state of the buttons should be 
update in accordance to the Palletes' state (select should be enabled if 
there's available options etc.). So we may conclude this Component has 
not been tested outside FireFox :)


Thiago H. de Paula Figueiredo wrote:
Em Tue, 28 Aug 2007 20:51:30 -0300, Martin Reurings 
[EMAIL PROTECTED] escreveu:


Probably the best way to get some clarity is by adding a few alerts 
in some key places and compare the results of those alert between FF 
and IE. Just because it works in FF doesn't mean it's correct BTW.


T5's Palette buttons do not work on Opera either. They are rendered 
with disabled=disabled, something that is very strange. The same is 
rendered to Firefox, but in Firefox it works. It seems to me that 
Opera is doing the right thing (ignoring clicks in a button declared 
with disabled=disabled). Am I right?


Thiago

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]