Package org.pentaho.gwt.widgets.client.toolbar

Examples of org.pentaho.gwt.widgets.client.toolbar.Toolbar


    SimplePanel treeWrapper = new SimplePanel( tree );
    treeWrapper.getElement().addClassName( "select-folder-tree" );
    tree.getElement().getStyle().setMargin( 0d, Unit.PX );

    Toolbar bar = new Toolbar();
    bar.setStyleName( "select-folder-toolbar" );
    bar.add( new Label( Messages.getString( "newFolderColon" ), false ) );
    bar.add( Toolbar.GLUE );

    ToolbarButton add = new ToolbarButton( ImageUtil.getThemeableImage( "icon-small", "pentaho-addbutton" ) );
    add.setToolTip( Messages.getString( "createNewFolder" ) );
    add.setCommand( new Command() {
      public void execute() {
        final NewFolderCommand nfc =
            new NewFolderCommand( ( (FileTreeItem) tree.getSelectedItem() ).getRepositoryFile() );
        nfc.setCallback( new ICallback<String>() {
          public void onHandle( String path ) {
            tree.select( path );
          }
        } );
        nfc.execute();
      }
    } );
    bar.add( add );

    VerticalPanel content = new VerticalPanel();
    content.add( bar );
    content.add( treeWrapper );
