Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Form Field in Menu(How to add a Form Field Menu Datepicker to a tablepage?)
Form Field in Menu [message #1798467] Mon, 19 November 2018 15:26 Go to next message
The Maddes is currently offline The MaddesFriend
Messages: 44
Registered: October 2018
Member
Hello,

as i explored the widgets, i stumbled accross this https://scout.bsi-software.com/widgets/?dl=widget-menubar nice piece of menu.

Now i was wondering if i could put it on my tablepage. As said in the release notes of 7.1, one should be ablte to add this menu in any menu supporting environment.
I tried it like in the github linked to the widget with
@Order(50)
    public class MyMenuMenu extends AbstractFormFieldMenu {
      @Order(10)
      public class MenuDateField extends AbstractDateField {

        private final SimpleDateFormat m_dateFormatter = new SimpleDateFormat("MM-dd-yyyy hh:mm");

        @Override
        protected String getConfiguredLabel() {
          return "DateField in MenuBar";
        }

        @Override
        protected byte getConfiguredLabelPosition() {
          return LABEL_POSITION_ON_FIELD;
        }

        @Override
        protected boolean getConfiguredLabelVisible() {
          return false;
        }

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

        @Override
        protected void execChangedValue() {
          getDateFieldValueField().setValue(Optional.ofNullable(getValue()).map(v -> m_dateFormatter.format(v)).orElse(null));
          System.out.println("Date changed to: " + getValue());
        }
      }
    }


I put it inside my table on a tablepage. My other menus on this page work just fine and i wonder what i need to specify to make it work too.
Because i think its a great tool for loading data for a user specified period of time (e.g. in my case the chosen month)

So what part of the implementation did i mess up in the first place?
Thank you in advance!
Re: Form Field in Menu [message #1798517 is a reply to message #1798467] Tue, 20 November 2018 06:17 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Hi TheMaddes

First: Which version of Scout are you using?
FormFields in Menus have been release officially as part of Scout 8 (Eclipse "Photon" Release Train).
The 7.1 version you're referencing is a preview of the Scout 8 release: It does not contain all features that made it into Scout 8 and is not intended for production usage.

There's bit of a trap with TablePages:
You need to add the field to the inner table, not the table page itself, meaning at the same level you'd put a menu on the table.
After falling into this trap and moving the filed to the correct location, it worked for my Scout 8 project on a TablePage.

Patrick
Re: Form Field in Menu [message #1798532 is a reply to message #1798517] Tue, 20 November 2018 08:48 Go to previous messageGo to next message
The Maddes is currently offline The MaddesFriend
Messages: 44
Registered: October 2018
Member
Hey Patrick,

thank you for the answer. Im using Scout 8.0.0.021_Simrel_2018_09 at the moment.
I thought i did that, maybe i have to investigate further, the codesnippet i poseted is inside the table, just like other menus like a new or edit menu (those are showing without any problem). But the datepicker is not.

So to simplify the snippet:
 public class Table extends AbstractTable {
 @Order(10)
    public class EditMenu extends AbstractMenu {...}
@Order(20)
    public class NewMenu extends AbstractMenu {...}
 @Order(50)
    public class MyMenuMenu extends AbstractFormFieldMenu {
      @Order(10)
      public class MenuDateField extends AbstractDateField {...}
}
...all the columns etc
}


So i think i already placed it as you said or did i get you wrong?

UPDATE:
It seems the behaviour is like the behaviour of a edit menu, It shows up now, but only on selection of sth in the table. I dont get why though, and i need it to show like a new menu so i can use it to filter data for a specific month/day chosen by the user.

EDIT:
Ok nevermind, i figured it out, forgot to set it as a tablemenutype, shame on me :) But thank you so far :)

[Updated on: Tue, 20 November 2018 10:08]

Report message to a moderator

Re: Form Field in Menu [message #1798615 is a reply to message #1798532] Wed, 21 November 2018 08:26 Go to previous message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Great that it works now - I was already wondering since I copied your snippet and it worked great :)
Previous Topic:java.lang.SecurityException: access denied (code 3a).
Next Topic:Login with Database connection
Goto Forum:
  


Current Time: Wed Dec 11 19:41:32 GMT 2019

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

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

Back to the top