コード例 #1
0
 /**
  * Add an item to the list.
  *
  * @param pNewWidget the new display widget
  */
 @SuppressWarnings("unchecked")
 protected void addDisplayWidget(final W pNewWidget) {
   final String itemId = getIdFromWidget(pNewWidget);
   int beforeIdx = -1;
   for (Widget w : iGuiList) {
     CbGenericListItem<W> gli = (CbGenericListItem<W>) w;
     if (itemId.compareToIgnoreCase(getIdFromWidget(gli.getDisplayWidget())) < 0) {
       beforeIdx = gli.getRowIdx();
       break;
     }
   }
   CbGenericListItem<W> newRow =
       new CbGenericListItem<W>(getSelectorCallback(), getMoreArrowCallback());
   newRow.setDisplayWidget(pNewWidget);
   if (beforeIdx < 0) {
     newRow.setRowIdx(iGuiList.getWidgetCount());
     iGuiList.add(newRow);
   } else {
     newRow.setRowIdx(beforeIdx);
     iGuiList.insert(newRow, beforeIdx);
     int i = 0;
     for (Widget w : iGuiList) {
       ((CbGenericListItem<W>) w).setRowIdx(i++);
     }
   }
   checkEmptyListHint();
 }
コード例 #2
0
 public void setResourcePlayLink() {
   Anchor resourceAnchor = new Anchor();
   resourceAnchor.setHref(getResourceLink());
   resourceAnchor.setStyleName("");
   resourceAnchor.getElement().appendChild(resourceImageContainer.getElement());
   resourceThumbContainer.insert(resourceAnchor, 0);
 }
コード例 #3
0
  public void makeEditable(ClickHandler saveClickHandler, Labels labels) {
    annotationPanel.setVisible(false);

    CommentField commentField = new CommentField(annotation.getText(), labels, true);
    commentField.addSaveClickHandler(saveClickHandler);
    container.insert(commentField, container.getWidgetIndex(annotationPanel));
  }
コード例 #4
0
ファイル: Uploader.java プロジェクト: cyrilmhansen/gwtupload
 public void add(Widget w) {
   if (w instanceof Hidden) {
     formElements.insert(w, 0);
   } else {
     formElements.add(w);
   }
 }
コード例 #5
0
  /**
   * Adds a widget to the front of the button panel.
   *
   * <p>
   *
   * @param w the widget to add
   */
  public void addButtonToFront(Widget w) {

    m_buttonPanel.insert(w, 0);
    if (CmsCoreProvider.get().isIe7()) {
      m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX);
    }
  }
コード例 #6
0
  /**
   * Internal method which is called when the user clicks on an editable title field.
   *
   * <p>
   */
  protected void editTitle() {

    m_title.setVisible(false);
    final TextBox box = new TextBox();
    box.setText(m_title.getText());
    box.getElement().setAttribute("size", "45");
    box.addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().labelInput());
    box.addStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().titleInput());
    final String originalTitle = m_title.getText();
    // wrap the boolean flag in an array so we can change it from the event handlers
    final boolean[] checked = new boolean[] {false};

    box.addBlurHandler(
        new BlurHandler() {

          /**
           * @see
           *     com.google.gwt.event.dom.client.BlurHandler#onBlur(com.google.gwt.event.dom.client.BlurEvent)
           */
          public void onBlur(BlurEvent event) {

            if (checked[0]) {
              return;
            }

            onEditTitleTextBox(box);
            checked[0] = true;
          }
        });

    box.addKeyPressHandler(
        new KeyPressHandler() {

          /**
           * @see
           *     com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)
           */
          public void onKeyPress(KeyPressEvent event) {

            if (checked[0]) {
              return;
            }

            int keycode = event.getNativeEvent().getKeyCode();

            if ((keycode == 10) || (keycode == 13)) {
              onEditTitleTextBox(box);
              checked[0] = true;
            }
            if (keycode == 27) {
              box.setText(originalTitle);
              onEditTitleTextBox(box);
              checked[0] = true;
            }
          }
        });
    m_titleRow.insert(box, 1);
    box.setFocus(true);
  }
コード例 #7
0
 private void addFile() {
   file = new FileUpload();
   file.setHeight("22px");
   file.setWidth("100%");
   file.setName("file");
   file.ensureDebugId("file-uploadFile-ChooseFile");
   file.addChangeHandler(
       new ChangeHandler() {
         @Override
         public void onChange(ChangeEvent event) {
           delegate.onFileNameChanged();
         }
       });
   uploadPanel.insert(file, 0);
 }
コード例 #8
0
ファイル: InfiniteList.java プロジェクト: juriad/artique
  /** Does the actual addition of {@link UserItem}s to the top of the list. */
  private void addHead() {
    List<UserItem> l = head;
    if (l.size() > 0) {
      head = new ArrayList<UserItem>();
      headKeys = new HashSet<Key>();

      int offsetHeight = flowPanel.getOffsetHeight();
      for (int i = l.size() - 1; i >= 0; i--) {
        UserItem e = l.get(i);
        RowWidget row = createRow(e);
        flowPanel.insert(row, 0);
        rows.put(row.getKey(), row);
      }

      int deltaHeight = flowPanel.getOffsetHeight() - offsetHeight;
      scrollPanel.setVerticalScrollPosition(scrollPanel.getVerticalScrollPosition() + deltaHeight);

      rowsAdded();
      NewDataEvent.fire(this, NewDataType.NEW_DATA_SHOWN);
    }
  }