View Full Code Here


    widgets.add( headlineLabel );
  }

  private void createControls( final boolean isAdmin ) {
    blockoutButton = new Button( Messages.getString( "createBlockoutTime" ) );
    tableControls = new Toolbar();
    tablePanel = new VerticalPanel();
    tablePanel.setVisible( false );
    if ( isAdmin ) {
      final ClickHandler newBlockoutHandler = new ClickHandler() {
        @Override
View Full Code Here

    // pager.setRangeLimited(false);

    VerticalPanel tableAndPager = new VerticalPanel();
    tableAndPager.setHorizontalAlignment( HasHorizontalAlignment.ALIGN_CENTER );

    Toolbar bar = new Toolbar();
    bar.addSpacer( 10 );

    bar.add( Toolbar.GLUE );

    // Add control scheduler button
    if ( isAdmin ) {
      final ToolbarButton controlSchedulerButton =
          new ToolbarButton( ImageUtil.getThemeableImage( "icon-small", "icon-start-scheduler" ) );

      controlSchedulerButton.setCommand( new Command() {
        public void execute() {
          toggleSchedulerOnOff( controlSchedulerButton, isScheduler );
        }
      } );
      updateControlSchedulerButtonState( controlSchedulerButton, isScheduler );

      bar.add( controlSchedulerButton );
      bar.addSpacer( 20 );
    }

    // Add filter button
    filterButton.setCommand( new Command() {
      public void execute() {
        if ( filterDialog == null ) {
          filterDialog = new FilterDialog( allJobs, filterDialogCallback );
        } else {
          filterDialog.initUI( allJobs );
        }
        filterDialog.center();
      }
    } );
    filterButton.setToolTip( Messages.getString( "filterSchedules" ) );
    if ( isAdmin ) {
      bar.add( filterButton );
    }

    // Add remove filters button
    filterRemoveButton.setCommand( new Command() {
      public void execute() {
        filterDialog = null;
        filters.clear();
        filterAndShowData();
        filterRemoveButton.setEnabled( false );
        filterButton.setImage( ImageUtil.getThemeableImage( "icon-small", "icon-filter-add" ) );
      }
    } );
    filterRemoveButton.setToolTip( Messages.getString( "removeFilters" ) );
    filterRemoveButton.setEnabled( filters.size() > 0 );
    if ( isAdmin ) {
      bar.add( filterRemoveButton );
    }

    // Add refresh button
    ToolbarButton refresh = new ToolbarButton( ImageUtil.getThemeableImage( "icon-small", "icon-refresh" ) );
    refresh.setToolTip( Messages.getString( "refreshTooltip" ) );
    refresh.setCommand( new Command() {
      public void execute() {
        RefreshSchedulesCommand cmd = new RefreshSchedulesCommand();
        cmd.execute();
      }
    } );
    bar.add( refresh );

    bar.addSpacer( 20 );

    // Add execute now button
    triggerNowButton.setToolTip( Messages.getString( "executeNow" ) );
    triggerNowButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          MessageDialogBox messageDialog =
              new MessageDialogBox( Messages.getString( "executeNow" ), Messages.getString( "executeNowStarted" ),
                  false, true, true );
          messageDialog.setCallback( new IDialogCallback() {
            public void okPressed() {
              // wait a little to refresh to give schedule time to update the last run
              Timer t = new Timer() {
                public void run() {
                  refresh();
                }
              };
              t.schedule( 2000 );
            }

            public void cancelPressed() {
            }
          } );
          messageDialog.center();
          controlJobs( selectedJobs, "triggerNow", RequestBuilder.POST, false );
        }
      }
    } );
    triggerNowButton.setEnabled( false );
    bar.add( triggerNowButton );

    // Add control schedule button
    controlScheduleButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          JsJob[] jobs = selectedJobs.toArray( new JsJob[selectedJobs.size()] );
          if ( "NORMAL".equals( jobs[0].getState() ) ) {
            controlJobs( selectedJobs, "pauseJob", RequestBuilder.POST, false );
          } else {
            controlJobs( selectedJobs, "resumeJob", RequestBuilder.POST, false );
          }
        }
      }
    } );
    controlScheduleButton.setEnabled( false );
    bar.add( controlScheduleButton );

    bar.addSpacer( 20 );

    // Add edit button
    editButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          JsJob[] jobs = selectedJobs.toArray( new JsJob[selectedJobs.size()] );
          final JsJob editJob = jobs[0];
          final String url =
              GWT.getHostPageBaseURL() + "api/repo/files/"
                  + SolutionBrowserPanel.pathToId( editJob.getFullResourceName() ) + "/canAccess?cb="
                  + System.currentTimeMillis() + "&permissions=" + READ_PERMISSION;
          RequestBuilder executableTypesRequestBuilder = new RequestBuilder( RequestBuilder.GET, url );
          try {
            executableTypesRequestBuilder.setHeader( "If-Modified-Since", "01 Jan 1970 00:00:00 GMT" );
            executableTypesRequestBuilder.sendRequest( null, new RequestCallback() {

              public void onError( Request request, Throwable exception ) {
                promptForScheduleResourceError( editJob );
              }

              public void onResponseReceived( Request request, Response response ) {
                if ( "true".equalsIgnoreCase( response.getText() ) ) {
                  editJob( editJob );
                } else {
                  promptForScheduleResourceError( editJob );
                }
              }
            } );
          } catch ( RequestException e ) {
            // showError(e);
          }
        }
      }
    } );

    editButton.setEnabled( false );
    editButton.setToolTip( Messages.getString( "editTooltip" ) );
    bar.add( editButton );

    // Add remove button
    scheduleRemoveButton.setCommand( new Command() {
      public void execute() {
        Set<JsJob> selectedJobs = getSelectedJobs();
        if ( selectedJobs != null && selectedJobs.size() > 0 ) {
          final PromptDialogBox prompt =
              new PromptDialogBox( Messages.getString( "warning" ), Messages.getString( "yes" ), Messages
                  .getString( "no" ), false, true );
          prompt.setContent( new Label( Messages.getString( "deleteConfirmSchedles", "" + selectedJobs.size() ) ) );

          prompt.setCallback( new IDialogCallback() {
            public void okPressed() {
              controlJobs( getSelectedJobs(), "removeJob", RequestBuilder.DELETE, true );
              prompt.hide();
            }

            public void cancelPressed() {
              prompt.hide();
            }
          } );
          prompt.center();
        }
      }
    } );
    scheduleRemoveButton.setToolTip( Messages.getString( "remove" ) );
    scheduleRemoveButton.setEnabled( false );
    bar.add( scheduleRemoveButton );

    tableAndPager.add( bar );
    tableAndPager.add( table );
    tableAndPager.add( pager );
View Full Code Here

TOP

Related Classes of org.pentaho.gwt.widgets.client.toolbar.Toolbar

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.