Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Portal - portlet save order

    IS there any event to get the PortalLayout(class from the showcase) after the portlet was drag-droped into another PortletCell.
    The addDropHandler fires before so i can't get the new position of the portlet (iterating through the portletLayout instance shows the old position of the portlet(before drag-drop))


    Example:
    Layout before drag-drop:
    http://pokit.etf.ba/upload/?pokit569...5ec26db204.png

    Code:
               addDropHandler(new DropHandler() {
    				@Override
    				public void onDrop(DropEvent event) {
    					Canvas[] portcell = portletLayout.getMembers();  
    					PortalColumn pc1 = (PortalColumn) portcell[0];
    					PortalColumn pc2 = (PortalColumn) portcell[1];
    					Canvas[] port1 = pc1.getMembers(); //portlets
    					Canvas[] port2 = pc2.getMembers(); //portlets
             }}
    after moving the portlet "Sarajevo-x" from the PortletColumn[0] to PortletColumn[1] (drag-drop to the empty space under "Zamger") the onDrop event fires but when i check the port1 and port2 variables the column is still in port1 (column 0) (where it was before drag-drop)


    Is there any other event handler that fires after the dragdrop

    ps. i modified the smartgwt portlet theme to look like gwt-ext if someone needs it msg me

    #2
    I have tried every Handler I can think of...

    I've tried all the Handlers I can think of even if you do get the Portlet in the new column it comes back as a Canvas instead of a Portlet when calling getMembers.

    I even tried the debug window Ctrl-D to narrow it down to a specific handler (which led me to addDragRepositionStopHandler but same issue).

    I've tried on the PortalColumn(which seem to be the correct place) and Portlet(doesn't work):

    addDragRepositionStopHandler
    addDragStopHandler
    addDragMoveHandler
    addDropMoveHandler
    addDropHandler

    I'm using the 1.2 version that was released on GWT 1.7

    Thank you for any help.

    Comment


      #3
      If it's really a Portlet you can convert it by grabbing it's underlying JSObject (getJSObject) and creating an instance of Portlet from the JSObject.

      Comment


        #4
        Saving Order Successful

        I was also working on a portal and I found this way to get the order of the portal.

        for example your portal layout is named portalLayout. Look at the following code to understand step by step.

        //we will get the portlets from this method
        Canvas[] members = portalLayout.getMembers();

        //then you can delete the current order by
        portalLayout.removeMembers(members);

        //you can save the array of members in a JSON file. I dont have the code for it in my head right now but you can google "how to save JSON Object in gwt" use the code where ever you want according to your app.

        //get the saved order from the JSON it will return an array.

        //for example if its named savedmembers. set it in order in your portal this way
        portalLayout.setMembers(savedmembers);

        if you need help in getting the JSON do reply I will put the code up...

        Comment


          #5
          Originally posted by shabihsherjeel
          I was also working on a portal and I found this way to get the order of the portal.

          for example your portal layout is named portalLayout. Look at the following code to understand step by step.

          //we will get the portlets from this method
          Canvas[] members = portalLayout.getMembers();

          //then you can delete the current order by
          portalLayout.removeMembers(members);

          //you can save the array of members in a JSON file. I dont have the code for it in my head right now but you can google "how to save JSON Object in gwt" use the code where ever you want according to your app.

          //get the saved order from the JSON it will return an array.

          //for example if its named savedmembers. set it in order in your portal this way
          portalLayout.setMembers(savedmembers);

          if you need help in getting the JSON do reply I will put the code up...
          I need help , could you please put the code

          Comment


            #6
            Hi
            Could u please help me with how to get the JSON position of the portlet. I am not getting how to save the array of members(portlets) in a JSON file.

            Comment

            Working...
            X