Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.FileUpload$FileUploadImplOpera


    recreate();
  }
 
 
  private void recreate() {
    upload = new FileUpload();
    upload.setTitle("The path to the ontology in your local system");
    upload.setWidth("300");
    upload.setName("ontologyFile");
   
    contents.clear();
View Full Code Here


  }
 
 
  private void recreate(boolean allowLoadOptions) {
    if ( allowLoadOptions ) {
      upload = new FileUpload();
      upload.setTitle("The path to the ontology in your local system");
      upload.setWidth("300");
      upload.setName("ontologyFile");
     
      preserveOriginalBaseNamespace = new CheckBox("Preserve original base namespace");
View Full Code Here

      // add label
      panel.add(new Label("select a file:"));
     
      // Create a FileUpload widget.
      final FileUpload upload = new FileUpload();
      upload.setName("uploadFormElement");
      panel.add(upload);

      // Add a 'submit' button.
      panel.add(new Button("Submit", new ClickHandler() {
        public void onClick(ClickEvent event) {
        upload.setName(upload.getFilename());
          form.submit();
        }
      }));

    footerPanel.add(form);
View Full Code Here

      dockPanel = new DockPanel();
      rootPanel.add(dockPanel, 29, 265);
      dockPanel.setSize("1193px", "550px");

      // Add a file upload widget
        final FileUpload fileUpload = new FileUpload();
      
        fileUpload.ensureDebugId("cwFileUpload");
        int posTop = 10;
        rootPanel.add(fileUpload, 10 , posTop);

        //
      Button fileUploadButton = new Button("Download dossier cache");
        fileUploadButton.addClickHandler(new ClickHandler() {
          public void onClick(ClickEvent event) {
            String filename = fileUpload.getFilename();
            if (filename.length() == 0) {
              Window.alert("file size null");
            } else {
              Window.alert("file size OK");
             
              //TODO : Display stats of dossier cache
             
            }
          }
        });
        posTop = posTop + 35;
        rootPanel.add(fileUploadButton, 10, posTop );
        fileUploadButton.setSize("80px", "28px");
       
      //button search Clans
      //int posLeft = 10;
      posTop = posTop + 35;
      Button searchClansButton = new Button("Clans");
      rootPanel.add(searchClansButton, 10, posTop);
      searchClansButton.setSize("80px", "28px");

      //bouton plus de clans
//      final Button searchClansButtonMore = new Button("100 Clans +");
//      rootPanel.add(searchClansButtonMore, 95, posTop);
//      searchClansButtonMore.setSize("120px", "28px");
//      searchClansButtonMore.setEnabled(false);
     
     
      //label clan
      //lblNewLabel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
     
      //nom du clan a rechercher
      final TextBox nameClan = new TextBox();
      rootPanel.add(nameClan, 300, posTop);
      nameClan.setText("NOVA SNAIL");
      nameClan.setSize("125px", "18px");
      nameClan.addFocusHandler(new FocusHandler() {
       
        @Override
        public void onFocus(FocusEvent event) {
          // TODO Auto-generated method stub
          offsetClan = 0;
          limitClan = 100;
        }
      });
      // Focus the name clan
      nameClan.setFocus(true);
     
      //bouton login for admin functions
      final Button loginAdminButton = new Button("Admin login");
      rootPanel.add(loginAdminButton, 700, posTop);
      loginAdminButton.setSize("125px", "28px");
      loginAdminButton.setEnabled(true);
     
      //nom du login
      final TextBox nameLogin = new TextBox();
      rootPanel.add(nameLogin, 850, posTop);
      nameLogin.setText("t..");
      nameLogin.setSize("125px", "18px");
     
      nameLogin.addFocusHandler(new FocusHandler() {
       
        @Override
        public void onFocus(FocusEvent event) {
          // TODO Auto-generated method stub
          passSaving = 0;
          nbUsersToTreat = 30;
        }
      });
     
      final Button persistStatsButton = new Button("Save stats");
      rootPanel.add(persistStatsButton, 1000, posTop);
      persistStatsButton.setSize("125px", "28px");
      persistStatsButton.setEnabled(false);
     
      // Add a handler to set admin login true
      loginAdminButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          if (nameLogin.getText().equalsIgnoreCase("thleconn")){
            persistStatsButton.setEnabled(true);
            adminLogin = true;
          }else {
            persistStatsButton.setEnabled(false);
            adminLogin = false;
          }
        }
      });
      //

     
     
      //next row button search Clan's users
      posTop = posTop + 35;
      final Button searchUsersClanButton = new Button("Clan's Users");
      rootPanel.add(searchUsersClanButton, 10, posTop);
      searchUsersClanButton.setSize("210px", "28px");
      searchUsersClanButton.setEnabled(false);

      // Add a drop box with the clan's users
        //final ListBox dropBoxClanUsers = new ListBox(true);
        dropBoxClanUsers.setSize("300px", "150px");
        dropBoxClanUsers.ensureDebugId("cwListBox-dropBox");
        dropBoxClanUsers.setVisibleItemCount(20);
        //dropBoxClanUsers.setMultipleSelect(true);
        rootPanel.add(dropBoxClanUsers, 300, posTop);

 
      //next row -- button search stats member's clan
      posTop = posTop + 35 ;
      //final Button statsMembersButton = new Button("Send");
      statsMembersButton.setText("Stats");
      rootPanel.add(statsMembersButton, 10, posTop);
      statsMembersButton.setSize("210px", "28px");
      statsMembersButton.setEnabled(false);

      //findHistorizedStatsButton
      posTop = posTop + 35 ;
      //final Button findHistorizedStatsWN8Button = new Button("Send");
      findHistorizedStatsWN8Button.setText("Histo WN8");
      rootPanel.add(findHistorizedStatsWN8Button, 10, posTop);
      findHistorizedStatsWN8Button.setSize("210px", "28px");
      findHistorizedStatsWN8Button.setEnabled(false);

      //findHistorizedStatsTanksButton
      posTop = posTop + 35 ;
      //final Button findHistorizedStatsWRButton = new Button("Send");
      findHistorizedStatsWRButton.setText("Histo WR");
      rootPanel.add(findHistorizedStatsWRButton, 10, posTop);
      findHistorizedStatsWRButton.setSize("210px", "28px");
      findHistorizedStatsWRButton.setEnabled(false);

      posTop = posTop + 35 ;
      //final Button findHistorizedStatsWRButton = new Button("Send");
      findHistorizedStatsBattleButton.setText("Histo Battle");
      rootPanel.add(findHistorizedStatsBattleButton, 10, posTop);
      findHistorizedStatsBattleButton.setSize("210px", "28px");
      findHistorizedStatsBattleButton.setEnabled(false);
     
     
      //next row - button achievement's member
        posTop = posTop + 70 ;
