Package org.damour.base.client.ui.buttons

Examples of org.damour.base.client.ui.buttons.IconButton


  private Widget buildToolbar(String title) {
    ToolBar toolbar = new ToolBar();
    toolbar.add(new Label(title, false));

    IconButton reloadImageButton = new IconButton(null, false, BaseImageBundle.images.refresh_16(), BaseImageBundle.images.refresh_16(),
        BaseImageBundle.images.refresh_16(), BaseImageBundle.images.refresh_disabled_16());
    reloadImageButton.setTitle("Refresh File Manager");
    reloadImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        repositoryTree.fetchRepositoryTree(FileManagerPanel.this);
      }
    });
    toolbar.add(reloadImageButton);

    final IconButton sortImageButton = new IconButton(null, false, BaseImageBundle.images.sort(), BaseImageBundle.images.sort(), BaseImageBundle.images.sort(),
        BaseImageBundle.images.sort());
    sortImageButton.setTitle("Sort Files by Name");
    sortImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        repositoryTree.setAnimationEnabled(false);
        repositoryTree.setSortAToZ(!repositoryTree.isSortAToZ(), FileManagerPanel.this);
        repositoryTree.setAnimationEnabled(true);
      }
    });
    toolbar.add(sortImageButton);

    final IconButton toggleHiddenFilesImageButton = new IconButton(null, false, BaseImageBundle.images.showHide16(), BaseImageBundle.images.showHide16(),
        BaseImageBundle.images.showHide16(), BaseImageBundle.images.showHide16());
    toggleHiddenFilesImageButton.setTitle("Show/Hide Hidden Files");
    toggleHiddenFilesImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        repositoryTree.setAnimationEnabled(false);
        repositoryTree.setShowHiddenFiles(!repositoryTree.isShowHiddenFiles(), FileManagerPanel.this);
        repositoryTree.setAnimationEnabled(true);
      }
View Full Code Here


      layoutCallback.layoutComplete();
    }
  }

  private Widget createPageControllerPanel(final FlexTable mainPanel) {
    final IconButton nextPageImageButton = new IconButton(null, true, BaseImageBundle.images.next(), BaseImageBundle.images.next(),
        BaseImageBundle.images.next(), BaseImageBundle.images.next());
    nextPageImageButton.setSTYLE("commentToolBarButton");
    nextPageImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (pageNumber == lastPageNumber) {
          return;
        }
        pageNumber++;
        fetchPage();
      }
    });
    final IconButton previousPageImageButton = new IconButton(null, false, BaseImageBundle.images.previous(), BaseImageBundle.images.previous(),
        BaseImageBundle.images.previous(), BaseImageBundle.images.previous());
    previousPageImageButton.setSTYLE("commentToolBarButton");
    previousPageImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (pageNumber == 0) {
          return;
        }
        pageNumber--;
        fetchPage();
      }
    });
    final IconButton lastPageImageButton = new IconButton(null, false, BaseImageBundle.images.last(), BaseImageBundle.images.last(),
        BaseImageBundle.images.last(), BaseImageBundle.images.last());
    lastPageImageButton.setSTYLE("commentToolBarButton");
    lastPageImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        pageNumber = (int) lastPageNumber;
        fetchPage();
      }
    });
    final IconButton firstPageImageButton = new IconButton(null, false, BaseImageBundle.images.first(), BaseImageBundle.images.first(),
        BaseImageBundle.images.first(), BaseImageBundle.images.first());
    firstPageImageButton.setSTYLE("commentToolBarButton");
    firstPageImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        pageNumber = 0;
        fetchPage();
      }
    });
    if (lastPageNumber < 0) {
      firstPageImageButton.setEnabled(false);
      previousPageImageButton.setEnabled(false);
      nextPageImageButton.setEnabled(false);
      lastPageImageButton.setEnabled(false);
    }
View Full Code Here

    buttonPanel.add(lastPageImageButton);
    return buttonPanel;
  }

  private Widget createButtonPanel(final FlexTable mainPanel, final boolean forceOpen) {
    final IconButton reloadImageButton = new IconButton("Refresh", true, BaseImageBundle.images.refresh_16(), BaseImageBundle.images.refresh_16(),
        BaseImageBundle.images.refresh_16(), BaseImageBundle.images.refresh_disabled_16());
    reloadImageButton.setSTYLE("commentToolBarButton");
    reloadImageButton.setTitle("Refresh comments");
    reloadImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        BaseServiceCache.getService().getPageInfo(permissibleObject, Comment.class.getName(), pageSize, new AsyncCallback<PageInfo>() {
          public void onFailure(Throwable caught) {
          };

          public void onSuccess(PageInfo pageInfo) {
            numComments = pageInfo.getTotalRowCount();
            lastPageNumber = pageInfo.getLastPageNumber();
            pageCache.clear();
            fetchPage();
          };
        });
      }
    });

    final IconButton sortImageButton = new IconButton("Sort " + (sortDescending ? "Ascending" : "Descending"), true, BaseImageBundle.images.sort(),
        BaseImageBundle.images.sort(), BaseImageBundle.images.sort(), BaseImageBundle.images.sort());
    sortImageButton.setSTYLE("commentToolBarButton");
    sortImageButton.setTitle(sortDescending ? "Show oldest comments first" : "Show most recent comments first");
    sortImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        sortDescending = !sortDescending;
        // this could be optimized if we have all the pages, then we have all the data
        // we could do it all on the client
        pageCache.clear();
        fetchPage();
      }
    });

    IconButton flattenImageButton = null;
    if (flatten) {
      flattenImageButton = new IconButton("Hierarchy", true, BaseImageBundle.images.hierarchy(), BaseImageBundle.images.hierarchy(),
          BaseImageBundle.images.hierarchy(), BaseImageBundle.images.hierarchy());
      flattenImageButton.setTitle("Build a comment hierarchy");
    } else {
      flattenImageButton = new IconButton("Flatten", true, BaseImageBundle.images.flatten(), BaseImageBundle.images.flatten(),
          BaseImageBundle.images.flatten(), BaseImageBundle.images.flatten());
      flattenImageButton.setTitle("Flatten the comment hierarchy");
    }
    flattenImageButton.setSTYLE("commentToolBarButton");
    flattenImageButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        flatten = !flatten;
        loadCommentWidget(forceOpen);
      }
    });
View Full Code Here

TOP

Related Classes of org.damour.base.client.ui.buttons.IconButton

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.