コード例 #1
0
  private FlexTable getFooter() {

    ft = new FlexTable();
    ft.addStyleName("perunFooter");

    FlexTable.FlexCellFormatter ftf = ft.getFlexCellFormatter();

    if (!voContact.getHTML().isEmpty()) {
      // show only if any contact is present
      voContact.setHTML(
          "<strong>"
              + ApplicationMessages.INSTANCE.supportContact()
              + "</strong> "
              + voContact.getHTML());
    }

    ft.setWidget(0, 0, voContact);
    ft.setWidget(0, 1, new HTML(PerunWebConstants.INSTANCE.footerPerunCopyright()));

    ftf.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_LEFT);
    ftf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    ftf.getElement(0, 1).setAttribute("style", "text-wrap: avoid;");
    ftf.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    ftf.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    return ft;
  }
コード例 #2
0
 /*
  * (non-Javadoc)
  *
  * @see com.google.gwt.user.client.ui.HasValue#getValue()
  */
 public String getValue() {
   if (allowHtml) {
     if (constants.editValue().equals(myHtmlView.getHTML())) {
       return null;
     } else {
       return myHtmlView.getHTML();
     }
   } else {
     if (constants.editValue().equals(myTextView.getText())) {
       return null;
     } else {
       return myTextView.getText();
     }
   }
 }
コード例 #3
0
  protected void showEditor() {
    if (myTextEditor == null) {
      myTextEditor = new TextBox();
      myTextEditor.setStylePrimaryName("field_edit");
      myTextEditor.addValueChangeHandler(
          new ValueChangeHandler<String>() {
            public void onValueChange(ValueChangeEvent<String> aEvent) {
              hideEditor(true);
            }
          });
      myTextEditor.addBlurHandler(
          new BlurHandler() {

            public void onBlur(BlurEvent aEvent) {
              hideEditor(false);
            }
          });
    }
    if (allowHtml) {
      myTextEditor.setText(myHtmlView.getHTML());
      myOuterPanel.remove(myHtmlView);
    } else {
      myTextEditor.setText(myTextView.getText());
      myOuterPanel.remove(myTextView);
    }
    myOuterPanel.add(myTextEditor);
    myTextEditor.setFocus(true);
  }
コード例 #4
0
ファイル: HTMLTest.java プロジェクト: MaxDhn/gwt-test-utils
  @Test
  public void html() {
    // Arrange
    HTML html = new HTML("this is a <b>great</b> test.<BR/>Enjoy!");

    // Act
    String result = html.getHTML();

    // Assert
    assertEquals("this is a <b>great</b> test.<br>Enjoy!", result);
  }
コード例 #5
0
 private void log(String text, String color) {
   String html = eventTextArea.getHTML();
   eventTextArea.setHTML(
       "<span style='color: "
           + color
           + "'>Event "
           + ++count
           + ": "
           + text
           + "</span>"
           + (html.length() == 0 ? "" : "<br>")
           + html);
 }
コード例 #6
0
 private String decodeUTF8(String str) {
   if (str == null) {
     return str;
   }
   while (str.indexOf("\\u") != -1) { // $NON-NLS-1$
     int index = str.indexOf("\\u"); // $NON-NLS-1$
     String hex = str.substring(index + 2, index + 6);
     str =
         str.substring(0, index)
             + "&#x"
             + hex
             + ";"
             + str.substring(index + 6); // $NON-NLS-1$ //$NON-NLS-2$
     entityDecoder.setHTML(str);
     str = entityDecoder.getHTML();
   }
   return str;
 }
コード例 #7
0
ファイル: Uploader.java プロジェクト: cyrilmhansen/gwtupload
 public static void log(String msg, Throwable e) {
   if (mlog == null) {
     if (Window.Location.getParameter("log") != null) {
       mlog = new HTML();
       RootPanel.get().add(mlog);
       log(msg, e);
     } else {
       if (logger == null) {
         logger = Logger.getLogger("Gwt client Uploader");
       }
       logger.info(msg);
       GWT.log(msg, e);
     }
   } else {
     String html = (msg + "\n" + (e != null ? e.getMessage() : "")).replaceAll("\n", "<br/>");
     mlog.setHTML(mlog.getHTML() + html);
   }
 }
コード例 #8
0
 public String getAsHtml(String name) {
   htmlName = new HTML();
   htmlName.getElement().setInnerHTML(name);
   return htmlName.getHTML();
 }
コード例 #9
0
 @Override
 public FormBuilderDTO getRepresentation() {
   FormBuilderDTO dto = super.getRepresentation();
   dto.setString("content", html.getHTML());
   return dto;
 }
コード例 #10
0
 public String getHTML() {
   return caption.getHTML();
 }