//      final Button findAchievementsMemberButton = new Button("Send");
//      findAchievementsMemberButton.setText("Achievements");
//      rootPanel.add(findAchievementsMemberButton, 10, posTop);
//      findAchievementsMemberButton.setSize("210px", "28px");
//      findAchievementsMemberButton.setEnabled(false);

        // Add a drop box with the category of achievement
//        final ListBox dropBoxCategoryAchievement = new ListBox(false);
//        dropBoxCategoryAchievement.setSize("300px", "28px");
//        dropBoxCategoryAchievement.ensureDebugId("cwListBox-dropBox");
//        rootPanel.add(dropBoxCategoryAchievement, 300, posTop);
//     
       
//        final ListBox dropBoxAchievement = new ListBox(false);
//        dropBoxAchievement.setSize("300px", "28px");
//        dropBoxAchievement.ensureDebugId("cwListBox-dropBox");
//        rootPanel.add(dropBoxAchievement, 650, posTop);
//     
     
       
      //loading .gif
        posTop = posTop + 35 ;
      Image image = new Image("loading.gif");
      hPanelLoading.add(image);
      hPanelLoading.setVisible(false);
        rootPanel.add(hPanelLoading, 350, posTop);
       
      // Create the popup dialog box in case of error

      dialogBox.setText("Remote Procedure Call");
      dialogBox.setAnimationEnabled(true);

      // We can set the id of a widget by accessing its Element
      closeButton.getElement().setId("closeButton");
      VerticalPanel dialogVPanel = new VerticalPanel();
      dialogVPanel.addStyleName("dialogVPanel");
      dialogVPanel.add(new HTML("<b>Sending name to the server:</b>"));
      dialogVPanel.add(textToServerLabel);
      dialogVPanel.add(new HTML("<br><b>Server replies:</b>"));
      dialogVPanel.add(serverResponseLabel);
      dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
      dialogVPanel.add(closeButton);
      dialogBox.setWidget(dialogVPanel);
   
     
     
      // Add a handler to close the DialogBox
      closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          dialogBox.hide();
//          searchClanButton.setEnabled(true);
//          searchClanButton.setFocus(true);
        }
      });
     
      // Create a handler for the Button search all clans
      class HandlerGetClans implements ClickHandler, KeyUpHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
          //si c'est bouton find more on incr�mente offset por trouver les 100 clans suivnats