コード例 #9
0
  /**
   * Ensures the open close button for the additional info list is present.
   *
   * <p>
   */
  protected void ensureOpenCloseAdditionalInfo() {

    if (m_openClose == null) {
      m_openClose =
          new CmsPushButton(
              I_CmsImageBundle.INSTANCE.style().triangleRight(),
              I_CmsImageBundle.INSTANCE.style().triangleDown());
      m_openClose.setButtonStyle(ButtonStyle.TRANSPARENT, null);
      m_titleRow.insert(m_openClose, 0);
      m_openClose.addClickHandler(
          new ClickHandler() {

            /**
             * @see
             *     com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
             */
            public void onClick(ClickEvent event) {

              setAdditionalInfoVisible(
                  !getElement().getClassName().contains(CmsListItemWidget.OPENCLASS));
            }
          });
    }
  }
コード例 #10
0
ファイル: Uploader.java プロジェクト: cyrilmhansen/gwtupload
 public void add(Widget w, int index) {
   formElements.insert(w, Math.max(0, Math.min(index, formElements.getWidgetCount())));
 }
コード例 #11
0
 @Override
 public void insert(Widget w, int beforeIndex) {
   w.getElement().getStyle().setDisplay(Display.BLOCK);
   super.insert(w, beforeIndex);
 }
コード例 #12
0
ファイル: HQMFViewer.java プロジェクト: chinbaj/CQL_POC
  private void makeBookMarks(FlowPanel flowPanel, TextArea textArea) {

    // TextArea firstTextArea = (TextArea) flowPanel.getWidget(0);

    // Check for data criteria section. This has Measure Details and the start of
    // dataCriteriaSection.
    // We need to break it up so that "Measure Details" and dataCriteriaSection are 2 different
    // textareas.

    String text = textArea.getText();
    int dataCritIndex = text.indexOf("<dataCriteriaSection>");
    if (dataCritIndex > -1) {
      String measureDetailsText = text.substring(0, dataCritIndex);
      String dataCritSection = text.substring(dataCritIndex);
      textArea.setText(measureDetailsText);
      textArea.setVisibleLines(getLineCount(measureDetailsText) + 3);

      TextArea dataCritTextArea = new TextArea();
      dataCritTextArea.setStyleName("textarea_noborder");
      dataCritTextArea.setText(dataCritSection);
      flowPanel.add(dataCritTextArea);
      dataCritTextArea.setReadOnly(true);
      dataCritTextArea.setWidth("100%");
      dataCritTextArea.setHeight("100%");
      dataCritTextArea.setVisibleLines(getLineCount(dataCritSection) + 3);

      flowPanel.insert(dataCritTextArea, flowPanel.getWidgetIndex(textArea) + 1);
      bookmarkMap.put("Data Criteria Section", dataCritTextArea);
    } else {
      // make sure the textarea does not have a style class of 'entry_background' and
      // 'criteriaRef_background',
      // find '<populationCriteriaSection>'.
      int isEntryTextArea = textArea.getStyleName().indexOf("entry_background");
      int isCritRefTextArea = textArea.getStyleName().indexOf("criteriaRef_background");

      if (isEntryTextArea == -1 && isCritRefTextArea == -1) {
        if (text.indexOf("<populationCriteriaSection>") > -1) {
          int extensionIndex = text.indexOf("<id extension=\"");
          if (extensionIndex > -1) {
            int startExtensionIndex = extensionIndex + "<id extension=\"".length();
            String extension =
                text.substring(startExtensionIndex, text.indexOf("\"", startExtensionIndex));
            System.out.println("Pop Crit Extension:" + extension);
            bookmarkMap.put(extension, textArea);
          }
        }
      }
    }

    // int textAreaCount = flowPanel.getWidgetCount();
    // Go through rest of the textAreas (from index 2) and for the textAreas which do
    // not have a style class of 'entry_background' and 'criteriaRef_background',
    // find '<populationCriteriaSection>'.

    // for(int i = 2;i < textAreaCount; i++){

    //			TextArea textArea = (TextArea) flowPanel.getWidget(i);
    //			int isEntryTextArea = textArea.getStyleName().indexOf("entry_background");
    //			int isCritRefTextArea = textArea.getStyleName().indexOf("criteriaRef_background");
    //
    //			if (isEntryTextArea == -1 && isCritRefTextArea == -1){
    //				if(textArea.getText().indexOf("<populationCriteriaSection>") > -1){
    //					String popCritText = textArea.getText();
    //					int extensionIndex = popCritText.indexOf("<id extension=\"");
    //					if(extensionIndex > -1){
    //						int startExtensionIndex = extensionIndex + "<id extension=\"".length();
    //						String extension = popCritText.substring(startExtensionIndex,
    // popCritText.indexOf("\"",startExtensionIndex));
    //						System.out.println("Pop Crit Extension:"+extension);
    //						bookmarkMap.put(extension, textArea);
    //					}
    //				}
    //			}

    // }

  }
