Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Switching between table pages(opening a table page with a menu)
Switching between table pages [message #1062125] Thu, 06 June 2013 06:58 Go to next message
Shweta Tiwari is currently offline Shweta TiwariFriend
Messages: 10
Registered: February 2013
Junior Member
Hi,

I am working on a scout project where I have to open a table page from a menu. I can open form with menu option but I am unable to open table page with menu.

Kindly help me to resolve this issue.

Thanks in advance.

Regards,
Shweta Tiwari
Re: Switching between table pages [message #1062142 is a reply to message #1062125] Thu, 06 June 2013 08:32 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 790
Registered: October 2011
Senior Member
If I understood your question correctly, you need to use a PageField in your form.

Then you need to add a page instance to your Field. In my case I just did this in the execLoad method of my FormHandler.

index.php/fa/15160/0/

PS: I added the PageField with the Scout SDK (in the Explorer view). The wizzard do not ask for a IPage Type for the Generic parameter "<T extends IPage>". I think that this is a mistake.

Here the corresponding code:
public class MyForm extends AbstractForm {

  public MyForm() throws ProcessingException {
    super();
  }

  public CancelButton getCancelButton() {
    return getFieldByClass(CancelButton.class);
  }

  public void startModify() throws ProcessingException {
    startInternal(new ModifyHandler());
  }

  public MainBox getMainBox() {
    return getFieldByClass(MainBox.class);
  }

  public OkButton getOkButton() {
    return getFieldByClass(OkButton.class);
  }

  public PageBox getPageBox() {
    return getFieldByClass(PageBox.class);
  }

  @Order(10.0)
  public class MainBox extends AbstractGroupBox {

    @Order(10.0)
    public class PageBox extends AbstractPageField<CompanyTablePage> {
    }

    @Order(20.0)
    public class OkButton extends AbstractOkButton {
    }

    @Order(30.0)
    public class CancelButton extends AbstractCancelButton {
    }
  }

  public class ModifyHandler extends AbstractFormHandler {

    @Override
    public void execLoad() throws ProcessingException {
      CompanyTablePage page = new CompanyTablePage();
      getPageBox().setPage(page);
    }
  }
}
Re: Switching between table pages [message #1062151 is a reply to message #1062142] Thu, 06 June 2013 09:22 Go to previous messageGo to next message
Shweta Tiwari is currently offline Shweta TiwariFriend
Messages: 10
Registered: February 2013
Junior Member
Hi Jeremie,

Thanks for the quick response. Actually I don't want a separate page or form...I need the table page on the main window itself. Its the same way like we open a child page by double clicking on the table page. I want to open the table page on the main window itself after clicking on menu option.

Kindly let me know if this can be done.

Thanks in advance.

Regards,
Shweta
Re: Switching between table pages [message #1062747 is a reply to message #1062151] Mon, 10 June 2013 15:23 Go to previous messageGo to next message
Andreas Hoegger is currently offline Andreas HoeggerFriend
Messages: 174
Registered: February 2010
Senior Member
Hi Shweta

Thank you for the request. I assume you are trying to activate a certain tablepage from a menu or similar. To do so have a look at the Bookmark API.

As an example:
Bookmark bm = new Bookmark();
// outline
bm.setOutlineClassName(StandardOutline.class.getName());
// invisible root node page !!the class name must be inserted as a string with Kepler!!
NodePageState invisibleRootNodeState = new NodePageState();
invisibleRootNodeState.setPageClassName("org.eclipse.scout.rt.client.ui.desktop.outline.AbstractOutline$InvisibleRootPage");
invisibleRootNodeState.setExpanded(true);
bm.addPathElement(invisibleRootNodeState);
// a node page
NodePageState childNodePageState = new NodePageState();
childNodePageState.setPageClassName(ChildNodePage.class.getName());
childNodePageState.setExpanded(true);
bm.addPathElement(childNodePageState);
// a table page with a selected value !! ensure to mark the column as primary key !!!
TablePageState personsTablePageState = new TablePageState();
personsTablePageState.setExpanded(true);
personsTablePageState.setPageClassName(PersonsTablePage.class.getName());
personsTablePageState.setExpandedChildPrimaryKey(new CompositeObject(2l));
personsTablePageState.setSelectedChildrenPrimaryKeys(Arrays.asList(new CompositeObject[]{new CompositeObject(2l)}));
bm.addPathElement(personsTablePageState);

// a sub node of the persons table page
NodePageState companyNodePage = new NodePageState();
companyNodePage.setExpanded(true);
companyNodePage.setPageClassName(ChildNodePage.class.getName());
bm.addPathElement(companyNodePage);

// a table page under the 
TablePageState companiesTablePageState = new TablePageState();
companiesTablePageState.setExpanded(true);
companiesTablePageState.setPageClassName(CompaniesTablePage.class.getName());
bm.addPathElement(companiesTablePageState);

// activation of the bookmark
ClientSession.get().getDesktop().activateBookmark(bm, true);


Hope that helps
Andreas
Re: Switching between table pages [message #1062868 is a reply to message #1062747] Tue, 11 June 2013 07:59 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 790
Registered: October 2011
Senior Member
Thank you for this example.

I have started a wiki page for bookmarks (in general):
http://wiki.eclipse.org/Scout/Concepts/Bookmark

This is work in progress.
Previous Topic:Scalability
Next Topic:How to create a Pop Up Form?
Goto Forum:
  


Current Time: Mon Nov 24 12:42:32 GMT 2014

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

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