//          if ( ((Button)event.getSource()).getText().equalsIgnoreCase(searchClansButtonMore.getText())) {
//            offsetClan = offsetClan + 100;
//            limitClan = 100;
//          } else {
            //bouton find clan offset 0
          offsetClan = 0;
          limitClan = 100;
          //}
          //recherche des clans
          getClans();
        }
 
        /**
         * Fired when the user types in the nameField.
         */
        public void onKeyUp(KeyUpEvent event) {
          if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
//            if ( event.getSource() instanceof Button && ((Button)event.getSource()).getText().equalsIgnoreCase(searchClansButtonMore.getText())) {
//              offsetClan = offsetClan + 100;
//              limitClan = 100;
//            } else {
            offsetClan = 0;
            limitClan = 100;
//            }
            getClans();
          }
        }
 
       
        /**
         * Send the name from the nameField to the server and wait for a response.
         */
        private void getClans() {
          hPanelLoading.setVisible(true);
          tableStatsCommAcc.setVisible(false);
          // First, we validate the input.
          errorLabel.setText("");
          String textToServer = nameClan.getText();
          if (!FieldVerifier.isValidName(textToServer)) {
            errorLabel.setText("Please enter at least four characters");
            return;
          }
 
          // Then, we send the input to the server.
          //searchClanButton.setEnabled(false);
          textToServerLabel.setText(textToServer);
          serverResponseLabel.setText("");
          wotService.getClans(textToServer , offsetClan,
              new AsyncCallback<Clan>() {
                public void onFailure(Throwable caught) {
                  hPanelLoading.setVisible(false);
                  // Show the RPC error message to the user
                  dialogBox
                      .setText("Remote Procedure Call - Failure");
                  serverResponseLabel
                      .addStyleName("serverResponseLabelError");
                  serverResponseLabel.setHTML(SERVER_ERROR);
                  dialogBox.center();
                  closeButton.setFocus(true);
                }
 
               
                public void onSuccess(Clan listClan) {
                  hPanelLoading.setVisible(false);
                  try {
                    //String translatedText =Translate.execute("Bonjour le monde", Languages.FRENCH, Languages.ENGLISH);
                    //System.out.println("Bonjour le monde : " + translatedText);
                   
                  } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                  }
                  String status_code= listClan.getStatus_code();
                  String status= listClan.getStatus();
//                  "status": "ok",
//                    "status_code": "NO_ERROR",
                 
                  if (status.equalsIgnoreCase("ok")) { 
//                    dockPanel.remove(tableStatsCommAcc);
//                    dockPanel.remove(tableClan);
//                    if (pagerStatsCommunityAccount != null)
//                      dockPanel.remove(pagerStatsCommunityAccount);
//                    if (pagerClan != null)
//                      dockPanel.remove(pagerClan);
                   
                    if (dataClanProvider.getDataDisplays()!= null && !dataClanProvider.getDataDisplays().isEmpty())
                      dataClanProvider.removeDataDisplay(tableClan);
                   
                    tableClan = new  CellTable<ItemsDataClan> (ItemsDataClan.KEY_PROVIDER);
                   
                    //construct column in celltable tableClan , set data set sort handler etc ..
                    buildACellTableForCommunityClan(listClan);
                   
                      ScrollPanel sPanel = new ScrollPanel();
                      //
                      sPanel.setStyleName("myCellTableStyle");
                      sPanel.setAlwaysShowScrollBars(true);
                      sPanel.setHeight("500px");
                      //sPanel.add(pagerClan);
                      sPanel.add(tableClan);
                      tp.add(sPanel, "Clans");
                    dockPanel.add(tp, DockPanel.SOUTH);
                    tp.selectTab(0);

                    tableClan.setVisible(true);
                    tableClan.setFocus(true);

                    searchUsersClanButton.setEnabled(true);
                   
                    //on autorise le bouton  more clans s'il y a en core 100 �lments dans TAB
//                    if(listClan.getItems().size()== 100)
//                      searchClansButtonMore.setEnabled(true);
//                    else {
//                      searchClansButtonMore.setEnabled(false);
//                    }
                    if(listClan.getItems().size()== 1) {
                     
                      tableClan.getSelectionModel().setSelected(listClan.getItems().get(0), true);
                     
                      //On pourrait chosir tout de suite les users du clan
                     
                     
                    }
                   
                  }else {
                    dialogBox
                    .setText(status_code);
                    serverResponseLabel
                        .addStyleName("serverResponseLabelError");
                    serverResponseLabel.setHTML(status_code + " An error arrived , please Retry again ! " );
                    dialogBox.center();
                    closeButton.setFocus(true);
                  }
                 
                }
            });
          //searchClanButton.setEnabled(true);
          //searchClanButton.setFocus(true);
        }
       
       

       
       
        //
       
       
      }
      /////////////////////////
      //creare a handler for persist data in datastore
      // Create a handler for the Button search all clans
      class HandlerPersistStats implements ClickHandler, KeyUpHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
          //persist stats
          persisStats(passSaving, nbUsersToTreat);
          passSaving = 1 ;
          nbUsersToTreat = 30;
        }
 
        /**
         * Fired when the user types in the nameField.
         */
        public void onKeyUp(KeyUpEvent event) {
          if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
            persisStats(passSaving, nbUsersToTreat);
            passSaving = 1 ;
            nbUsersToTreat = 30;
          }
        }
 
       
        /**
         * Send the name from the nameField to the server and wait for a response.
         */
        private void persisStats(int indexBeginSaveStatsUser, int indexEndSaveStatsUser) {
          hPanelLoading.setVisible(true);
            // recup des users selected in dropBoxClanUsers
          List<String> listIdUser = new ArrayList<String>();
          int itemCount = dropBoxClanUsers.getItemCount();
          for(int i = 0 ;  i< itemCount ; i++) {
            if (dropBoxClanUsers.isItemSelected(i)) {
              listIdUser.add(dropBoxClanUsers.getValue(i));
            }
          }
         
          // First, we validate the input.
          errorLabel.setText("");
          String textToServer = idClan;
          if (!FieldVerifier.isValidName(textToServer)) {
            errorLabel.setText("Please enter at least four characters");
            return;
          }
 
          // Then, we send the input to the server.
          //searchClanButton.setEnabled(false);
          textToServerLabel.setText(textToServer);
          serverResponseLabel.setText("");
          wotService.persistStats(textToServer , indexBeginSaveStatsUser, indexEndSaveStatsUser, listIdUser,//offsetClan,
              new AsyncCallback<List<String>>() {
                public void onFailure(Throwable caught) {
                  hPanelLoading.setVisible(false);
                  // Show the RPC error message to the user
                  dialogBox
                      .setText("Remote Procedure Call - Failure");
                  serverResponseLabel
                      .addStyleName("serverResponseLabelError");
                  serverResponseLabel.setHTML(SERVER_ERROR);
                  dialogBox.center();
                  closeButton.setFocus(true);
                }
 
               
                public void onSuccess(List<String> listClan) {
                  hPanelLoading.setVisible(false);
//                  if (listClan.size()== 0) {
//
//                    dialogBox
//                    .setText(idClan);
//                    serverResponseLabel
//                        .addStyleName("serverResponseLabelError");
//                    serverResponseLabel.setHTML(idClan + " An error arrived , please Retry again ! " );
//                    dialogBox.center();
//                    closeButton.setFocus(true);
//                  }
                 
                }
            });
          //searchClanButton.setEnabled(true);
          //searchClanButton.setFocus(true);
        }
       
       
       
      }
     
     
      ////
      ///////////
      // Create a handler for search achivement's member
