コード例 #1
0
  /**
   * Sets the state icon.
   *
   * <p>The state icon indicates if a resource is exported, secure, etc.
   *
   * <p>
   *
   * @param icon the state icon
   */
  public void setStateIcon(StateIcon icon) {

    if (m_stateIcon == null) {
      m_stateIcon = new HTML();
      m_stateIcon.addClickHandler(m_iconSuperClickHandler);
      m_contentPanel.add(m_stateIcon);
    }
    String iconTitle = null;
    switch (icon) {
      case export:
        m_stateIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().export());
        iconTitle = Messages.get().key(Messages.GUI_ICON_TITLE_EXPORT_0);
        break;
      case secure:
        m_stateIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().secure());
        iconTitle = Messages.get().key(Messages.GUI_ICON_TITLE_SECURE_0);
        break;
      default:
        m_stateIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().stateIcon());
        break;
    }
    m_stateIcon.setTitle(concatIconTitles(m_iconTitle, iconTitle));
    m_stateIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  }
コード例 #2
0
  /**
   * This method is called when GWT loads the Notes application (as defined in the Notes.gwt.xml).
   */
  public void onModuleLoad() {

    final HorizontalPanel mainpanel = new HorizontalPanel();

    final HTML displayTitle = new HTML("Existing Notes");
    displayTitle.setStyleName("displayTitle");
    final HTML entryTitle = new HTML("Create A Note");
    entryTitle.setStyleName("entryTitle");

    final VerticalPanel displayPanel = new VerticalPanel();
    displayPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    displayPanel.setStyleName("displayPanel");
    displayPanel.add(displayTitle);

    final VerticalPanel entryPanel = new VerticalPanel();
    entryPanel.setVerticalAlignment(VerticalPanel.ALIGN_TOP);
    entryPanel.setStyleName("entryPanel");
    entryPanel.add(entryTitle);

    displayPanel.add(notesPanel);

    final VerticalPanel form = createForm();
    entryPanel.add(form);

    mainpanel.add(displayPanel);
    mainpanel.add(entryPanel);

    RootPanel.get("notes").add(mainpanel);

    getNotes();
  }
コード例 #3
0
ファイル: SurveyWidget.java プロジェクト: awaazde/avaajotalo
    public DetailsDialog(JSOModel details) {
      // setWidth("500px");
      // Use this opportunity to set the dialog's caption.
      setText("Awaaz.De Administration");

      // Create a VerticalPanel to contain the 'about' label and the 'OK' button.
      VerticalPanel outer = new VerticalPanel();
      outer.setWidth("100%");
      outer.setSpacing(10);

      // Create the 'about' text and set a style name so we can style it with CSS.
      String startdate = details.get("startdate");
      String completed = details.get("completed");
      String pending = details.get("pending");

      String surveyDetails = "<b>Start: </b> " + startdate + "<br><br>";
      int numrecipients = completed.split(", ").length + pending.split(", ").length;
      // For some reason, the above line creates an array of length one if
      // one of the strings is empty
      // Assumes that completed and pending cannot both be empty
      if (completed.equals("") || pending.equals("")) {
        numrecipients -= 1;
      }
      surveyDetails += "<b>Num Recipients: </b>" + String.valueOf(numrecipients);

      surveyDetails += "<br><br><b>Pending:</b>";
      HTML pendingHTML = new HTML(surveyDetails);
      pendingHTML.setStyleName("mail-AboutText");
      outer.add(pendingHTML);

      Label pendingLbl = new Label(pending, true);
      pendingLbl.setWordWrap(true);
      pendingLbl.setStyleName("dialog-NumsText");
      outer.add(pendingLbl);

      HTML compHTML = new HTML("<br><b>Completed:</b>");
      compHTML.setStyleName("mail-AboutText");
      outer.add(compHTML);

      Label completedLbl = new Label(completed, true);
      completedLbl.setWordWrap(true);
      completedLbl.setStyleName("dialog-NumsText");
      outer.add(completedLbl);

      // Create the 'OK' button, along with a handler that hides the dialog
      // when the button is clicked.
      outer.add(
          new Button(
              "Close",
              new ClickHandler() {
                public void onClick(ClickEvent event) {
                  hide();
                }
              }));

      setWidget(outer);
    }
