Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Smartfield - Key Shortcut for Browse New
Smartfield - Key Shortcut for Browse New [message #902068] Wed, 15 August 2012 17:47 Go to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
I am using getConfiguredBrowseNewText() and execBrowseNew(String searchText) on a Smartfield. This displays the "New" link as desired:

index.php/fa/11198/0/

How do I create a key shortcut for this link? Simply adding a key stroke to the smartfield doesn't seem to work when the proposal form is open.
Re: Smartfield - Key Shortcut for Browse New [message #903842 is a reply to message #902068] Sun, 26 August 2012 09:49 Go to previous messageGo to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
By overriding

protected ISmartFieldProposalForm createProposalForm() throws ProcessingException;


and patching the New Button to IButton.DISPLAY_STYLE_DEFAULT

import org.eclipse.scout.commons.exception.ProcessingException;
import org.eclipse.scout.rt.client.ui.form.fields.button.IButton;
import org.eclipse.scout.rt.client.ui.form.fields.smartfield.ISmartField;
import org.eclipse.scout.rt.client.ui.form.fields.smartfield.SmartTableForm;

public class KeyStrokeSmartTableForm extends SmartTableForm {

  public KeyStrokeSmartTableForm(ISmartField<?> smartField) throws ProcessingException {
    super(smartField);
  }

  @Override
  protected void execInitForm() throws ProcessingException {
    super.execInitForm();
    getNewButton().setDisplayStyleInternal(IButton.DISPLAY_STYLE_DEFAULT);
  }

}


it is at least possible to use button mnemonics to execute the button using the keyboard.

However, it would be great to use f-keys as well without replacing the whole SmartTableForm.
Re: Smartfield - Key Shortcut for Browse New [message #904047 is a reply to message #903842] Mon, 27 August 2012 16:14 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Hi Adrian

Defining a key stroke for the browse new link does not seems to be supported yet. I tried it with adding a class of AbstractKeyStroke to the SmartTableForm, but with no success either.
The approach we usually use is to define a new menu on the smartfield (which supports key strokes).

      @Order(10.0)
      public class SectorField extends AbstractSmartField<Long> {

        @Override
        protected String getConfiguredLabel() {
          return TEXTS.get("Sector");
        }

        @Override
        protected Class<? extends LookupCall> getConfiguredLookupCall() {
          return CompanySectorLookupCall.class;
        }

        @Order(10.0)
        public class NewSectorMenu extends AbstractMenu {

          @Override
          protected String getConfiguredText() {
            return TEXTS.get("NewSector_");
          }

          @Override
          protected boolean getConfiguredEmptySpaceAction() {
            return true;
          }

          @Override
          protected void execAction() throws ProcessingException {
            newAction();
          }

          @Override
          protected String getConfiguredKeyStroke() {
            return "F3";
          }
        }

        private void newAction() {
          // add desired action here         
        }

        public class F3KeyStroke extends AbstractKeyStroke {

          @Override
          protected String getConfiguredKeyStroke() {
            return "F3";
          }

          @Override
          protected void execAction() throws ProcessingException {
            newAction();
          }
        }
      }


Regards
Stephan
Re: Smartfield - Key Shortcut for Browse New [message #904327 is a reply to message #904047] Tue, 28 August 2012 08:49 Go to previous messageGo to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
Thanks for your suggestion, Stephan.

But the key stroke action of the menu is not executed when the proposal form is open.
What I want, is a user-friendly way to add new entries to a smartfield:
- user types a 'ABC'
- smartfield proposal form opens, 'ABC' is not found
- when the value is not available, the user should be able to press a key shortcut and open a form to create the new entry with 'ABC' prefilled
Re: Smartfield - Key Shortcut for Browse New [message #905573 is a reply to message #904327] Thu, 30 August 2012 16:55 Go to previous messageGo to next message
Stephan Merkli is currently offline Stephan MerkliFriend
Messages: 40
Registered: April 2012
Member
Hi Adrian

This does not seem to be possible right now. What you need is something like a getConfiguredBrowseNewKeyStroke method on AbstractSmartField, am I right? Can you create a bugzilla ticket for this.

Thanks!

Stephan
Re: Smartfield - Key Shortcut for Browse New [message #905837 is a reply to message #902068] Fri, 31 August 2012 07:13 Go to previous messageGo to next message
Adrian MoserFriend
Messages: 67
Registered: March 2011
Member
I opened ticket
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388494

Thanks for your support.
Re: Smartfield - Key Shortcut for Browse New [message #1709121 is a reply to message #902068] Thu, 24 September 2015 08:27 Go to previous message
Rudolf Koschel is currently offline Rudolf KoschelFriend
Messages: 2
Registered: September 2015
Junior Member
have a look at getConfiguredBrowseNewText() in AbstractContentAssistField.
/**
   * When the smart proposal finds no matching records and this property is not
   * null, then it displays a link or menu with this label.<br>
   * When clicked the method {@link #execBrowseNew(String)} is invoked, which in
   * most cases is implemented as opening a "New XY..." dialog
   */
Previous Topic:Creating new Form to TablePage
Next Topic:[Blog Post] Maven repository for Mylyn Wikitext
Goto Forum:
  


Current Time: Thu Mar 28 21:57:37 GMT 2024

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

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

Back to the top