//      class HandlerGetAchievementsMember implements ClickHandler, KeyUpHandler {
//        /**
//         * Fired when the user clicks on the sendButton.
//         */
//        public void onClick(ClickEvent event) {
//          int indexSelected = dropBoxCategoryAchievement.getSelectedIndex();
//          if (indexSelected >= 0 )
//          {
//            String valueSelected  = dropBoxCategoryAchievement.getValue(indexSelected);
//            getAchievementMember2(valueSelected);
//          }
////          offsetClan = 0;
////          limitClan = 100;
//        }
// 
//        /**
//         * Fired when the user types in the nameField.
//         */
//        public void onKeyUp(KeyUpEvent event) {
//          if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
//            int indexSelected = dropBoxCategoryAchievement.getSelectedIndex();
//            if (indexSelected >= 0 )
//            {
//              String valueSelected  = dropBoxCategoryAchievement.getValue(indexSelected);
//              getAchievementMember2(valueSelected);
//            }
////            offsetClan = 0;
////            limitClan = 100;
//          }
//        }
//        private void getAchievementMember2(String valueSelected) {
//          hPanelLoading.setVisible(true);
//          // First, we validate the input.
//          errorLabel.setText("");
//          String textToServer = idClan;
//          if (!FieldVerifier.isValidName(textToServer)) {
//            errorLabel.setText("Please enter at least four characters");
//           
//            /////
//            dialogBox
//            .setText("Select a Clan before!!");
//            serverResponseLabel
//                .addStyleName("serverResponseLabelError");
//            serverResponseLabel.setHTML("Click on a clan before find members !"  );
//            dialogBox.center();
//            closeButton.setFocus(true);
//            hPanelLoading.setVisible(false);
//            return;
//          }
//          dockPanel.remove(tableAchivementCommAcc);
//          dockPanel.remove(tableStatsCommAcc);
//          dockPanel. remove(tableClan);
//         
////          if (pagerAchievementsCommunityAccount != null)
////            dockPanel.remove(pagerAchievementsCommunityAccount);
////          if (pagerStatsCommunityAccount != null)
////            dockPanel.remove(pagerStatsCommunityAccount);
////          if (pagerClan != null)
////            dockPanel.remove(pagerClan);
//         
////         
////          if (dataAchievementsProvider.getDataDisplays()!= null && !dataAchievementsProvider.getDataDisplays().isEmpty())
////            dataAchievementsProvider.removeDataDisplay(tableAchivementCommAcc);
////         
//          //on re-construit 1 nouveau tableau
//          //tableAchivementCommAcc = new  CellTable<CommunityAccount> (CommunityAccount.KEY_PROVIDER);
//         
//          //construct column in celltable tableCommAcc , set data set sort handler etc ..
//          //buildACellTableForAchivementsCommunityAccount(dataStatsProvider.getList(), xmlWiki, valueSelected);
//           
//          //Create a Pager to control the table.
//            //SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
//            //pagerAchievementsCommunityAccount = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
//            //pagerAchievementsCommunityAccount.setDisplay(tableAchivementCommAcc);
//         
//         
//            //add to dock panel ======
//            //add tab achievement a the end
//            //dockPanel.add(pagerAchievementsCommunityAccount, DockPanel.SOUTH);
//            //pagerAchievementsCommunityAccount.setPage(10);
//            //pagerAchievementsCommunityAccount.setVisible(true);
//         
//          //dockPanel.add(tableAchivementCommAcc, DockPanel.SOUTH);
//          //tableAchivementCommAcc.setVisible(true);
//          //tableAchivementCommAcc.setFocus(true);
//            //add tab stats
////            dockPanel.add(pagerStatsCommunityAccount, DockPanel.SOUTH);
////          pagerStatsCommunityAccount.setPage(10);
////          pagerStatsCommunityAccount.setVisible(true);
//         
//          dockPanel.add(tableStatsCommAcc, DockPanel.SOUTH);
//          tableStatsCommAcc.setVisible(false);
//           
//          //add tab clan at the begin
//          //dockPanel.add(pagerClan, DockPanel.SOUTH);
//          //dockPanel.add(tableClan, DockPanel.SOUTH);
//          tableClan.setVisible(true);
//          //pagerClan.setVisible(true);
//          hPanelLoading.setVisible(false);
//        }
//      }
//     
     
      ///////////
      // Create a handler for search clan's members
      class HandlerGetAllMembersClanAndStats implements ClickHandler, KeyUpHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
          getMembersClan();
          offsetClan = 0;
          limitClan = 100;
        }
 
        /**
         * Fired when the user types in the nameField.
         */
        public void onKeyUp(KeyUpEvent event) {
          if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
            getMembersClan();
            offsetClan = 0;
            limitClan = 100;
          }
        }
 
        /**
         * Send the name from the nameField to the server and wait for a response.
         */
        private void getMembersClan() {
          // First, we validate the input.
          hPanelLoading.setVisible(true);
         
            // recup des users selected in dropBoxClanUsers
          List<String> listIdUser = new ArrayList<String>();
          int itemCount = dropBoxClanUsers.getItemCount();
          for(int i = 0 ;  i< itemCount ; i++) {
            if (dropBoxClanUsers.isItemSelected(i)) {
              listIdUser.add(dropBoxClanUsers.getValue(i));
            }
          }
         
         
          errorLabel.setText("");
          String textToServer = idClan;
          if (!FieldVerifier.isValidName(textToServer)) {
            errorLabel.setText("Please enter at least four characters");
           
            /////
            dialogBox
            .setText("Select a Clan before!!");
            serverResponseLabel
                .addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML("Click on a clan before find members !"  );
            dialogBox.center();
            closeButton.setFocus(true);
            return;
          }
 
          // Then, we send the input to the server.
          //searchClanButton.setEnabled(false);
          textToServerLabel.setText(textToServer);
          serverResponseLabel.setText("");
          wotService.getAllMembersClanAndStats(listIdUser,
              new AsyncCallback<AllCommunityAccount>() {
                public void onFailure(Throwable caught) {
                  hPanelLoading.setVisible(false);
                  // Show the RPC error message to the user
                  dialogBox
                      .setText("Remote Procedure Call - Failure");
                  serverResponseLabel
                      .addStyleName("serverResponseLabelError");
                  serverResponseLabel.setHTML(SERVER_ERROR);
                  dialogBox.center();
                  closeButton.setFocus(true);
                 
                }
 
                public void onSuccess(AllCommunityAccount listAccount) {
                  hPanelLoading.setVisible(false);
                  dockPanel.remove(tableStatsCommAcc);
                  dockPanel. remove(tableClan);
                 

                 
                  if (dataStatsProvider.getDataDisplays()!= null && !dataStatsProvider.getDataDisplays().isEmpty())
                    dataStatsProvider.removeDataDisplay(tableStatsCommAcc);
                 
                  //on re-construit 1 nouveau tableau
                  tableStatsCommAcc = new  CellTable<CommunityAccount> (CommunityAccount.KEY_PROVIDER);
                 
                  //construct column in celltable tableCommAcc , set data set sort handler etc ..
                  buildACellTableForStatsCommunityAccount(listAccount.getListCommunityAccount());
                   
                  //Create a Pager to control the table.
//                    SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
//                    pagerStatsCommunityAccount = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
//                    pagerStatsCommunityAccount.setDisplay(tableStatsCommAcc);
                 
                   
                    /////////
                    ScrollPanel sPanel = new ScrollPanel();
                    //
                    sPanel.setStyleName("myCellTableStyle");
                    sPanel.setAlwaysShowScrollBars(true);
                    sPanel.setHeight("500px");
                    //sPanel.add(pagerClan);
                    sPanel.add(tableStatsCommAcc);
                    tp.add(sPanel, "Stats");
                    int count = tp.getWidgetCount();
                  dockPanel.add(tp, DockPanel.SOUTH);
                  tp.selectTab(count-1);
                   
                  tableClan.setVisible(true);
                  //pagerClan.setVisible(true);
                 
                  tableStatsCommAcc.setFocus(true);
                  //dialogBox.center();
                  //closeButton.setFocus(true);
//                  statsMembersButton.setEnabled(true);
//                  findHistorizedStatsButton.setEnabled(true);
                }
              });
          //searchClanButton.setEnabled(true);
          //searchClanButton.setFocus(true);
        }
      }
      ///////////
     
     
     
      ///////////
      // Create a handler for search clan's members
      class HandlerGetAllStatsFromDossierCache implements ClickHandler, KeyUpHandler {
        /**
         * Fired when the user clicks on the sendButton.
         */
        public void onClick(ClickEvent event) {
          getStats();
         
        }
 
        /**
         * Fired when the user types in the nameField.
         */
        public void onKeyUp(KeyUpEvent event) {
          if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
            getStats();
           
          }
        }
 
        /**
         * Send the name from the nameField to the server and wait for a response.
         */
        private void getStats() {
         
              String filename = fileUpload.getFilename();
              String textToServer = filename;
             
              if (filename.length() == 0) {
                errorLabel.setText("Please enter at least four characters");
           
View Full Code Here

        VerticalPanel panel = new VerticalPanel();
        panel.getElement().setAttribute("style", "width:100%");
        form.setWidget(panel);

        // Create a FileUpload widget.
        final FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);


        final HTML errorMessages = new HTML("Please chose a file!");
        errorMessages.setStyleName("error-panel");
        errorMessages.setVisible(false);
        panel.add(errorMessages);

        // Add a 'submit' button.


        ClickHandler cancelHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                window.hide();
            }
        };

        ClickHandler submitHandler = new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                errorMessages.setVisible(false);

                // verify form
                String filename = upload.getFilename();

                if(tabs.getTabBar().getSelectedTab()==1)
                {
                    // unmanaged content
                    if(unmanagedForm.validate().hasErrors())
                    {
                        return;
                    }
                    else
                    {
                        wizard.onCreateUnmanaged(unmanagedForm.getUpdatedEntity());
                    }
                }
                else if(filename!=null && !filename.equals(""))
                {
                    loading = Feedback.loading(
                            Console.CONSTANTS.common_label_plaseWait(),
                            Console.CONSTANTS.common_label_requestProcessed(),
                            new Feedback.LoadingCallback() {
                                @Override
                                public void onCancel() {

                                }
                            });
                    form.submit();
                }
                else
                {
                    errorMessages.setVisible(true);
                }
            }
        };

        DialogueOptions options = new DialogueOptions(
                Console.CONSTANTS.common_label_next(), submitHandler,
                Console.CONSTANTS.common_label_cancel(), cancelHandler);

        // Add an event handler to the form.
        form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {

                getLoading().hide();


                String html = event.getResults();

                // Step 1: upload content, retrieve hash value
                try {

                    String json = html;

                    try {
                        if(!GWT.isScript()) // TODO: Formpanel weirdness
                            json = html.substring(html.indexOf(">")+1, html.lastIndexOf("<"));
                    } catch (StringIndexOutOfBoundsException e) {
                        // if I get this exception it means I shouldn't strip out the html
                        // this issue still needs more research
                        Log.debug("Failed to strip out HTML.  This should be preferred?");
                    }

                    JSONObject response  = JSONParser.parseLenient(json).isObject();
                    JSONObject result = response.get("result").isObject();
                    String hash= result.get("BYTES_VALUE").isString().stringValue();
                    // step2: assign name and group
                    wizard.onUploadComplete(upload.getFilename(), hash);

                } catch (Exception e) {
                    Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e);
                }