コード例 #4
0
 public ProgressBar(String text) {
   FlowPanel pane = new FlowPanel();
   pane.getElement().getStyle().setPosition(Position.RELATIVE);
   initWidget(pane);
   progress = new HTML();
   HTML content = new HTML(text);
   content.setStyleName("progress-text");
   pane.add(progress);
   pane.add(content);
   content.setWidth("100%");
   setStyleName("progress-bar");
   progress.setStyleName("progress");
   progress.setHeight("100%");
 }
コード例 #5
0
ファイル: BlogEntry.java プロジェクト: mvieghofer/XSS
  public BlogEntry(Entry entry, Blog blog) {
    setStyleName(CssClasses.BLOG_ENTRY);

    this.blog = blog;

    HTML msg = new HTML();
    msg.setHTML(entry.getText());
    msg.setStyleName(CssClasses.BLOG_TEXT);

    Label author = new Label();
    author.setText(entry.getAuthor().getName());
    author.setStyleName(CssClasses.AUTHOR);

    Label date = new Label();
    date.setText(DateTimeFormat.getFormat("dd. MMM yyyy, HH:mm").format(entry.getDate()));
    date.setStyleName(CssClasses.DATE);

    commentContainer.setStyleName(CssClasses.BLOG_ENTRY_COMMENT_CONTAINER);

    add(msg);
    add(date);
    add(author);
    add(new Separator());
    add(new CommentForm(this));
    add(commentContainer);
  }
コード例 #6
0
  private Widget appendComment(DiscussionRecord r) {
    SmallLabel hrd =
        new SmallLabel(constants.smallCommentBy0On1Small(r.author, new Date(r.timestamp)));
    hrd.addStyleName("discussion-header");
    commentList.add(hrd);

    String[] parts = r.note.split("\n");

    if (parts.length > 0) {
      StringBuilder txtBuilder = new StringBuilder();
      for (int i = 0; i < parts.length; i++) {
        txtBuilder.append(parts[i]);
        if (i != parts.length - 1) {
          txtBuilder.append("<br/>");
        }
      }
      HTML hth = new HTML(txtBuilder.toString());
      hth.setStyleName("form-field");
      commentList.add(hth);
    } else {
      Label lbl = new Label(r.note);
      lbl.setStyleName("form-field");
      commentList.add(lbl);
    }

    commentList.add(new HTML("<br/>"));
    return hrd;
  }
コード例 #7
0
ファイル: HelpDialog.java プロジェクト: qorrect/personal
  public HelpDialog() {

    setMaximizable(true);
    setBodyBorder(false);
    // setIcon(Resources.ICONS.side_list());
    setHeading("Help");
    setWidth(750);
    setHeight(400);

    setHideOnButtonClick(true);

    setLayout(new FitLayout());
    HTML html = new HTML(htmlString);
    html.setStyleName("helpDialog");
    add(html);
    setButtons("");
    setScrollMode(Scroll.AUTO);
    Button dontShowOnStartup =
        new Button(
            "Close",
            new SelectionListener<ButtonEvent>() {

              @Override
              public void componentSelected(ButtonEvent ce) {
                hide();
              }
            });
    dontShowOnStartup.setWidth("50%");

    addButton(dontShowOnStartup);
    show();
  }
コード例 #8
0
 public void showError(String title, String message) {
   dialogBox.setText(title);
   errorLabel.setText(message);
   closeButton.setVisible(true);
   errorLabel.setStyleName("serverResponseLabelError");
   dialogBox.center();
 }