コード例 #11
0
ファイル: TabGeographic.java プロジェクト: eENVplus/EUOSME
  /**
   * constructor TabGeographic
   *
   * @return the widget composed by the Geographic Tab
   */
  public TabGeographic() {
    queryButton.setText(constants.runQuery());
    // set style
    titleLabel.removeStyleName("gwt-Label");
    // set form names
    setFormName();

    // initialize widget
    initWidget(uiBinder.createAndBindUi(this));

    // add scroll bars
    dock.getWidgetContainerElement(dock.getWidget(0)).addClassName("auto");
    dock.getWidgetContainerElement(dock.getWidget(0)).getStyle().clearOverflow();
    Element myTable = dock.getElement().getElementsByTagName("table").getItem(0);
    @SuppressWarnings("unused")
    String txt = myTable.getInnerHTML();
    myTable.getStyle().clearPosition();

    if (summaryHTML.getHTML().isEmpty()) summaryHTML.removeFromParent();

    // HTML matchFound = new HTML("<div style=\"height:300px;overflow:auto;\"><div
    // id=\"responseCount\" style=\"display:none;\"><span style=\"font-weight: bold;\">Matches
    // found:</span><span id=\"matchCount\" style=\"display:none;\"></span><div
    // id=\"matches\"></div></div>");

    // Workaround to the problem of the map position
    // Issue 366: Google Map widget does not initialize correctly inside a LayoutPanel
    if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("google")) {
      map = new com.google.gwt.maps.client.MapWidget();
      nativeMakeMap(
          map.getElement(),
          geoBoundsObj.newTextBoxNorth.getElement(),
          geoBoundsObj.newTextBoxEast.getElement(),
          geoBoundsObj.newTextBoxSouth.getElement(),
          geoBoundsObj.newTextBoxWest.getElement(),
          queryTextBox.getElement());
      mapPanel.add(map);
      // google.maps.event.trigger(map, 'resize');
      // mapPanel.add(matchFound);
      // Event.trigger(mapWidget.getMap(), "resize");
    } else if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) {
      queryPanel.removeFromParent();
      if (mapWidget == null) {
        initMapGwtOl();
        mapPanel.add(mapWidget);
        mapWidget
            .getElement()
            .getFirstChildElement()
            .getStyle()
            .setZIndex(0); // force the map to fall behind popups MG 06.05.2015
      }
    } else {
      queryPanel.removeFromParent();
      sinkEvents(Event.ONMOUSEUP);
      Element map_el = DOM.getElementById("mapstraction");
      mxnMakeMap(map_el, EUOSMEGWT.apiMapstraction);
      mapPanel.getElement().insertFirst(map_el);
    }

    preferredObj.add(country);
    country.myListBox.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            String selValue = country.myListBox.getValue(country.myListBox.getSelectedIndex());
            if (!selValue.isEmpty()) {
              // selValue contains a value like S:-21.39;W:55.84;N:51.09;E:-63.15
              String[] coordinates = selValue.split(";");
              String south = "";
              String west = "";
              String north = "";
              String east = "";
              for (int i = 0; i < coordinates.length; i++) {
                if (coordinates[i].startsWith("S:")) south = coordinates[i].substring(2);
                if (coordinates[i].startsWith("W:")) west = coordinates[i].substring(2);
                if (coordinates[i].startsWith("N:")) north = coordinates[i].substring(2);
                if (coordinates[i].startsWith("E:")) east = coordinates[i].substring(2);
              }
              if (!north.isEmpty() && !east.isEmpty() && !south.isEmpty() && !west.isEmpty()) {
                geoBoundsObj.newTextBoxSouth.setValue(south);
                geoBoundsObj.newTextBoxWest.setValue(west);
                geoBoundsObj.newTextBoxNorth.setValue(north);
                geoBoundsObj.newTextBoxEast.setValue(east);
                geoBoundsObj.newButton.click();

                // zoom to the country bound
                if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) {
                  Map map = mapWidget.getMap();
                  map.zoomToExtent(
                      new Bounds(
                          Double.parseDouble(west),
                          Double.parseDouble(south),
                          Double.parseDouble(east),
                          Double.parseDouble(north)));
                } else
                  setBoundsMapstraction(
                      Double.parseDouble(south),
                      Double.parseDouble(west),
                      Double.parseDouble(north),
                      Double.parseDouble(east));
              } else Window.alert(constants.geoCodeListError());
            }
          }
        });

    geoBoundsObj.myListBox.addBlurHandler(
        new BlurHandler() {
          @Override
          public void onBlur(BlurEvent event) {
            // refresh the map to avoid shifting cursor
            if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) {
              mapWidget.getMap().setCenter(mapWidget.getMap().getCenter());
            }
          }
        });

    geoBoundsObj.newButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            // refresh the map to avoid shifting cursor
            if (EUOSMEGWT.apiMapstraction.equalsIgnoreCase("gwt-ol")) {
              mapWidget.getMap().setCenter(mapWidget.getMap().getCenter());
            }
          }
        });
  }