Examples of WSTab


Examples of org.jboss.errai.workspaces.client.widgets.WSTab

     * Log the drag end event.
     *
     * @param event the event to log
     */                          
    public void onDragEnd(DragEndEvent event) {
        WSTab tab = (WSTab) event.getContext().draggable;

        WSTabPanel panel = layout.tabPanel;
        /**
         * If the tab has been dragged outside the boundaries, we need to catch it, so it doesn't get thrown
         * away.
         */
        if (panel.getWidgetIndex(tab.getWidgetRef()) == -1) {
            panel.add(panel.getWidget(panel.getWidgetCount()-1),tab);
        }
    }
View Full Code Here

Examples of org.jboss.errai.workspaces.client.widgets.WSTab

        tp = widget;
        this.targetTab = targetTab;
    }

    public void onDrop(DragContext dragContext) {
        WSTab sourceTab = (WSTab) dragContext.draggable;
        /**
         * The original position of the tab
         */
        int sourceIdx = tp.getWidgetIndex(sourceTab.getWidgetRef());

        /**
         * The requested position of the tab
         */
        int destIdx = tp.getWidgetIndex(targetTab.getWidgetRef());

        if (sourceIdx < destIdx) {
            // moving right
            if (destIdx == (tp.getWidgetCount() - 1)) {
                // the target is the right-most targetTab
                tp.remove(sourceTab.getWidgetRef());
                tp.remove(targetTab.getWidgetRef());

                tp.add(targetTab.getWidgetRef(), targetTab);
                tp.add(sourceTab.getWidgetRef(), sourceTab);
            }
            else {
                tp.insert(sourceTab.getWidgetRef(), sourceTab, destIdx + 1);
            }
        }
        else {
            /**
             * We're moving left
             */
            tp.remove(sourceIdx);

            if (tp.getWidgetCount() <= destIdx) {
                tp.add(sourceTab.getWidgetRef(), sourceTab);
                tp.add(targetTab.getWidgetRef(), targetTab);
            }
            else {
                tp.insert(sourceTab.getWidgetRef(), sourceTab, destIdx);
                tp.insert(targetTab.getWidgetRef(), targetTab, destIdx + 1);
            }
        }

        tp.selectTab(destIdx);
       
        sourceTab.reset();
        targetTab.reset();

        super.onDrop(dragContext);
    }
View Full Code Here

Examples of org.jboss.errai.workspaces.client.widgets.WSTab

        tp = widget;
        this.targetTab = targetTab;
    }

    public void onDrop(DragContext dragContext) {
        WSTab sourceTab = (WSTab) dragContext.draggable;
        /**
         * The original position of the tab
         */
        int sourceIdx = tp.getWidgetIndex(sourceTab.getWidgetRef());

        /**
         * The requested position of the tab
         */
        int destIdx = tp.getWidgetIndex(targetTab.getWidgetRef());

        if (sourceIdx < destIdx) {
            // moving right
            if (destIdx == (tp.getWidgetCount() - 1)) {
                // the target is the right-most targetTab
                tp.remove(sourceTab.getWidgetRef());
                tp.remove(targetTab.getWidgetRef());

                tp.add(targetTab.getWidgetRef(), targetTab);
                tp.add(sourceTab.getWidgetRef(), sourceTab);
            }
            else {
                tp.insert(sourceTab.getWidgetRef(), sourceTab, destIdx + 1);
            }
        }
        else {
            /**
             * We're moving left
             */
            tp.remove(sourceIdx);

            if (tp.getWidgetCount() <= destIdx) {
                tp.add(sourceTab.getWidgetRef(), sourceTab);
                tp.add(targetTab.getWidgetRef(), targetTab);
            }
            else {
                tp.insert(sourceTab.getWidgetRef(), sourceTab, destIdx);
                tp.insert(targetTab.getWidgetRef(), targetTab, destIdx + 1);
            }
        }

        tp.selectTab(destIdx);
       
        sourceTab.reset();
        targetTab.reset();

        super.onDrop(dragContext);
    }
View Full Code Here

Examples of org.jboss.errai.workspaces.client.widgets.WSTab

     * Log the drag end event.
     *
     * @param event the event to log
     */                          
    public void onDragEnd(DragEndEvent event) {
        WSTab tab = (WSTab) event.getContext().draggable;

        WSTabPanel panel = layout.tabPanel;
        /**
         * If the tab has been dragged outside the boundaries, we need to catch it, so it doesn't get thrown
         * away.
         */
        if (panel.getWidgetIndex(tab.getWidgetRef()) == -1) {
            panel.add(panel.getWidget(panel.getWidgetCount()-1),tab);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.