Skip to main content



      Home
Home » Eclipse Projects » Eclipse Scout » Sequence Shortcuts
Sequence Shortcuts [message #821510] Thu, 15 March 2012 09:06 Go to next message
Eclipse UserFriend
I'm currently migrating an old Scout 1 application written in SQL Windows to the new Eclipse Scout. In the old application, sequences boxes in search forms offered a shortcut: if you filled out the "from" part and hit TAB, the value would be copied to the "to" part, such that if you wanted to search for a particular value, all you had to do was type the value into the "from" part and hit RET.

This no longer works. If you would like to experiment with this little user interface tweak, try this AbstractSequenceShortcutBox instead of the standard AbstractSequenceBox.

package com.bsiag.pista.client.ui.searchforms;

import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.rt.client.ui.form.fields.IValueField;
import org.eclipse.scout.rt.client.ui.form.fields.sequencebox.AbstractSequenceBox;

public class AbstractSequenceShortcutBox extends AbstractSequenceBox {

  @Override
  protected <T extends Comparable<T>> void execCheckFromTo(IValueField<T>[] valueFields, int changedIndex) throws ProcessingException {
    super.execCheckFromTo(valueFields, changedIndex);
    if (changedIndex == 0
        && valueFields.length > 1
        && valueFields[1].isEmpty()) {
      valueFields[1].setValue(valueFields[0].getValue());
    }
  }
}


This hooks into the checkFromTo functionality of sequence boxes. If you didn't disable the from-to check, chances are that the datatypes of the two fields are compatible enough for this assignment to work. Wink

[Updated on: Thu, 15 March 2012 09:08] by Moderator

Re: Sequence Shortcuts [message #821531 is a reply to message #821510] Thu, 15 March 2012 09:44 Go to previous messageGo to next message
Eclipse UserFriend
execCheckFromTo is a CHECK and should not be used to change values, only to check.
You may trying execChangedValue on the first field and then call setValue on the second.
Does this work?
Re: Sequence Shortcuts [message #821534 is a reply to message #821531] Thu, 15 March 2012 09:48 Go to previous message
Eclipse UserFriend
I don't think execChangedValue is called for the AbstractSequenceBox when one of its child fields is changed.

I agree with you regarding the hack nature of the code.

[Updated on: Thu, 15 March 2012 09:48] by Moderator

Previous Topic:Deploy on Linux
Next Topic:BeanArrayHolder and FormData
Goto Forum:
  


Current Time: Wed Jul 23 09:50:51 EDT 2025

Powered by FUDForum. Page generated in 0.04356 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top