Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » No way to hide search Form in SWING??
icon11.gif  No way to hide search Form in SWING?? [message #1577158] Wed, 21 January 2015 18:54 Go to next message
Justin B is currently offline Justin BFriend
Messages: 19
Registered: January 2015
Location: New Jersey, USA
Junior Member
Is there no way to hide the search form in a Table Page when using Swing??
I have tried to set minimized and un-ticked 'modular'. Am I missing a config setting? Or is this just not possible?
Re: No way to hide search Form in SWING?? [message #1585445 is a reply to message #1577158] Mon, 26 January 2015 09:13 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
I think you can hide a form using: IDesktop.removeForm(IForm) and display it again using IDesktop.addForm(IForm).
The model of the form (field values etc.) stays untouched.

The Desktop holds already a reference to to the SearchForm instance. I think that you can use that.

Here some code that hide/display the SearchForm using 2 menus defined in the Desktop form:
@Order(10.0)
public class HideSearchFormMenu extends AbstractExtensibleMenu {

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

  @Override
  protected void execAction() throws ProcessingException {
    IForm searchForm = getPageSearchForm();
    if (searchForm != null) {
      removeForm(searchForm);
    }
  }
}

@Order(20.0)
public class DisplaySearchFormMenu extends AbstractExtensibleMenu {

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

  @Override
  protected void execAction() throws ProcessingException {
    IForm searchForm = getPageSearchForm();
    if (searchForm != null) {
      addForm(searchForm);
    }
  }
}


Feel free to continue the discussion if you have additional question or if my answer did not help you.
Re: No way to hide search Form in SWING?? [message #1585916 is a reply to message #1585445] Mon, 26 January 2015 15:07 Go to previous message
Justin B is currently offline Justin BFriend
Messages: 19
Registered: January 2015
Location: New Jersey, USA
Junior Member
You Rock Jeremie!! Thanks for your input. I wanted to achieve this with a toggle button so here is how I implemented:

  @Order(10.0)
  public class SearchTool extends AbstractFormToolButton {

    @Override
    protected String getConfiguredIconId() {
      return AbstractIcons.SmartFieldBrowse;
    }

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

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

    @Override
    protected void execAction() throws ProcessingException {
      IForm searchForm = getPageSearchForm();
      if (searchForm.isShowing() == true) {
        removeForm(searchForm);
      }
      else {
        addForm(searchForm);
      }
    }
  }
Previous Topic:Button width and style
Next Topic:OutlinePage with Form only?
Goto Forum:
  


Current Time: Fri Apr 26 20:44:44 GMT 2024

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

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

Back to the top