Package com.tensegrity.palo.gwt.core.client.models.cubeviews

Examples of com.tensegrity.palo.gwt.core.client.models.cubeviews.XAxisHierarchy


  }
  private final void proceedChangeSelectedElement(final HierarchySelectionWidget hierWidget,
      final XElement selectedElement, XLoadInfo loadInfo) {
//    if(loadInfo.loadCells > SHOW_WAIT_CURSOR_THRESHOLD)
    showWaitDialog(constants.changingSelectedElement());
    final XAxisHierarchy xAxisHierarchy = hierWidget.getHierarchy();
    String sessionId = ((Workbench)Registry.get(Workbench.ID)).getUser().getSessionId();
    WPaloCubeViewServiceProvider.getInstance().proceedChangeSelectedElement(sessionId,
            view, xAxisHierarchy, selectedElement,
            new Callback<XViewModel>(constants.changingSelectedElementFailed()) {
              public void onSuccess(XViewModel view) {
View Full Code Here


    showMenu(widget);
  }
 
  private final void showMenu(final HierarchySelectionWidget widget) {   
    ((Workbench) Registry.get(Workbench.ID)).showWaitCursor(constants.displayingElementTree(), true);
    final XAxisHierarchy xAxisHierarchy = widget.getHierarchy();
   
    String sessionId = ((Workbench)Registry.get(Workbench.ID)).getUser().getSessionId();
    String elementId = xAxisHierarchy.getSelectedElement() == null ? "" : xAxisHierarchy.getSelectedElement().getId();
    WPaloCubeViewServiceProvider.getInstance().getNumberOfChildren(sessionId, xAxisHierarchy.getId(), xAxisHierarchy.getViewId(), xAxisHierarchy.getAxisId(), elementId, new Callback <Integer>(){
      public void onFailure(Throwable t) {
        ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
        super.onFailure(t);
      }
     
      public void onSuccess(Integer result) {
        ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
        LargeQueryWarningDialog.confirm(result, new ConfirmLoadDialogListener() {
          public void proceed(final boolean state) {
            ((Workbench) Registry.get(Workbench.ID)).showWaitCursor(constants.displayingElementTree(), true);
            try {
              final SelectElementDialog menu = new SelectElementDialog(view, xAxisHierarchy, state);
              menu.addSelectionListener(new Listener<SelectionEvent>() {
                public void handleEvent(SelectionEvent se) {
                  XObject selection = se.getSelection();
                  XElement selectedElement = null;
                  if (selection instanceof XElement) {
                    selectedElement = (XElement) selection;
                  } else if(selection instanceof XElementNode) {
                    XElementNode node = (XElementNode) selection;
                    selectedElement = node.getElement();
                  }
                  ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
                  if (selectedElement != null
                      && !selectedElement.equals(xAxisHierarchy.getSelectedElement()))
                    changeSelectedElement(widget, selectedElement)
                }
              });
              menu.show(widget);
                menu.focus();
View Full Code Here

    final String sessionId = ((Workbench)Registry.get(Workbench.ID)).getUser().getSessionId();
    WPaloCubeViewServiceProvider.getInstance().runAsync(sessionId, 0, new Callback<Void>() {
      public void onSuccess(Void arg0) {
        final String oldPaths = widget.getHierarchy().getProperty("filterPaths");
        final String oldAliasFormat = widget.getHierarchy().getProperty("aliasFormat");
        final XAxisHierarchy hierarchy = widget.getHierarchy();
        // get old settings:
        final XAlias oldAlias = hierarchy.getActiveAlias();
        final XSubset oldSubset = hierarchy.getActiveSubset();
        final XElement oldSelectedElement = hierarchy.getSelectedElement();             
        hierarchy.setOldVisibleElements(hierarchy.getVisibleElements());       
        if (hierarchy.getVisibleElements() == null || hierarchy.getVisibleElements().length == 0) {
          oldVisibles.remove(hierarchy.getId());
        } else {
          oldVisibles.put(hierarchy.getId(), hierarchy.getVisibleElements());
        }
       
        XElementNode [] newSelElems = dlg.getVisibleElements();
        if (newSelElems == null || newSelElems.length == 0) {
          visibles.remove(hierarchy.getId());
        } else {
          visibles.put(hierarchy.getId(), newSelElems);
        }
       
//        //apply changes:             
        hierarchy.setActiveAlias(dlg.getSelectedAlias());
        hierarchy.setActiveSubset(dlg.getSelectedSubset());
        hierarchy.setVisibleElements(newSelElems);
        hierarchy.setSelectedElement(dlg.getSelectedElement());
        final boolean containsSelected = contains(hierarchy.getVisibleElements(), oldSelectedElement);       
        if (isInRowOrColumn(hierarchy)) {
          willUpdateHierarchy(widget, oldSubset, oldAlias, initialVisibleElements, oldPaths, oldAliasFormat, oldSelectedElement);
        } else {
          if (!containsSelected || (dlg.getOldSelectedElement() == null && hierarchy.getSelectedElement() != null)) {
            willUpdateHierarchy(widget, oldSubset, oldAlias, initialVisibleElements, oldPaths, oldAliasFormat, dlg.getOldSelectedElement());
          } else {
            if (dlg.getSelectedSubset() != null) {
              checkSubset(hierarchy, oldAlias, oldSubset, oldSelectedElement,
                  dlg.getSelectedSubset(), oldPaths, oldAliasFormat, initialVisibleElements, widget);
             
            } else {
              showWaitDialog(constants.applyingSelection());
              adjustView();         
              WPaloCubeViewServiceProvider.getInstance().proceedUpdateViewWithoutTable(sessionId,
                view,
                new Callback<XViewModel>(messages.updatingViewFailed(ViewBrowserModel.modify(view.getName()))) {
                  public void onSuccess(XViewModel view) {
                    markDirty(true);
                    fastSetInput(view);
                    if (widget instanceof HierarchySelectionWidget) {
                      ((HierarchySelectionWidget) widget).setSelectedElement(hierarchy.getSelectedElement());
                    }                         
                    widget.update();
                    hideWaitDialog();
                  }
                });                   
View Full Code Here

              //removed them on open!!!
              showWaitDialog(constants.updatingView());
              String sessionId = ((Workbench)Registry.get(Workbench.ID)).getUser().getSessionId();
              WPaloCubeViewServiceProvider.getInstance().runAsync(sessionId, 0, new Callback<Void>() {
                public void onSuccess(Void arg0) {
                  XAxisHierarchy hierarchy = widget.getHierarchy();
                  hierarchy.setVisibleElements(initialVisibleElements);             
                  updateHierarchy(hierarchy); //AndReloadView();             
                }
              });
            }
          }
View Full Code Here

      final XSubset oldSubset, final XAlias oldAlias,
      final XElementNode[] oldVisibleElements,
      final String oldPaths, final String oldAliasFormat,
      final XElement oldSelectedElement) {
    showWaitDialog(constants.updatingHierarchy());
    final XAxisHierarchy hierarchy = hierWidget.getHierarchy();
    String sessionId = ((Workbench)Registry.get(Workbench.ID)).getUser().getSessionId();
    WPaloCubeViewServiceProvider.getInstance().willUpdateAxisHierarchy(sessionId,
        hierarchy,
        new Callback<XLoadInfo>(constants.updatingHierarchyFailed()) {
          public void onFailure(Throwable caught) {
            hideWaitCursor();
            super.onFailure(caught);
          }
          public void onSuccess(final XLoadInfo loadInfo) {
            ConfirmLoadDialogListener dlgListener = new ConfirmLoadDialogListener() {
              public void cancel() {
                //we cancel update:
                hierarchy.setActiveAlias(oldAlias);
                hierarchy.setActiveSubset(oldSubset);                     
                hierarchy.setVisibleElements(oldVisibleElements);
                hierarchy.setSelectedElement(oldSelectedElement);
                if (oldPaths == null) {
                  hierarchy.removeProperty("filterPaths");
                } else {
                  hierarchy.addProperty("filterPaths", oldPaths);
                }
                if (oldAliasFormat == null) {
                  hierarchy.removeProperty("aliasFormat");
                } else {
                  hierarchy.addProperty("aliasFormat", oldAliasFormat);
                }
                updateHierarchy(hierarchy);
              }
              public void proceed(boolean state) {
                proceedUpdateHierarchy(hierWidget, loadInfo);
View Full Code Here

      }

      public void onSuccess(final String [] result) {
        WPaloCubeViewServiceProvider.getInstance().runAsync(sessionId, 0, new Callback<Void>() {
          public void onSuccess(Void arg0) {
            XAxisHierarchy hierarchy = view.getAxisHierarchy(item.getHierarchyId());
            final String oldPaths = hierarchy.getProperty("filterPaths");
            final String oldAliasFormat = hierarchy.getProperty("aliasFormat");

            // get old settings:
            final XAlias oldAlias = hierarchy.getActiveAlias();
            final XSubset oldSubset = hierarchy.getActiveSubset();
            final XElement oldSelectedElement = hierarchy.getSelectedElement();           
            ArrayList <XElementNode> visEls = new ArrayList<XElementNode>();
            final XElementNode [] currentVisible = hierarchy.getVisibleElements();
            hierarchy.setOldVisibleElements(currentVisible);
           
//            //apply changes:
            if (result != null) {
              StringBuffer filterPaths = new StringBuffer();
              HashMap <String, XElementNode> parents = new HashMap<String, XElementNode>();
              int counter = 0;
              for (int i = 0; i < result.length; i += 5) {
                XElement xElement = new XElement(result[i], result[i + 1],
                    XElementType.fromString(result[i + 2]));
                XElementNode xElemNode = new XElementNode(xElement, item.getHierarchyId(), view.getId());
                filterPaths.append(result[i + 3]);
                filterPaths.append(",");
                if (!result[i + 4].equals("-1")) {
                  XElementNode xParent = parents.get(result[i + 4]);
                  xParent.forceAddChild(xElemNode);
                  xElemNode.setParent(xParent);
                } else {
                  visEls.add(xElemNode);
                }
                parents.put("" + counter, xElemNode);
                counter++;                                             
              }
              hierarchy.addProperty("filterPaths", filterPaths.toString());
            }
            hierarchy.setVisibleElements(visEls.toArray(new XElementNode[0]));
            willUpdateHierarchy(
                hierarchy, oldSubset, oldAlias, currentVisible, oldPaths, oldSelectedElement);
          }
        });
      }
View Full Code Here

        }
      }
    });
    contextMenu.add(hideLevel);

    XAxisHierarchy hierarchy = view.getAxisHierarchy(item.getHierarchyId());
    boolean enabled = hierarchy != null && hierarchy.getVisibleElements() != null && hierarchy.getVisibleElements().length > 0;
    MenuItem showAllElements = new MenuItem();
    showAllElements.setText(constants.showAllElements());
    showAllElements.setIconStyle("icon-filter");
    showAllElements.addSelectionListener(new SelectionListener<ComponentEvent>() {
      public void componentSelected(ComponentEvent ce) {
        XAxisHierarchy hierarchy = view.getAxisHierarchy(item.getHierarchyId());
        final String oldPaths = hierarchy.getProperty("filterPaths");

        // get old settings:
        final XAlias oldAlias = hierarchy.getActiveAlias();
        final XSubset oldSubset = hierarchy.getActiveSubset();
        final XElement oldSelectedElement = hierarchy.getSelectedElement();           
        ArrayList <XElementNode> visEls = new ArrayList<XElementNode>();
        final XElementNode [] currentVisible = hierarchy.getVisibleElements();
        hierarchy.setOldVisibleElements(currentVisible);       
        hierarchy.setVisibleElements(null);
        willUpdateHierarchy(
            hierarchy, oldSubset, oldAlias, currentVisible, oldPaths, oldSelectedElement);
      }
    });
    contextMenu.add(showAllElements);
View Full Code Here

TOP

Related Classes of com.tensegrity.palo.gwt.core.client.models.cubeviews.XAxisHierarchy

Copyright © 2018 www.massapicom. 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.