NSNumberFormatter

2013-07-12 Thread Ingenieurbüro Birnfeld - Oliver Birnfeld

Hi,

I have a problem using NSNumberFormatter to validate the input of an 
WOTextField. When e.g. setting formatter.setMinimum(5) and 
formatter.setMaximum(20) then validationFailedWithException is called 
for all values 0, 20, and 1-4 but _not_ for 0.


Here are some code snippets:

Constructor:
inputFormatter=new NSNumberFormatter(#);
inputFormatter.setMaximum(new BigDecimal(20));
inputFormatter.setMinimum(new BigDecimal(5));


public void validationFailedWithException(Throwable t, Object value, 
String keyPath) {

if( keyPath.equals(value)) {
warningVisible=true;
}
validationError=true;
super.validationFailedWithException(t, value, keyPath);
}

public WOActionResults saveSettings() {
if( validationError) {
validationError=false;
return null;
}
return pageWithName(Main);
}

The html code looks like this:

wo:textfield value=$value formatter=$inputFormatter /


Am I missing something?

Thanks!

Regards,
Oliver
___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Create dynamic AjaxTabbedPanelTab in AjaxTabbedPanel with WORepetion

2013-07-12 Thread Raymond NANEON
Hi List,I want to create many of AjaxTabbedPanelTab from WORepetition in AjaxTabbedPanel.html : webobject name = "Tabs" webobject name = "repeatTabbedPanelTab" webobject name = "DynamiqueTab"webobject name = "template" //webobject /webobject /webobjectwod : Tabs : AjaxTabbedPanel { id = tabsId;}repeatTabbedPanelTab : WORepetition { list = competences; item = competenceItem; identifier = dynaTabId;}DynamiqueTab : AjaxTabbedPanelTab { name = libelle; isSelected = false; id = dynaTabId;}template : TemplateCompTierBase { competence = competenceItem; domaine = competenceItem.domaine; editingContext = competenceItem.editingContext;  updateContainerID = TRCompoementId;}In this case (WORepetition in AjaxTabbedPanel) in the repetition item is always NULL.So when I put the AjaxTabbedPanel in the WORepetition, it works fine but I have many of AjaxTabbedPanel instead of many tabs.Thanks for your helpEnvoyé depuis iCloud ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

create new to-many objects in d2w

2013-07-12 Thread Theodore Petrosky
when I create a new to-many object there is a button with a  label 'Save'. I 
understood that this new object was inserted into the EC and I had to click the 
save button at the bottom of my parent EO to actually save the related object.

but of course there is a problem. If I add an object and immediately click its 
delete button, my app throws a hissy-fit because the object can not be deleted 
as it is not saved in the first place.

So the question is. when I create a new object, and click save, shouldn't d2w 
do just that? saveChanges() on the EC?

this is the saveButton's action (from ERMODWizardCreationPage).
/**
 * Performs submit action. Overridden to reset the nested validation setting on 
the
 * object.
 */
 // FIXME - Is this needed here? davidleber
 @Override
 public WOComponent submitAction() throws Throwable {
  WOComponent result = super.submitAction();
  if (object() instanceof ERXGenericRecord) {
 ((ERXGenericRecord)object()).setValidatedWhenNested(true);
  }
 return result;
}

I keep following back the super.submitAction() to see what it does but there is 
no implied saveChanges() anywhere that I can find.


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: create new to-many objects in d2w

2013-07-12 Thread David Holt
The trade-off is that if you save the parent EC form the related EC, you may 
save an edit on the parent that the user is not expecting. In most cases I 
agree with you and I have implemented a true save on the related component to 
reduce the user confusion about the double save.


On 2013-07-12, at 8:33 AM, Theodore Petrosky tedp...@yahoo.com wrote:

 when I create a new to-many object there is a button with a  label 'Save'. I 
 understood that this new object was inserted into the EC and I had to click 
 the save button at the bottom of my parent EO to actually save the related 
 object.
 
 but of course there is a problem. If I add an object and immediately click 
 its delete button, my app throws a hissy-fit because the object can not be 
 deleted as it is not saved in the first place.
 
 So the question is. when I create a new object, and click save, shouldn't d2w 
 do just that? saveChanges() on the EC?
 
 this is the saveButton's action (from ERMODWizardCreationPage).
 /**
  * Performs submit action. Overridden to reset the nested validation setting 
 on the
  * object.
  */
  // FIXME - Is this needed here? davidleber
  @Override
  public WOComponent submitAction() throws Throwable {
   WOComponent result = super.submitAction();
   if (object() instanceof ERXGenericRecord) {
  ((ERXGenericRecord)object()).setValidatedWhenNested(true);
   }
  return result;
 }
 
 I keep following back the super.submitAction() to see what it does but there 
 is no implied saveChanges() anywhere that I can find.
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
 
 This email sent to programming...@mac.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: create new to-many objects in d2w

2013-07-12 Thread Theodore Petrosky
do you clone the component and implement the save function? I was thinking that 
I would take this approach.

interesting when you delete a relationship it does not require the 'double 
save'.



On Jul 12, 2013, at 12:27 PM, David Holt programming...@mac.com wrote:

 The trade-off is that if you save the parent EC form the related EC, you may 
 save an edit on the parent that the user is not expecting. In most cases I 
 agree with you and I have implemented a true save on the related component to 
 reduce the user confusion about the double save.
 
 
 On 2013-07-12, at 8:33 AM, Theodore Petrosky tedp...@yahoo.com wrote:
 
 when I create a new to-many object there is a button with a  label 'Save'. I 
 understood that this new object was inserted into the EC and I had to click 
 the save button at the bottom of my parent EO to actually save the related 
 object.
 
 but of course there is a problem. If I add an object and immediately click 
 its delete button, my app throws a hissy-fit because the object can not be 
 deleted as it is not saved in the first place.
 
 So the question is. when I create a new object, and click save, shouldn't 
 d2w do just that? saveChanges() on the EC?
 
 this is the saveButton's action (from ERMODWizardCreationPage).
 /**
  * Performs submit action. Overridden to reset the nested validation setting 
 on the
  * object.
  */
  // FIXME - Is this needed here? davidleber
  @Override
  public WOComponent submitAction() throws Throwable {
   WOComponent result = super.submitAction();
   if (object() instanceof ERXGenericRecord) {
  ((ERXGenericRecord)object()).setValidatedWhenNested(true);
   }
  return result;
 }
 
 I keep following back the super.submitAction() to see what it does but there 
 is no implied saveChanges() anywhere that I can find.
 
 
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
 
 This email sent to programming...@mac.com
 

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSNumberFormatter

2013-07-12 Thread Chuck Hill
Is the original value zero?  WO might be short-circuiting something if the 
value does not change.  Also try 0 as the format pattern:

 inputFormatter=new NSNumberFormatter(0);


Chuck


On 2013-07-12, at 5:21 AM, Ingenieurbüro Birnfeld - Oliver Birnfeld wrote:

 Hi,
 
 I have a problem using NSNumberFormatter to validate the input of an 
 WOTextField. When e.g. setting formatter.setMinimum(5) and 
 formatter.setMaximum(20) then validationFailedWithException is called for all 
 values 0, 20, and 1-4 but _not_ for 0.
 
 Here are some code snippets:
 
 Constructor:
 inputFormatter=new NSNumberFormatter(#);
 inputFormatter.setMaximum(new BigDecimal(20));
 inputFormatter.setMinimum(new BigDecimal(5));
 
 
 public void validationFailedWithException(Throwable t, Object value, String 
 keyPath) {
if( keyPath.equals(value)) {
warningVisible=true;
}
validationError=true;
super.validationFailedWithException(t, value, keyPath);
 }
   
 public WOActionResults saveSettings() {
if( validationError) {
validationError=false;
return null;
}
return pageWithName(Main);
 }
 
 The html code looks like this:
 
 wo:textfield value=$value formatter=$inputFormatter /
 
 
 Am I missing something?
 
 Thanks!
 
 Regards,
 Oliver
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/chill%40global-village.net
 
 This email sent to ch...@global-village.net

-- 
Chuck Hill 
Executive Managing Partner, VP Development and Technical Services

Practical WebObjects - for developers who want to increase their overall 
knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects

Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing 
Companies in B.C! 

Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
Canada’s Fastest-Growing Companies by PROFIT Magazine!













 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com