コード例 #9
0
ファイル: AboutDialog.java プロジェクト: krfox/koboform
  public AboutDialog() {
    // Use this opportunity to set the dialog's caption.
    setText(LocaleText.get("about") + " " + FormDesignerUtil.getTitle());

    // Create a VerticalPanel to contain the 'about' label and the 'OK' button.
    VerticalPanel outer = new VerticalPanel();

    // Create the 'about' text and set a style name so we can style it with CSS.

    HTML text = new HTML(LocaleText.get("aboutMessage"));
    text.setStyleName("formDesigner-AboutText");
    outer.add(text);

    // Create the 'OK' button, along with a listener that hides the dialog
    // when the button is clicked.
    Button btn =
        new Button(
            LocaleText.get("close"),
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                hide();
              }
            });

    outer.add(btn);
    outer.setCellHorizontalAlignment(btn, HasAlignment.ALIGN_CENTER);

    setWidget(outer);
  }
コード例 #10
0
  @Override
  public void setErrors(Set<ErrorDisplay> errors) {
    HashSet<ErrorDisplay> errorsToRemove = new HashSet<ErrorDisplay>(containedErrros);
    errorsToRemove.removeAll(errors);
    for (ErrorDisplay errorDisplay : errorsToRemove) {
      Widget widget = widgets.get(errorDisplay);
      errorsList.remove(widget);
      widgets.remove(widget);
    }

    HashSet<ErrorDisplay> errorsToAdd = new HashSet<ErrorView.ErrorDisplay>(errors);
    errorsToAdd.removeAll(containedErrros);
    String errorViewItemClass = ApplicationResources.INSTANCE.css().errorViewItemClass();
    String errorViewImageClass = ApplicationResources.INSTANCE.css().errorViewImageClass();
    for (ErrorDisplay errorDisplay : errorsToAdd) {
      SafeHtml html =
          template.errorDisplayTemplate(
              errorImageSafeUri, errorDisplay.getErrorInfo(), errorViewImageClass);
      HTML widget = new HTML(html);
      widget.setStyleName(errorViewItemClass);
      widgets.put(errorDisplay, widget);
      errorsList.add(widget);
    }
    containedErrros = new HashSet<ErrorView.ErrorDisplay>(errors);
    int height = 0;
    for (int i = 0; i < errorsList.getWidgetCount(); ++i) {
      Widget widget = errorsList.getWidget(i);
      widget.getElement().getStyle().setTop(height, Unit.PX);
      height += widget.getOffsetHeight() + 5;
    }
  }
コード例 #11
0
ファイル: FormStyleLayout.java プロジェクト: qarkly/drools
 protected void addHeader(String image, String title, Widget titleIcon) {
   HTML name = new HTML("<div class='x-form-field'><b>" + title + "</b></div>");
   name.setStyleName("resource-name-Label");
   HorizontalPanel horiz = new HorizontalPanel();
   horiz.add(name);
   horiz.add(titleIcon);
   doHeader(image, horiz);
 }
コード例 #12
0
 private String getHeaderString(String text, ImageResource imageResource) {
   HorizontalPanel hPanel = new HorizontalPanel();
   hPanel.setSpacing(0);
   hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
   hPanel.add(new Image(imageResource));
   HTML headerText = new HTML(text);
   headerText.setStyleName("cw-StackPanelHeader");
   hPanel.add(headerText);
   return hPanel.getElement().getString();
 }
コード例 #13
0
 private HTML getHTML(String html, String styleName) {
   html =
       html.replaceAll("</p>", " ")
           .replaceAll("<p>", "")
           .replaceAll("<br data-mce-bogus=\"1\">", "")
           .replaceAll("<br>", "")
           .replaceAll("</br>", "");
   HTML contentHtml = new HTML(html);
   contentHtml.setStyleName(styleName);
   return contentHtml;
 }