View Full Code Here

        FlowPanel uploadPanel = new FlowPanel();
        uploadPanel.getElement().getStyle().setMarginTop(2, Style.Unit.EM);
        InlineLabel uploadLabel = new InlineLabel(Console.CONSTANTS.patch_manager_select_patch_upload());
        uploadLabel.getElement().getStyle().setMarginRight(1, Style.Unit.EM);
        uploadPanel.add(uploadLabel);
        upload = new FileUpload();
        upload.setName("patch_file");
        upload.getElement().setId(asId(PREFIX, getClass(), "_Upload"));
        uploadPanel.add(upload);
        panel.add(uploadPanel);
View Full Code Here

        form = new WellForm();
        form.setAction( GWT.getModuleBaseURL() + "m2repo/file" );
        form.setEncoding( FormPanel.ENCODING_MULTIPART );
        form.setMethod( FormPanel.METHOD_POST );

        FileUpload up = new FileUpload();
        //up.setWidth("100px");
        up.setName( HTMLFileManagerFields.UPLOAD_FIELD_NAME_ATTACH );

        Button ok = new Button( "upload" );
        ok.addClickHandler( new ClickHandler() {
            public void onClick( ClickEvent event ) {
                showUploadingBusy();
View Full Code Here

        uploadFormPanel.setMethod( FormPanel.METHOD_POST );

        HorizontalPanel panel = new HorizontalPanel();
        uploadFormPanel.setWidget( panel );

        final FileUpload upload = new FileUpload();
        upload.setName( HTMLFileManagerFields.CLASSIC_DRL_IMPORT );
        panel.add( upload );

        panel.add( new Label( constants.upload() ) );
        ImageButton ok = new ImageButton( images.upload(),
                                          constants.Import() );
        ClickHandler okClickHandler = new ClickHandler() {
            public void onClick(ClickEvent event) {
                if ( Window.confirm( constants.ImportMergeWarning() ) ) {
                    LoadingPopup.showMessage( constants.ImportingDRLPleaseWait() );
                    uploadFormPanel.submit();
                }
            }

        };
        ok.addClickHandler( okClickHandler );

        panel.add( ok );

        final FormStylePopup packageNamePopup = new FormStylePopup( images.packageLarge(),
                                                                    constants.PackageName() );
        HorizontalPanel packageNamePanel = new HorizontalPanel();
        packageNamePopup.addRow( new Label( constants.ImportedDRLContainsNoNameForThePackage() ) );

        final TextBox packageName = new TextBox();
        packageNamePanel.add( new Label( constants.PackageName() + ":" ) );
        packageNamePanel.add( packageName );
        Button uploadWithNameButton = new Button( constants.OK() );
        uploadWithNameButton.addClickHandler( okClickHandler );
        packageNamePanel.add( uploadWithNameButton );
        packageNamePopup.addRow( packageNamePanel );

        uploadFormPanel.addSubmitCompleteHandler( new SubmitCompleteHandler() {
            public void onSubmitComplete(SubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) { //NON-NLS
                    LoadingPopup.close();
                    Window.alert( constants.PackageWasImportedSuccessfully() );
                    afterCreatedEvent.execute();
                    parent.hide();
                    if ( packageNamePopup != null ) {
                        packageNamePopup.hide();
                    }
                } else if ( event.getResults().indexOf( "Missing package name." ) > -1 ) { //NON-NLS
                    LoadingPopup.close();
                    packageNamePopup.show();
                } else {
                    ErrorPopup.showMessage( constants.UnableToImportIntoThePackage0( event.getResults() ) );
                }
                LoadingPopup.close();
            }
        } );
        uploadFormPanel.addSubmitHandler( new SubmitHandler() {
            public void onSubmit(SubmitEvent event) {
                if ( upload.getFilename().length() == 0 ) {
                    Window.alert( constants.YouDidNotChooseADrlFileToImport() );
                    event.cancel();
                } else if ( !upload.getFilename().endsWith( ".drl" ) ) { //NON-NLS
                    Window.alert( constants.YouCanOnlyImportDrlFiles() );
                    event.cancel();
                } else if ( packageName.getText() != null && !packageName.getText().equals( "" ) ) {
                    uploadFormPanel.setAction( uploadFormPanel.getAction() + "?packageName=" + packageName.getText() );
                } else {
View Full Code Here

        uploadFormPanel.setMethod( FormPanel.METHOD_POST );

        HorizontalPanel panel = new HorizontalPanel();
        uploadFormPanel.setWidget( panel );

        final FileUpload upload = new FileUpload();
        upload.setName( HTMLFileManagerFields.FILE_UPLOAD_FIELD_NAME_IMPORT );
        panel.add( upload );

        Button ok = new Button( constants.Import() );
        ok.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent sender) {
                doImportFile( uploadFormPanel );
            }

            private void doImportFile(final FormPanel uploadFormPanel) {
                if ( Window.confirm( constants.ImportConfirm() ) ) {
                    LoadingPopup.showMessage( constants.ImportingInProgress() );
                    uploadFormPanel.submit();
                }
            }
        } );

        panel.add( ok );

        uploadFormPanel.addSubmitCompleteHandler( new SubmitCompleteHandler() {

            public void onSubmitComplete(SubmitCompleteEvent event) {
                if ( event.getResults().indexOf( "OK" ) > -1 ) {
                    Window.alert( constants.ImportDone() );
                    History.newItem( " " );
                    Window.Location.reload();
                } else {
                    ErrorPopup.showMessage( constants.ImportFailed() );
                }
                LoadingPopup.close();
            }
        } );

        uploadFormPanel.addSubmitHandler( new SubmitHandler() {

            public void onSubmit(SubmitEvent event) {
                String fileName = upload.getFilename();
                if ( fileName.length() == 0 ) {
                    Window.alert( constants.NoExportFilename() );
                    event.cancel();
                } else {
                    String lowerCaseFileName = fileName.toLowerCase();
View Full Code Here

        VerticalPanel panel = new VerticalPanel();
        panel.getElement().setAttribute("style", "width:100%");
        form.setWidget(panel);

        // Create a FileUpload widget.
        final FileUpload upload = new FileUpload();
        upload.setName("uploadFormElement");
        panel.add(upload);

        // Add a 'submit' button.

        Label cancel = new Label(Console.CONSTANTS.common_label_cancel());
        cancel.setStyleName("html-link");
        cancel.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                window.hide();
            }
        });

        String okText = Console.CONSTANTS.common_label_next() + " &rsaquo;&rsaquo;";
        Button submit = new DefaultButton(okText, new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                form.submit();
            }
        });

        HorizontalPanel options = new HorizontalPanel();
        options.getElement().setAttribute("style", "margin-top:10px;width:100%");

        HTML spacer = new HTML("&nbsp;");
        options.add(spacer);

        options.add(submit);
        options.add(spacer);
        options.add(cancel);
        cancel.getElement().getParentElement().setAttribute("style","vertical-align:middle");
        submit.getElement().getParentElement().setAttribute("align", "right");
        submit.getElement().getParentElement().setAttribute("width", "100%");

        panel.add(options);

        // Add an event handler to the form.
        form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            @Override
            public void onSubmitComplete(FormPanel.SubmitCompleteEvent event) {
                String html = event.getResults();

                // Step 1: upload content, retrieve hash value
                try {

                    String json = html;

                    if(!GWT.isScript()) // TODO: Formpanel weirdness
                        json = html.substring(html.indexOf(">")+1, html.lastIndexOf("<"));

                    JSONObject response  = JSONParser.parseLenient(json).isObject();
                    JSONObject result = response.get("result").isObject();
                    String hash= result.get("BYTES_VALUE").isString().stringValue();
                    // step2: assign name and group
                    wizard.onUploadComplete(upload.getFilename(), hash);

                } catch (Exception e) {
                    Log.error(Console.CONSTANTS.common_error_failedToDecode() + ": " + html, e);
                }
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.FileUpload$FileUploadImplOpera

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.