Package com.google.gwt.core.client

Examples of com.google.gwt.core.client.JsArrayString


    assertTrue("result[1] 2", result.get(1).isEqual(2, "Two"));
    assertTrue("result[2] 2", result.get(2).isEqual(3, "Three"));
  }

  public void testToJsArrayString() {
    JsArrayString result;
    result = ArrayHelper.toJsArrayString("foo");
    assertEquals("length", 1, result.length());
    assertEquals("result[0]", "foo", result.get(0));

    result = ArrayHelper.toJsArrayString("foo", "bar", "baz");
    assertEquals("length", 3, result.length());
    assertEquals("result[0]", "foo", result.get(0));
    assertEquals("result[1]", "bar", result.get(1));
    assertEquals("result[2]", "baz", result.get(2));

    String[] strings = {"foo", "bar", "baz"};
    result = ArrayHelper.toJsArrayString(strings);
    assertEquals("length", 3, result.length());
    assertEquals("result[0]", "foo", result.get(0));
    assertEquals("result[1]", "bar", result.get(1));
    assertEquals("result[2]", "baz", result.get(2));
  }
View Full Code Here


  public void testFields() {
    loadApi(new Runnable() {
      public void run() {
        StreetviewUserPhotosOptions opts = StreetviewUserPhotosOptions.newInstance();

        JsArrayString array = ArrayHelper.toJsArrayString("picasa", "flickr");
        // Intentional repetition to check builder pattern
        opts.setPhotoRepositories(array).setPhotoRepositories(array);
        assertSame(array, getJso(opts, "photoRepositories"));
      }
    });
View Full Code Here

   *
   * @param callback the handler to be called
   */
  public void loadApi(Runnable callback) {
    AjaxLoaderOptions options = AjaxLoaderOptions.newInstance();
    JsArrayString packagesArray = JsArrayString.createArray().cast();
    for (int i = 0; i < packages.length; i++) {
      packagesArray.push(packages[i].getName());
    }
    options.setPackages(packagesArray);
    if (language != null) {
      options.setLanguage(language);
    }
View Full Code Here

     
      packageSourceListBox_ = new ListBox();
      packageSourceListBox_.setStylePrimaryName(
                           RESOURCES.styles().packageSourceListBox());
      packageSourceListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
      JsArrayString repos = installContext_.selectedRepositoryNames();
      if (repos.length() == 1)
      {
         packageSourceListBox_.addItem("Repository (" + repos.get(0) + ")");
      }
      else
      {
         StringBuilder reposItem = new StringBuilder();
         reposItem.append("Repository (");
         for (int i=0; i<repos.length(); i++)
         {
            if (i != 0)
               reposItem.append(", ");
            reposItem.append(repos.get(i));
         }
         reposItem.append(")");
         packageSourceListBox_.addItem(reposItem.toString());
      }
      packageSourceListBox_.addItem("Package Archive File (" +
                                    installContext_.packageArchiveExtension() +
                                    ")");
      mainPanel.add(packageSourceListBox_);
     
      // source panel container
      sourcePanel_ = new SimplePanel();
      sourcePanel_.setStylePrimaryName(RESOURCES.styles().packageSourcePanel());
     
      // repos source panel
      reposSourcePanel_ = new FlowPanel();
      Label packagesLabel = new Label(
                      "Packages (separate multiple with space or comma):");
      packagesLabel.setStylePrimaryName(RESOURCES.styles().packagesLabel());
      reposSourcePanel_.add(packagesLabel);
    
      packagesTextBox_ = new MultipleItemSuggestTextBox();
      packagesSuggestBox_ = new SuggestBox(new PackageOracle(),
                                           packagesTextBox_);
      packagesSuggestBox_.setWidth("100%");
      packagesSuggestBox_.setLimit(20);
      packagesSuggestBox_.addStyleName(RESOURCES.styles().extraBottomPad());
      reposSourcePanel_.add(packagesSuggestBox_);
      sourcePanel_.setWidget(reposSourcePanel_);
      mainPanel.add(sourcePanel_);
        
      // archive source panel
      packageArchiveFile_ = new TextBoxWithButton(
                                              "Package archive:",
                                              "Browse...",
                                              browseForArchiveClickHandler_);
           
      // create check box here because manageUIState accesses it
      installDependenciesCheckBox_ = new CheckBox();
     
      if (defaultInstallOptions_.getInstallFromRepository())
         packageSourceListBox_.setSelectedIndex(0);
      else
         packageSourceListBox_.setSelectedIndex(1);
      manageUIState();
     
      packageSourceListBox_.addChangeHandler(new ChangeHandler() {
         @Override
         public void onChange(ChangeEvent event)
         {
            manageUIState();
           
            if (!installFromRepository())
               packageArchiveFile_.click();
         }
      });
     
    
      mainPanel.add(new Label("Install to Library:"));
     
      // library list box
      libraryListBox_ = new ListBox();
      libraryListBox_.setWidth("100%");
      libraryListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
      JsArrayString libPaths = installContext_.getWriteableLibraryPaths();
      int selectedIndex = 0;
      for (int i=0; i<libPaths.length(); i++)
      {
         String libPath = libPaths.get(i);
        
         if (!installContext_.isDevModeOn())
         {
            if (defaultInstallOptions_.getLibraryPath().equals(libPath))
               selectedIndex = i;
View Full Code Here

         {
            return view_.getInputEditorDisplay().getText();
         }
      };

      JsArrayString history = sessionInfo.getConsoleHistory();
      if (history != null)
         setHistory(history);

      RpcObjectList<ConsoleAction> actions = sessionInfo.getConsoleActions();
      if (actions != null)
View Full Code Here

      }

      // draw additional rows when the row has been expanded
      private void buildExpandedContentRow(RObjectEntry rowValue)
      {
         JsArrayString contents = rowValue.rObject.getContents();

         for (int idx = 0; idx < contents.length(); idx++)
         {
            TableRowBuilder detail = startRow().className(style_.detailRow());
            detail.startTD().endTD();
            TableCellBuilder objectDetail = detail.startTD();
            String content = contents.get(idx);
            // ignore the first two characters of output
            // ("$ value:" becomes "value:")
            content = content.substring(2, content.length()).trim();
            objectDetail.colSpan(2)
                    .title(content)
View Full Code Here

      mainPanel_.clear();
     
      if (manipulator != null && manipulator.getVariables() != null)
      {        
         // iterate over the variables
         JsArrayString variables = manipulator.getVariables();
         for (int i=0; i<variables.length(); i++)
         {
            String variable = variables.get(i);
            try
            {
               ManipulatorControl addedControl = null;
               Manipulator.Control control = manipulator.getControl(variable);
               switch(control.getType())
View Full Code Here

         {
            if (dropDownImage_.isVisible())
            {
               CodeBrowserPopupMenu menu = new CodeBrowserPopupMenu();
              
               JsArrayString methods = functionDef_.getMethods();
               for (int i=0; i < methods.length(); i++)
               {
                  final String method = methods.get(i);
                  MenuItem mi = new MenuItem(method, new Command() {
                     @Override
                     public void execute()
                     {
                        SelectionEvent.fire(CodeBrowserContextWidget.this,
View Full Code Here

      panel.add(captionLabel);
     
      // picker
      listBox_ = new ListBox();
      listBox_.setVisibleItemCount(1);
      JsArrayString choices = picker.getChoices();
      int selectedIndex = 0;
      for (int i=0; i<choices.length(); i++)
      {
         String choice = choices.get(i);
         listBox_.addItem(choice);
         if (choice.equals(value))
            selectedIndex = i;
      }
      listBox_.setSelectedIndex(selectedIndex);
View Full Code Here

      }
   }
  
   private void openProjectDocs(final Session session)
   {
      JsArrayString openDocs = session.getSessionInfo().getProjectOpenDocs();
      if (openDocs.length() > 0)
      {
         // set new tab pending for the duration of the continuation
         newTabPending_++;
                
         // create a continuation for opening the source docs
         SerializedCommandQueue openCommands = new SerializedCommandQueue();
        
         for (int i=0; i<openDocs.length(); i++)
         {
            String doc = openDocs.get(i);
            final FileSystemItem fsi = FileSystemItem.createFile(doc);
             
            openCommands.addCommand(new SerializedCommand() {

               @Override
View Full Code Here

TOP

Related Classes of com.google.gwt.core.client.JsArrayString

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.