Package org.apache.wicket.markup.html.basic

Examples of org.apache.wicket.markup.html.basic.MultiLineLabel


      @Override
      public void populateItem(final ListItem<Comment> listItem)
      {
        final Comment comment = listItem.getModelObject();
        listItem.add(new Label("date", new Model<Date>(comment.getDate())));
        listItem.add(new MultiLineLabel("text", comment.getText()));
      }
    });

    // we need to cancel the standard submit of the form in the onsubmit
    // handler,
View Full Code Here


  /**
   * Constructor.
   */
  public AjaxHelloBrowser()
  {
    final MultiLineLabel clientInfo = new MultiLineLabel("clientinfo", new AbstractReadOnlyModel<String>()
    {
      @Override
      public String getObject()
      {
        ClientProperties properties = getClientProperties();
        return properties.toString();
      }
    });
    clientInfo.setOutputMarkupPlaceholderTag(true);
    clientInfo.setVisible(false);

    IModel<String> clientTimeModel = new AbstractReadOnlyModel<String>()
    {
      @Override
      public String getObject()
      {
        ClientProperties properties = getClientProperties();
        TimeZone timeZone = properties.getTimeZone();
        if (timeZone != null)
        {
          Calendar cal = Calendar.getInstance(timeZone);
          Locale locale = getLocale();
          DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG, locale);
          String calAsString = dateFormat.format(cal.getTime());
          StringBuilder b = new StringBuilder("Based on your settings, your time is: ");
          b.append(calAsString);
          b.append(" (and your time zone is ");
          b.append(timeZone.getDisplayName(getLocale()));
          b.append(')');
          return b.toString();
        }
        return "Unfortunately, we were not able to figure out what your time zone is, so we have"
            + " no idea what your time is";
      }
    };
    final Label clientTime = new Label("clienttime", clientTimeModel);
    clientTime.setOutputMarkupPlaceholderTag(true);
    clientTime.setVisible(false);

    add(new AjaxClientInfoBehavior()
    {
      @Override
      protected void onClientInfo(AjaxRequestTarget target, WebClientInfo info)
      {
        super.onClientInfo(target, info);

        clientInfo.setVisible(true);
        clientTime.setVisible(true);
        target.add(clientInfo, clientTime);
      }
    });