コード例 #14
0
  /**
   * Constructor.
   *
   * <p>
   *
   * @param editWidget the edit widget to wrap
   */
  public FormWidgetWrapper(I_EditWidget editWidget) {

    m_mainPanel = new FlowPanel();
    m_label = new HTML();
    m_label.setStyleName(I_LayoutBundle.INSTANCE.form().label());
    m_mainPanel.add(m_label);
    m_editWidget = editWidget;
    m_mainPanel.add(m_editWidget);
    m_editWidget.asWidget().addStyleName(I_LayoutBundle.INSTANCE.form().widget());
    initWidget(m_mainPanel);
  }
コード例 #15
0
 private String getHTML(String html) {
   html =
       html.replaceAll("</p>", " ")
           .replaceAll("<p>", "")
           .replaceAll("<br data-mce-bogus=\"1\">", "")
           .replaceAll("<br>", "")
           .replaceAll("</br>", "");
   HTML contentHtml = new HTML(html);
   contentHtml.setStyleName(PlayerBundle.INSTANCE.getPlayerStyle().setEllipses());
   return html;
 }
コード例 #16
0
 public void showInfo(String title, String message) {
   dialogBox.setText(title);
   errorLabel.setText(message);
   errorLabel.setStyleName("infoText");
   closeButton.setVisible(false);
   dialogBox.center();
   new Timer() {
     public void run() {
       dialogBox.hide();
     }
   }.schedule(2000);
 }
コード例 #17
0
 private Widget createHeaderWidget(String text, ImageResource image) {
   // Add the image and text to a horizontal panel
   HorizontalPanel hPanel = new HorizontalPanel();
   hPanel.setHeight("100%");
   hPanel.setSpacing(0);
   hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
   hPanel.add(new Image(image));
   HTML headerText = new HTML(text);
   headerText.setStyleName("cw-StackPanelHeader");
   hPanel.add(headerText);
   return new SimplePanel(hPanel);
 }
コード例 #18
0
  /**
   * Sets the lock icon.
   *
   * <p>
   *
   * @param icon the icon to use
   * @param iconTitle the icon title
   */
  public void setLockIcon(LockIcon icon, String iconTitle) {

    if (m_lockIcon == null) {
      m_lockIcon = new HTML();
      m_lockIcon.addClickHandler(m_iconSuperClickHandler);
      m_contentPanel.add(m_lockIcon);
    }
    switch (icon) {
      case CLOSED:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockClosed());
        break;
      case OPEN:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockOpen());
        break;
      case SHARED_CLOSED:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockSharedClosed());
        break;
      case SHARED_OPEN:
        m_lockIcon.setStyleName(
            I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon()
                + " "
                + I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockSharedOpen());
        break;
      case NONE:
      default:
        m_lockIcon.setStyleName(I_CmsLayoutBundle.INSTANCE.listItemWidgetCss().lockIcon());
    }

    m_lockIcon.setTitle(concatIconTitles(m_iconTitle, iconTitle));
    m_lockIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
  }
コード例 #19
0
  public void showHTMLCode(String codeSource) {
    final DialogBox codePopup = new DialogBox(true, true);
    codePopup.setGlassEnabled(true);
    codePopup.setText(constants.showCodeTitle());

    String[] lignesCode = codeSource.split("\n");

    VerticalPanel tab = new VerticalPanel();

    for (String ligneCode : lignesCode) {
      String maLigne = new String(ligneCode);

      String[] ligne = ligneCode.split("\t");
      for (String texte : ligne) {
        if (texte.equals("")) {
          maLigne = "&nbsp;&nbsp;&nbsp;&nbsp;" + maLigne;
        }
      }
      maLigne = maLigne.replace("<", "&lt;");
      maLigne = maLigne.replace("div", "<span style='color: blue;'>div</span>");
      maLigne = maLigne.replace("id=", "<span style='color: red;'>id</span>=");
      maLigne = maLigne.replace("class", "<span style='color: red;'>class</span>");

      int commentBegin = maLigne.indexOf("&lt;!--");

      if (commentBegin != -1) {
        int commentEnd = maLigne.indexOf("-->");
        String comment = maLigne.substring(commentBegin, commentEnd + 3);
        maLigne = maLigne.replace(comment, "<span style='color: #008000;'>" + comment + "</span>");
      }

      HTML htmlLine = new HTML(maLigne);
      htmlLine.setStyleName("builder-source");
      tab.add(htmlLine);
    }

    Button closeButton =
        new Button(
            constants.close(),
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                codePopup.hide();
              }
            });

    tab.add(closeButton);
    tab.setCellHorizontalAlignment(closeButton, HasHorizontalAlignment.ALIGN_CENTER);

    codePopup.add(tab);
    codePopup.center();
    codePopup.show();
  }
