Package org.apache.wicket.markup.html.link

Examples of org.apache.wicket.markup.html.link.Link$AnchorChange


*
*/
public class WorkflowInstanceViewerPage extends WebPage {
 
  public WorkflowInstanceViewerPage(PageParameters params){
    add(new Link("home_link"){
      /* (non-Javadoc)
      * @see org.apache.wicket.markup.html.link.Link#onClick()
      */
     @Override
     public void onClick() {
View Full Code Here


    // first create a simple value holder object
    final ClickCount count1 = new ClickCount();

    // add a link which, when clicked, increases our counter
    // when a link is clicked, its onClick method is called
    Link link1 = new Link("link1")
    {
      @Override
      public void onClick()
      {
        count1.clicks++;
      }
    };
    add(link1);
    // add a counter label to the link so that we can display it in the body
    // of the link
    link1.add(new Label("label1", new Model<String>()
    {
      @Override
      public String getObject()
      {
        return Integer.toString(count1.clicks);
      }
    }));

    final ClickCount count2 = new ClickCount();
    // Same idea as above, but now we record a state change. Note that the
    // URL will change because of this, and pressing the back button and
    // clicking the link again would revert to the older value.
    // The same thing could have been achieved by using setModelObject,
    // which implicitly registers a state change (of type
    // ComponentModelChange).
    Link linkWithStateChange = new Link("linkWithStateChange")
    {
      @Override
      public void onClick()
      {
        final int count = count1.clicks;
        count2.clicks++;
        addStateChange(new Change()
        {
          @Override
          public void undo()
          {
            // revert
            count2.clicks = count;
          }
        });
      }
    };
    add(linkWithStateChange);
    linkWithStateChange.add(new Label("label", new PropertyModel<Integer>(count2, "clicks")));

    // we can attach Link components to any HTML tag we want. If it is an
    // anchor (<a href...),
    // the url to this component is put in the href attribute. For other
    // components, a
View Full Code Here

   */
  public MarkupContainer newLink(String id, final ILinkCallback callback)
  {
    if (getLinkType() == LinkType.REGULAR)
    {
      return new Link(id)
      {
        private static final long serialVersionUID = 1L;

        /**
         * @see org.apache.wicket.markup.html.link.Link#onClick()
View Full Code Here

  {
    // Get the index of page this link shall point to
    final int pageIndex = getStartIndex() + loopItem.getIteration();

    // Add a page link pointing to the page
    final Link link = newPagingNavigationLink("pageLink", pageable, pageIndex);
    loopItem.add(link);

    // Add a page number label to the list which is enclosed by the link
    String label = "";
    if (labelProvider != null)
    {
      label = labelProvider.getPageLabel(pageIndex);
    }
    else
    {
      label = String.valueOf(pageIndex + 1);
    }
    link.add(new Label("pageNumber", label));
  }
View Full Code Here

      @Override
      public void onClick(AjaxRequestTarget target)
      {
        // Replace the link with a normal Link
        Link link = new Link(MockPageWithLink.LINK_ID)
        {
          private static final long serialVersionUID = 1L;

          @Override
          public void onClick()
          {
            // Do nothing
          }
        };
        link.setOutputMarkupId(true);

        page.replace(link);

        target.addComponent(link);
      }
View Full Code Here

   *            {@link #setSelectedTab(int)}.
   * @return created link component
   */
  protected WebMarkupContainer newLink(String linkId, final int index)
  {
    return new Link(linkId)
    {
      private static final long serialVersionUID = 1L;

      @Override
      public void onClick()
View Full Code Here

   * Construct.
   */
  public Home()
  {

    add(new Link("link")
    {
      private static final long serialVersionUID = 1L;
      int i = 0;

      @Override
View Full Code Here

     *            model for contact
     */
    public ActionPanel(String id, IModel<Contact> model)
    {
      super(id, model);
      add(new Link("select")
      {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick()
View Full Code Here

     */
    public InputForm(String name)
    {
      super(name, new CompoundPropertyModel<FormInputModel>(new FormInputModel()));
      add(new LocaleDropDownChoice("localeSelect"));
      add(new Link("defaultLocaleLink")
      {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick()
        {
          WebRequest request = (WebRequest)getRequest();
          setLocale(request.getLocale());
        }
      });
      TextField<String> stringTextField = new TextField<String>("stringProperty");
      stringTextField.setLabel(new Model<String>("String"));
      add(stringTextField);
      TextField<Integer> integerTextField = new TextField<Integer>("integerProperty",
        Integer.class);
      add(integerTextField.add(NumberValidator.POSITIVE));
      add(new TextField<Double>("doubleProperty", Double.class));
      WebMarkupContainer dateLabel = new WebMarkupContainer("dateLabel");
      add(dateLabel);
      TextField<Date> datePropertyTextField = new TextField<Date>("dateProperty", Date.class);
      add(datePropertyTextField);
      add(new TextField<Integer>("integerInRangeProperty", Integer.class).add(NumberValidator.range(
        0, 100)));
      add(new CheckBox("booleanProperty"));
      RadioChoice<String> rc = new RadioChoice<String>("numberRadioChoice", NUMBERS).setSuffix("");
      rc.setLabel(new Model<String>("number"));
      add(rc);

      RadioGroup<String> group = new RadioGroup<String>("numbersGroup");
      add(group);
      ListView<String> numbers = new ListView<String>("numbers", NUMBERS)
      {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item)
        {
          item.add(new Radio<String>("radio", item.getModel()));
          item.add(new Label("number", item.getDefaultModelObjectAsString()));
        };
      };
      group.add(numbers);

      CheckGroup<String> checks = new CheckGroup<String>("numbersCheckGroup");
      add(checks);
      ListView<String> checksList = new ListView<String>("numbers", NUMBERS)
      {
        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<String> item)
        {
          item.add(new Check<String>("check", item.getModel()));
          item.add(new Label("number", item.getDefaultModelObjectAsString()));
        };
      };
      checks.add(checksList);

      add(new ListMultipleChoice<String>("siteSelection", SITES));

      add(new TextField<URL>("urlProperty", URL.class)
      {
        private static final long serialVersionUID = 1L;

        @Override
        public <X> IConverter<X> getConverter(Class<X> clazz)
        {
          return (IConverter<X>)new IConverter<URL>()
          {
            private static final long serialVersionUID = 1L;

            /**
             * @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String,
             *      java.util.Locale)
             */
            public URL convertToObject(String value, Locale locale)
            {
              try
              {
                return new URL(value.toString());
              }
              catch (MalformedURLException e)
              {
                throw new ConversionException("'" + value + "' is not a valid URL");
              }
            }

            /**
             * @see org.apache.wicket.util.convert.IConverter#convertToString(java.lang.Object,
             *      java.util.Locale)
             */
            public String convertToString(URL value, Locale locale)
            {
              return value != null ? value.toString() : null;
            }
          };
        }
      });

      add(new TextField<UsPhoneNumber>("phoneNumberUS", UsPhoneNumber.class)
      {
        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override
        public <X> IConverter<X> getConverter(Class<X> clazz)
        {
          return (IConverter<X>)new MaskConverter<UsPhoneNumber>("(###) ###-####",
            UsPhoneNumber.class);
        }
      });

      add(new LinesListView("lines"));

      add(new ImageButton("saveButton"));

      add(new Link("resetButtonLink")
      {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick()
View Full Code Here

   * @param item
   * @return The link component
   */
  public final Link removeLink(final String id, final ListItem<T> item)
  {
    return new Link(id)
    {
      private static final long serialVersionUID = 1L;

      /**
       * @see org.apache.wicket.markup.html.link.Link#onClick()
View Full Code Here

TOP

Related Classes of org.apache.wicket.markup.html.link.Link$AnchorChange

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.