Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Sequence Shortcuts
Sequence Shortcuts [message #821510] Thu, 15 March 2012 13:06 Go to next message
Alex Schroeder is currently offline Alex SchroederFriend
Messages: 38
Registered: February 2010
Location: Zürich, Switzerland
Member

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 13:08]

Report message to a moderator

Re: Sequence Shortcuts [message #821531 is a reply to message #821510] Thu, 15 March 2012 13:44 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 154
Registered: March 2010
Senior Member
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 13:48 Go to previous message
Alex Schroeder is currently offline Alex SchroederFriend
Messages: 38
Registered: February 2010
Location: Zürich, Switzerland
Member

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 13:48]

Report message to a moderator

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


Current Time: Thu Apr 25 08:40:12 GMT 2024

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

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

Back to the top