コード例 #20
0
  /**
   * The constructor sets up the UI and passes the data fetching parameters to the sub widgets
   *
   * @param service
   * @param documentID
   * @param instructor
   * @param unsavedDocumentStrategy
   */
  public InstructorPreferencesView(
      CachedOpenWorkingCopyDocument openDocument, InstructorGWT instructor) {
    this.openDocument = openDocument;

    instructor.verify();

    this.instructor = instructor;

    HTML instructorName = new HTML("Instructor Time Preferences");
    instructorName.setStyleName("bigBold");
    DOM.setElementAttribute(instructorName.getElement(), "id", "instructorName");
    InstructorPreferencesView.this.add(instructorName);

    InstructorPreferencesView.this.timePrefs =
        new TimePrefsWidget(
            InstructorPreferencesView.this.openDocument, InstructorPreferencesView.this.instructor);

    InstructorPreferencesView.this.setSpacing(20);

    InstructorPreferencesView.this.add(timePrefs);
    InstructorPreferencesView.this.setStyleName("preferencesPanel");

    InstructorPreferencesView.this.coursePrefs =
        new CoursePrefsWidget(
            InstructorPreferencesView.this.openDocument, InstructorPreferencesView.this.instructor);
    InstructorPreferencesView.this.coursePrefs.setStyleName("otherCenterness");
    InstructorPreferencesView.this.coursePrefs.afterPush();

    HTML cprefs = new HTML("Instructor Course Preferences");
    cprefs.addStyleName("bigBold");
    InstructorPreferencesView.this.add(cprefs);

    InstructorPreferencesView.this.add(coursePrefs);

    closebutton =
        new Button(
            "Close",
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                parent.hide();
              }
            });

    if (additionalCloseHandler != null) {
      closebutton.addClickHandler(additionalCloseHandler);
      additionalCloseHandler = null;
    }
    DOM.setElementAttribute(closebutton.getElement(), "id", "s_prefCloseBtn");
    InstructorPreferencesView.this.add(closebutton);
    InstructorPreferencesView.this.setCellHorizontalAlignment(closebutton, ALIGN_RIGHT);
  }
コード例 #21
0
  /**
   * Get a string representation of the header that includes an image and some text.
   *
   * @param text the header text
   * @param image the {@link ImageResource} to add next to the header
   * @return the header as a string
   */
  @ShowcaseSource
  private String getHeaderString(String text, ImageResource image) {
    // Add the image and text to a horizontal panel
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(0);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.add(new Image(image));
    HTML headerText = new HTML(text);
    headerText.setStyleName("cw-StackPanelHeader");
    hPanel.add(headerText);

    // Return the HTML string for the panel
    return hPanel.getElement().getString();
  }