View Full Code Here

  public ExceptionErrorPage(final Throwable throwable, final Page page)
  {
    this.throwable = throwable;

    // Add exception label
    add(new MultiLineLabel("exception", Strings.toString(throwable)));

    // Get values
    String resource = "";
    String markup = "";
    MarkupStream markupStream = null;

    if (throwable instanceof MarkupException)
    {
      markupStream = ((MarkupException)throwable).getMarkupStream();

      if (markupStream != null)
      {
        markup = markupStream.toHtmlDebugString();
        resource = markupStream.getResource().toString();
      }
    }

    // Create markup label
    final MultiLineLabel markupLabel = new MultiLineLabel("markup", markup);

    markupLabel.setEscapeModelStrings(false);

    // Add container with markup highlighted
    final WebMarkupContainer markupHighlight = new WebMarkupContainer("markupHighlight");

    markupHighlight.add(markupLabel);
View Full Code Here

   
    tester.clickLink(link.getPageRelativePath());
  }
 
  private void assertBrowserInfoVisible(final String[]... browserInfoKeys) {
    final MultiLineLabel label = WicketTesterUtils.findComponent(tester, MultiLineLabel.class, "clientProperties");
    final String content = label.getDefaultModelObjectAsString();
   
    for (final String[] keys : browserInfoKeys) {
      for (final String key : keys) {
        Assert.assertTrue("Expected key \"" + key + "\" to be visible.", content.contains(key + "="));
      }
View Full Code Here

      }
    }
  }
 
  private void assertBrowserInfoNotVisible(final String[]... browserInfoKeys) {
    final MultiLineLabel label = WicketTesterUtils.findComponent(tester, MultiLineLabel.class, "clientProperties");
    final String content = label.getDefaultModelObjectAsString();
   
    for (final String[] keys : browserInfoKeys) {
      for (final String key : keys) {
        Assert.assertTrue("Expected key \"" + key + "\" to be invisible.", !content.contains(key + "="));
      }
View Full Code Here

    final PageParameters params = new PageParameters();
    params.add(PARAM_GATHER_EXTENDED_BROWSER_INFO, Boolean.toString(!gatherExtendedBrowserInfo));
    add(new BookmarkablePageLink<Void>("toggleGatherExtendedBrowserInfo", //
        DetectClientCapabilitiesPage.class, params));
   
    add(new MultiLineLabel("clientProperties", clientInfo.getProperties().toString()));
  }
View Full Code Here

    add(new ListView("books", new BookListModel()) {
      public void populateItem(final ListItem listItem) {
        final Book book = (Book) listItem.getModelObject();
        listItem.add(new Label("listedTitle", book.getTitle()));
       
        listItem.add(new MultiLineLabel("listedAuthor", //
            book.getAuthors().size() == 0 ? "" : book.getAuthors().iterator().next()
            .getFirstName()
            + " " + book.getAuthors().iterator().next().getLastName()));
      }
    });
View Full Code Here

    TextField<String> nameTextField = new TextField<String>("name", new PropertyModel<String>(
      MailTemplate.this, "name"));
    nameTextField.setOutputMarkupId(true);
    form.add(nameTextField);

    final MultiLineLabel result = new MultiLineLabel("result", new Model<>());
    result.setOutputMarkupId(true);
    add(result);

    AjaxSubmitLink basedOnPageLink = new AjaxSubmitLink("pageBasedLink", form)
    {
      private static final long serialVersionUID = 1L;
View Full Code Here

  /**
   * Constructor.
   */
  public AjaxHelloBrowser()
  {
    final MultiLineLabel clientInfo = new MultiLineLabel("clientinfo", new AbstractReadOnlyModel<String>()
    {
      @Override
      public String getObject()
      {
        ClientProperties properties = getClientProperties();
        return properties.toString();
      }
    });
    clientInfo.setOutputMarkupPlaceholderTag(true);
    clientInfo.setVisible(false);

    IModel<String> clientTimeModel = new AbstractReadOnlyModel<String>()
    {
      @Override
      public String getObject()
      {
        ClientProperties properties = getClientProperties();
        TimeZone timeZone = properties.getTimeZone();
        if (timeZone != null)
        {
          Calendar cal = Calendar.getInstance(timeZone);
          Locale locale = getLocale();
          DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.LONG, locale);
          String calAsString = dateFormat.format(cal.getTime());
          StringBuilder b = new StringBuilder("Based on your settings, your time is: ");
          b.append(calAsString);
          b.append(" (and your time zone is ");
          b.append(timeZone.getDisplayName(getLocale()));
          b.append(')');
          return b.toString();
        }
        return "Unfortunately, we were not able to figure out what your time zone is, so we have"
            + " no idea what your time is";
      }
    };
    final Label clientTime = new Label("clienttime", clientTimeModel);
    clientTime.setOutputMarkupPlaceholderTag(true);
    clientTime.setVisible(false);

    add(new AjaxClientInfoBehavior()
    {
      @Override
      protected void onClientInfo(AjaxRequestTarget target, WebClientInfo info)
      {
        super.onClientInfo(target, info);

        clientInfo.setVisible(true);
        clientTime.setVisible(true);
        target.add(clientInfo, clientTime);
      }
    });

View Full Code Here

    {
      @Override
      public void populateItem(final ListItem<Comment> listItem)
      {
        listItem.add(new Label("date"));
        listItem.add(new MultiLineLabel("text"));
      }
    }).setVersioned(false);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.basic.MultiLineLabel

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.