2 Replies Latest reply on Mar 14, 2011 5:05 AM by Muneeswaran Balasubramanian

    Drag and Drop GUI not works in subview mode

    Muneeswaran Balasubramanian Newbie

      Hi to all,

       

      Ihave been work in the drag and drop component in richfaces for myapplication.Its works well in the view mode<f:view>,its also workin subview<f:subview> mode.But according to the GUI its not works well in subview mode.It doesn't show the symbols for accept,ignore etc.It shows only the square box.But its works well according to the functionality.But I needto work in the subview mode with GUI support.How can i achievethis?Please help me.

        • 1. Drag and Drop GUI not works in subview mode
          Nick Belaevski Master

          Hi,

           

          Please show page/beans code to reproduce the issue.

          • 2. Re: Drag and Drop GUI not works in subview mode
            Muneeswaran Balasubramanian Newbie

            Hi Nick,

            This is my code,

             

            <%@page contentType="text/html" pageEncoding="UTF-8"%>

            <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

                "http://www.w3.org/TR/html4/loose.dtd">

             

            <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>

            <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

            <%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>

            <%@taglib prefix="rich" uri="http://richfaces.org/rich"%>

             

             

            <html>

                <f:view>

            <f:subview id="subview">

                    <head>

                        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

                        <title>DnD Sample</title>

                        <style>

                            .panelc {

                                width:25%;

                                vertical-align:top;

                            }

             

                            .dropTargetPanel {

                                width: 90%;

                            }

             

                            .footerClass {

                                text-align: center;

                                padding-top: 5px;

                            }

             

                        </style>

             

                    </head>

                    <body>

             

                        <rich:dragIndicator id="indicator" />

             

                        <h:form id="form" binding="#{dndBean.initForm}">

             

                            <h:panelGrid columnClasses="panelc" columns="4" width="100%">                  

             

                                <rich:panel styleClass="dropTargetPanel">

                                    <f:facet name="header">

                                        <h:outputText value="Java Frameworks" />

                                    </f:facet>

             

                                    <rich:dropSupport id="php" acceptedTypes="Java,CF" dropValue="Java"

                                                      dropListener="#{dndBean.processDropInPanel}"

                                                      reRender="phptable, src">

                                    </rich:dropSupport>

             

                                    <rich:dataGrid id="phptable" columns="3" elements="9" value="#{dndBean.containerPHP}" var="fm">

                                        <h:column>

                                            <h:outputText value="#{fm.name}"></h:outputText>

                                        </h:column>

                                    </rich:dataGrid>

                                </rich:panel>

             

            <rich:panel style="width:133px">

                                    <f:facet name="header">

                                        <h:outputText value="Source List" />

                                    </f:facet>                     

             

                                    <rich:dataTable id="src" columns="1" value="#{dndBean.frameWorks}"

                                                    var="fm" footerClass="footerClass">

             

                                        <h:column>

                                            <a4j:outputPanel style="width:100px;border:1px solid gray;padding:2px"

                                                             layout="block">

                                                <rich:dragSupport dragIndicator=":indicator"

                                                                  dragType="#{fm.family}" dragValue="#{fm}">

                                                    <rich:dndParam name="label" value="#{fm.name}" />

                                                </rich:dragSupport>

                                                <h:outputText value="#{fm.name}"></h:outputText>

                                            </a4j:outputPanel>

                                        </h:column>

                                        <%-- <f:facet name="footer">

                                             <a4j:commandButton action="#{dndBean.reset}" value="Start Over" reRender="src,phptable,cftable,dnettable"/>

                                         </f:facet>--%>

                                    </rich:dataTable>

                                </rich:panel>

             

                            </h:panelGrid>

             

                        </h:form>

                        <a4j:outputPanel ajaxRendered="true">

                            <h:messages></h:messages>

                        </a4j:outputPanel>

                    </body>

            </f:subview>

                </f:view>

            </html>

             

            DndBean.java

             

            package com.info.richfaces.dnd;

             

            import java.util.ArrayList;

            import java.util.List;

            import javax.faces.component.html.HtmlForm;

            import org.richfaces.event.DropEvent;

             

            /**

            * @since

            * @author muneeswaran

            */

            public class DndBean

            {

             

                private List<FrameWork> frameWorks = new ArrayList<FrameWork>();

                private List<FrameWork> containerPHP = new ArrayList<FrameWork>();

                private List<FrameWork> containerDNET = new ArrayList<FrameWork>();

                private List<FrameWork> containerCF = new ArrayList<FrameWork>();

                private HtmlForm initForm;

             

                private void initializePageAttributes()

                {

                    if (frameWorks != null && !frameWorks.isEmpty())

                    {

                        frameWorks.clear();

                    }

             

                    if (containerPHP != null && !containerPHP.isEmpty())

                    {

                        containerPHP.clear();

                    }       

             

                    FrameWork frameWork1 = new FrameWork("ruby", "Java", "ruby");

                    frameWorks.add(frameWork1);

                    FrameWork frameWork2 = new FrameWork("jsp", "Java", "jsp");

                    frameWorks.add(frameWork2);

                    FrameWork frameWork3 = new FrameWork("jsf", "Java", "jsf");

                    frameWorks.add(frameWork3);

                    FrameWork frameWork4 = new FrameWork("ajax", "Java", "ajax");

                    frameWorks.add(frameWork4);

            }

             

            public String processDrop(DropEvent event)

                {

                    System.out.println("Drag Value : " + event.getDragValue());

                    System.out.println("Draggable Source : " + event.getDraggableSource());

                    System.out.println("Drop Value : " + event.getDropValue());

             

                    if (event.getDragType().equalsIgnoreCase("Java"))

                    {

                        frameWorks.remove((FrameWork) event.getDragValue());

                        containerPHP.add((FrameWork) event.getDragValue());

                    }

                    else if (event.getDragType().equalsIgnoreCase("Dnet"))

                    {

                        frameWorks.remove((FrameWork) event.getDragValue());

                        containerDNET.add((FrameWork) event.getDragValue());

                    }

                    else if (event.getDragType().equalsIgnoreCase("CF"))

                    {

                        frameWorks.remove((FrameWork) event.getDragValue());

                        containerCF.add((FrameWork) event.getDragValue());

                    }

                    return "";

                }

             

            public String processDropInPanel(DropEvent event)

                {

                    if (!event.getDragValue().equals(null))

                    {

                        frameWorks.remove((FrameWork) event.getDragValue());

                    }

                    containerPHP.add((FrameWork) event.getDragValue());

                    return "";

                }

             

            /**

                 * @return the initForm

                 */

                public HtmlForm getInitForm()

                {

                    initializePageAttributes();

                    return initForm;

                }

            /**Getter setter of the components*/

             

             

             

            Here i put the <f:subview> for the option of try only.By run this code,i get the functionality works well.But according to the GUI,its show only box,not show the accepted,rejected cursors etc.Please help me.