コード例 #22
0
    @Override
    public Object getProperty(Object object, String propertyName) {
      Bloc value = (Bloc) object;
      if ("draganddrop".equals(propertyName)) {
        HTML html = new HTML("&nbsp;&nbsp;");
        html.setStyleName("DragRowHandle");
        if (controller != null) {
          BlocClipboard clipboard = new BlocClipboard(value);
          controller.registerDrag(html, mapper.map(value), clipboard, GROUPNAME);
          controller.registerDrop(html, clipboard, GROUPNAME);
        }
        html.setVisible(!isReadOnly());
        return html;
      } else if ("content".equals(propertyName)) {
        Component component = newComponent();
        component.setValue(value);
        ItemWidget itemWidget = new ItemWidget(component, mapper);
        items.add(itemWidget);
        return itemWidget;
      } else if (("action").equals(propertyName)) {
        ActionsPanel actionsPanel = new ActionsPanel();
        actionsPanel
            .getDelete()
            .addClickHandler(
                new ClickHandler() {

                  @Override
                  public void onClick(ClickEvent event) {
                    if (!isReadOnly()) {
                      if (Window.confirm("Supprimer ce " + contentColumnName + " ?")) {
                        Cell cell = view.getGrid().getCellForEvent(event);
                        Widget w = view.getGrid().getWidget(cell.getRowIndex(), 1);
                        if (w instanceof ItemWidget) {
                          ItemWidget itemWidget = (ItemWidget) w;
                          removeItem(itemWidget.getValue());
                          items.remove(itemWidget);
                        }
                        refreshWidget();
                        ValueChangeEvent.fire(ExtendedAbstractComponent.this, getValue());
                      }
                    }
                  }
                });
        actionsPanel.setVisible(!isReadOnly());
        return actionsPanel;
      }
      return "";
    }
コード例 #23
0
ファイル: TitleBarWidget.java プロジェクト: feaf/sandbox
 public void init() {
   super.init();
   searchWidget = new SearchWidget(watch);
   searchWidget.init();
   refreshImage = new Image(watch.getSkinFile(Constants.IMAGE_REFRESH));
   refreshImage.setStyleName(watch.getStyleName("titlebar", "refresh"));
   refreshImage.setTitle(watch.getTranslation("refresh"));
   refreshImage.addClickListener(
       new ClickListener() {
         public void onClick(Widget widget) {
           watch.refreshArticleList();
         }
       });
   title.setStyleName(watch.getStyleName("titlebar", "title"));
   panel.add(title);
   panel.add(refreshImage);
   panel.add(searchWidget);
   refreshData();
 }
コード例 #24
0
  public TitlePanel() {
    text = new HTML(hardCodedText);
    text.setStyleName("title-text");

    // initialize the DockPanel
    dockPanel = new DockPanel();
    // horizontalPanel = new HorizontalPanel();
    if (dockPanel != null) {
      // indentation/border between text and frame
      dockPanel.setSpacing(3);

      dockPanel.add(text, DockPanel.CENTER);
      dockPanel.setCellHorizontalAlignment(text, DockPanel.ALIGN_CENTER);
      dockPanel.setCellVerticalAlignment(text, DockPanel.ALIGN_MIDDLE);
      dockPanel.setWidth("100%");
      dockPanel.setCellWidth(text, "100%");

      dockPanel.setStyleName("title-panel");
    } else {
      System.out.println("Unable to create dockPanel panels");
      throw new NullPointerException("Unable to initialize the dockPanel panel");
    }
  }
コード例 #25
0
  public static Handler addHighlighting(
      @NotNull final TextBox textBox, final Highlighter... highlighters) {
    textBox.setStyleName("exprEditorInput");

    Panel p = (Panel) textBox.getParent();

    HTML html = new HTML();
    html.setStyleName("exprEditorDiv");
    p.add(html);

    Handler handler = new Handler(html, highlighters);
    handler.setup(textBox);

    html.addMouseUpHandler(
        new MouseUpHandler() {
          @Override
          public void onMouseUp(MouseUpEvent event) {
            textBox.setFocus(true);
          }
        });

    return handler;
  }