コード例 #13
0
  public void initialise(final Result result) {
    this.clear(); // if not cleared then updated panels are added under old ones

    TextPanel information =
        new TextPanel(
            " Here you can download the information the Molecules Tab provides.\n"
                + "The format will be TSV which can easily be handled with most word processors.");
    information.setStyleName("elv-InformationPanel-Download");
    this.addNorth(information, 25);

    // Creating ToggleButton for each possible category of molecules.
    VerticalPanel requiredType = new VerticalPanel();
    requiredType.add(new TextPanel("Please select the type of Molecules you are interested in:"));

    // Allow immediate changes to Preview by adding ClickHandler to every CheckBox.
    ClickHandler updateText =
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            textArea.setText(resultToText());
            textArea.setStyleName("elv-PreviewPanel-Download");
          }
        };

    // Checking for each category of molecules if they are present before adding Handler.
    if (result.getChemicals().size() > 0) {
      requiredType.add(chemTB);
      chemTB.addClickHandler(updateText);
    }

    if (result.getProteins().size() > 0) {
      requiredType.add(protTB);
      protTB.addClickHandler(updateText);
    }

    if (result.getSequences().size() > 0) {
      requiredType.add(sequTB);
      sequTB.addClickHandler(updateText);
    }

    if (result.getOthers().size() > 0) {
      requiredType.add(otheTB);
      otheTB.addClickHandler(updateText);
    }

    requiredType.setStyleName("elv-SelectionPanels-Download");

    // Creating ToggleButton for each available attribute of molecules and adding Handler.
    VerticalPanel requiredFields = new VerticalPanel();
    requiredFields.add(new TextPanel("Please select the fields you are interested in:"));

    typeTB.addClickHandler(updateText);
    requiredFields.add(typeTB);

    identifierTB.addClickHandler(updateText);
    requiredFields.add(identifierTB);

    nameTB.addClickHandler(updateText);
    requiredFields.add(nameTB);

    requiredFields.setStyleName("elv-SelectionPanels-Download");

    // Creating button for download.
    // Browsers that fully support Blob/Download:
    // Chrome, Chrome for Android, Firefox 20+, IE 10+, Opera 15+, Safari 6.1+
    VerticalPanel buttonField = new VerticalPanel();
    buttonField.add(startDownloadBtn);
    startDownloadBtn.setStyleName("elv-Download-Button");
    buttonField.setStyleName("elv-ButtonPanel-Download");
    startDownloadBtn.setTitle(
        "Depending on your browser you can either download your file by clicking on this button"
            + " or your will be redirected to a new tab in your browser where you can right click and"
            + " save the data.");
    startDownloadBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if ((chemTB.getValue() || protTB.getValue() || sequTB.getValue() || otheTB.getValue())
                && (typeTB.getValue() || nameTB.getValue() || identifierTB.getValue())) {
              alertDownload(textArea.getText());
            } else {
              DialogBoxFactory.alert(
                  "Molecules Download",
                  "You are trying to download an empty file.\n"
                      + "Please select at least one type of molecules AND one field for the download.");
            }
            presenter.moleculeDownloadStarted();
          }
        });
    buttonField.add(startGenomeSpaceDownloadBtn);
    startGenomeSpaceDownloadBtn.setStyleName("elv-Download-Button");
    startGenomeSpaceDownloadBtn.setTitle(
        "Clicking this button should open a window to import the data to GenomeSpace. "
            + "Depending on your browser configuration, you may have to enable popups for the Reactome website");
    startGenomeSpaceDownloadBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            if ((chemTB.getValue() || protTB.getValue() || sequTB.getValue() || otheTB.getValue())
                && (typeTB.getValue() || nameTB.getValue() || identifierTB.getValue())) {
              Integer randomInt = random.nextInt(1000 - 1) + 1;
              try {
                uploadListToGenomeSpace(textArea.getText(), randomInt.toString());
              } catch (JavaScriptException exception) {
                Window.alert(exception.getMessage());
              }
            } else {
              Window.alert(
                  "You are trying to download an empty file.\n"
                      + "Please select at least one type of molecules AND one field for the download.");
            }
            presenter.moleculeDownloadStarted();
          }
        });

    // Bringing together the two panels.
    FlowPanel controlArea = new FlowPanel();
    controlArea.insert(requiredType.asWidget(), 0);
    controlArea.insert(requiredFields.asWidget(), 1);
    ScrollPanel scrollPanel = new ScrollPanel(controlArea);

    this.addWest(scrollPanel, 200);
    this.addEast(buttonField, 100);

    // Preview
    this.textArea = new TextArea();
    this.textArea.setVisible(true);
    this.textArea.setTitle("Preview of what your download file will look like.");
    this.textArea.setText(resultToText());
    this.add(textArea);
    this.textArea.setStyleName("elv-PreviewPanel-Download");

    this.addStyleName("elv-Details-OverviewPanel");
  }