예제 #1
0
 /** {@inheritDoc} */
 @Override
 public void getAdditionalProposalInfo(AsyncCallback<Widget> callback) {
   Frame frame = new Frame();
   frame.setSize("100%", "100%");
   frame.getElement().getStyle().setBorderStyle(Style.BorderStyle.NONE);
   frame.getElement().setAttribute("sandbox", ""); // empty value, not null
   frame.getElement().getStyle().setProperty("resize", "both");
   frame.setUrl(client.getProposalDocUrl(id, sessionId));
   callback.onSuccess(frame);
 }
예제 #2
0
  @Inject
  public DownloadContainer() {
    frame = new Frame();
    frame.getElement().setAttribute("name", TARGET);
    frame.setSize("0px", "0px");
    frame.setVisible(false);
    frame.ensureDebugId(TARGET);

    RootLayoutPanel.get().add(frame);
  }
예제 #3
0
 /**
  * Sets a url for the content area of the item.
  *
  * @param url the url
  * @return the frame widget
  */
 public Frame setUrl(String url) {
   Frame f = new Frame(url);
   f.getElement().setPropertyInt("frameBorder", 0);
   f.setSize("100%", "100%");
   setLayout(new FlowLayout());
   removeAll();
   add(f);
   layout();
   return f;
 }
예제 #4
0
  private void initButtons() {
    Button buttonBold = new Button("Bold");
    buttonBold.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            SelectedText selectedText = rawEditor.getSelectedTextObj();
            selectedText.text = "[b]" + selectedText.text + "[/b]";
            rawEditor.setSelectedText(selectedText);
          }
        });
    buttonPanel.add(buttonBold);

    Button buttonItalic = new Button("Italic");
    buttonItalic.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            SelectedText selectedText = rawEditor.getSelectedTextObj();
            selectedText.text = "[i]" + selectedText.text + "[/i]";
            rawEditor.setSelectedText(selectedText);
          }
        });
    buttonPanel.add(buttonItalic);

    Button buttonImg = new Button("Bild");
    buttonImg.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            ImagePickerPopup imagePicker = new ImagePickerPopup(800, 800, false);
            imagePicker.center();
            imagePicker.show();
            imagePicker.addSaveHandler(
                new ImagePickerPopup.SaveHandler() {

                  public void saved(String value) {
                    SelectedText selectedText = rawEditor.getSelectedTextObj();
                    selectedText.text = "[img]" + value + "[/img]";
                    rawEditor.setSelectedText(selectedText);
                  }
                });
          }
        });
    buttonPanel.add(buttonImg);

    Button buttonLink = new Button("Link");
    buttonLink.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            BBUrlPanel panel = new BBUrlPanel(rawEditor);
            panel.show();
          }
        });
    buttonPanel.add(buttonLink);

    Button buttonYoutube = new Button("Youtube");
    buttonYoutube.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            BBYoutubePanel youtubePanel = new BBYoutubePanel(rawEditor);
            youtubePanel.show();
          }
        });
    buttonPanel.add(buttonYoutube);

    for (BBCodeEditorPlugin plugin : pluggedInButtons) {
      plugin.setTextArea(rawEditor);
      buttonPanel.add(plugin.getButton());
    }

    errorMessage.setStyleName("validationError");
    errorMessage.setVisible(false);
    rawPanel.add(errorMessage);
    rawPanel.add(buttonPanel);
    rawPanel.add(rawEditor);

    preview.setSize("960px", "700px");
    rawEditor.setSize("960px", "700px");
    tabPanel.setSize("960px", "700px");

    tabPanel.add(rawPanel, "RAW");
    tabPanel.add(preview, "Preview");
    tabPanel.selectTab(0);

    tabPanel.addBeforeSelectionHandler(
        new BeforeSelectionHandler<Integer>() {
          @Override
          public void onBeforeSelection(BeforeSelectionEvent<Integer> event) {

            bbCodeService.generateBBCodePreview(
                rawEditor.getText(),
                new AsyncCallback<String>() {
                  @Override
                  public void onSuccess(String key) {
                    preview.setUrl("/burrito/bbCodePreview?key=" + key);
                  }

                  @Override
                  public void onFailure(Throwable caught) {
                    Window.alert("Could not create preview! " + caught.getMessage());
                  }
                });
          }
        });

    add(tabPanel);
  }