コード例 #26
0
ファイル: Perspective.java プロジェクト: mdpiper/wmt-client
    /** Makes the Header (North) view of the WMT GUI. */
    public ViewNorth() {

      this.setStyleName("wmt-NavBar");
      this.setVerticalAlignment(ALIGN_MIDDLE);

      HTML title = new HTML(Constants.TITLE_TOP_PANEL);
      title.setStyleName("wmt-NavBarTitle");

      userPanel = new UserPanel();

      this.add(title);
      this.add(userPanel);

      // Handle sign out event.
      userPanel
          .getSignOutButton()
          .addClickHandler(
              new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                  data.security.getAuthenticationHandler().signOut();
                }
              });
    }
コード例 #27
0
ファイル: Status.java プロジェクト: HackLinux/openkm
  /** Status */
  public Status() {
    super(false, true);
    hPanel = new HorizontalPanel();
    image = new Image(OKMBundleResources.INSTANCE.indicator());
    msg = new HTML("");
    space = new HTML("");

    hPanel.add(image);
    hPanel.add(msg);
    hPanel.add(space);

    hPanel.setCellVerticalAlignment(image, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellVerticalAlignment(msg, HasAlignment.ALIGN_MIDDLE);
    hPanel.setCellHorizontalAlignment(image, HasAlignment.ALIGN_CENTER);
    hPanel.setCellWidth(image, "30px");
    hPanel.setCellWidth(space, "7px");

    hPanel.setHeight("25px");

    msg.setStyleName("okm-NoWrap");

    super.hide();
    setWidget(hPanel);
  }
コード例 #28
0
 public CommitMessageBlock() {
   description = new HTML();
   description.setStyleName(Gerrit.RESOURCES.css().changeScreenDescription());
   initWidget(description);
 }
コード例 #29
0
    private ComponentHelpPopup(final SimpleComponentDescriptor scd, final Widget sender) {
      // Create popup panel.
      super(true);
      setStyleName("ode-ComponentHelpPopup");
      setTitle(scd.getName());

      // Create title from component name.
      Label titleBar = new Label(TranslationDesignerPallete.getCorrespondingString(scd.getName()));
      setTitle(scd.getName());
      titleBar.setStyleName("ode-ComponentHelpPopup-TitleBar");

      // Create content from help string.
      HTML helpText =
          new HTML(
              TranslationDesignerPallete.getCorrespondingString(scd.getName() + "-helpString"));
      helpText.setStyleName("ode-ComponentHelpPopup-Body");

      // Create link to more information.  This would be cleaner if
      // GWT supported String.format.
      HTML link;
      String categoryDocUrlString = scd.getCategoryDocUrlString();
      if (categoryDocUrlString == null) {
        link =
            new HTML(
                "<a href=\""
                    + Ode.APP_INVENTOR_DOCS_URL
                    + "/reference/components/index.html\" target=_blank>"
                    + MESSAGES.moreInformation()
                    + "</a>");
      } else {
        link =
            new HTML(
                "<a href=\""
                    + Ode.APP_INVENTOR_DOCS_URL
                    + "/reference/components/"
                    + categoryDocUrlString
                    + ".html#"
                    + scd.getName()
                    + "\" target=_blank>"
                    + MESSAGES.moreInformation()
                    + "</a>");
      }
      link.setStyleName("ode-ComponentHelpPopup-Link");

      // Create panel to hold the above three widgets and act as the
      // popup's widget.
      VerticalPanel inner = new VerticalPanel();
      inner.add(titleBar);
      inner.add(helpText);
      inner.add(link);
      setWidget(inner);

      // When the panel is closed, save the time in milliseconds.
      // This will help us avoid immediately reopening it if the user
      // closed it by clicking on the question-mark icon.
      addPopupListener(
          new PopupListener() {
            @Override
            public void onPopupClosed(PopupPanel sender, boolean autoClosed) {
              lastClosureTime = System.currentTimeMillis();
            }
          });

      // Use a Pinch Zoom aware PopupPanel.PositionCallback to handle positioning to
      // avoid the Google Chrome Pinch Zoom bug.
      setPopupPositionAndShow(
          new PZAwarePositionCallback(sender.getElement()) {
            @Override
            public void setPosition(int offsetWidth, int offsetHeight) {
              // Position the upper-left of the panel just to the right of the
              // question-mark icon, unless that would make it too low.
              final int X_OFFSET = 20;
              final int Y_OFFSET = -5;
              if (Window.Navigator.getUserAgent().contains("Chrome") && isPinchZoomed()) {
                setPopupPosition(
                    getTrueAbsoluteLeft() + 1 + X_OFFSET,
                    Math.min(
                        getTrueAbsoluteTop() + 1 + Y_OFFSET,
                        Math.max(0, Window.getClientHeight() - offsetHeight + Y_OFFSET)));
              } else {
                setPopupPosition(
                    sender.getAbsoluteLeft() + X_OFFSET,
                    Math.min(
                        sender.getAbsoluteTop() + Y_OFFSET,
                        Math.max(0, Window.getClientHeight() - offsetHeight + Y_OFFSET)));
              }
            }
          });
    }
コード例 #30
0
ファイル: DeploymentStep1.java プロジェクト: jsight/core-1
  public Widget asWidget() {

    final TabPanel tabs = new TabPanel();
    tabs.setStyleName("default-tabpanel");

    // -------

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("window-content");

    // Create a FormPanel and point it at a service.
    final FormPanel form = new FormPanel();
    String url = Console.getBootstrapContext().getProperty(BootstrapContext.DEPLOYMENT_API);
    form.setAction(url);

    form.setEncoding(FormPanel.ENCODING_MULTIPART);
    form.setMethod(FormPanel.METHOD_POST);

    // Create a panel to hold all of the form widgets.
    VerticalPanel panel = new VerticalPanel();
    panel.getElement().setAttribute("style", "width:100%");
    form.setWidget(panel);

    // Create a FileUpload widgets.
    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);
            }

            // Option 2: Unmanaged content

          }
        });

    String stepText =
        "<h3>"
            + Console.CONSTANTS.common_label_step()
            + "1/2: "
            + Console.CONSTANTS.common_label_deploymentSelection()
            + "</h3>";
    layout.add(new HTML(stepText));
    HTML description = new HTML();
    description.setHTML(Console.CONSTANTS.common_label_chooseFile());
    description.getElement().setAttribute("style", "padding-bottom:15px;");
    layout.add(description);
    layout.add(form);
    tabs.add(layout, "Managed");

    // Unmanaged form only for new deployments
    if (!wizard.isUpdate()) {
      VerticalPanel unmanagedPanel = new VerticalPanel();
      unmanagedPanel.setStyleName("window-content");

      String unmanagedText =
          "<h3>" + Console.CONSTANTS.common_label_step() + "1/1: Specify Deployment</h3>";
      unmanagedPanel.add(new HTML(unmanagedText));

      unmanagedForm = new Form<DeploymentRecord>(DeploymentRecord.class);
      TextAreaItem path = new TextAreaItem("path", "Path");
      TextBoxItem relativeTo = new TextBoxItem("relativeTo", "Relative To", false);

      TextBoxItem name = new TextBoxItem("name", "Name");
      TextBoxItem runtimeName = new TextBoxItem("runtimeName", "Runtime Name");
      CheckBoxItem archive = new CheckBoxItem("archive", "Is Archive?");
      archive.setValue(true);
      unmanagedForm.setFields(path, relativeTo, archive, name, runtimeName);
      unmanagedPanel.add(unmanagedForm.asWidget());
      tabs.add(unmanagedPanel, "Unmanaged");
    }

    tabs.selectTab(0);
    return new WindowContentBuilder(tabs, options).build();
  }