Package org.apache.wicket.util.value

Examples of org.apache.wicket.util.value.ValueMap


  private static final long serialVersionUID = 1L;

  public Wicket2105Panel(String id)
  {
    super(id);
    Form form = new Form("signInForm", new CompoundPropertyModel(new ValueMap()));
    form.add(new TextField("username"));
    form.add(new PasswordTextField("password"));
    form.add(new DropDownChoice("domain", Arrays.asList(new Object[] { "Wicket", "Tapestry",
        "JSF", ".Net" })));
    form.add(new CheckBox("rememberMe"));
View Full Code Here


    // Render the component without having rendered the page previously
    SimplePage page = new SimplePage();

    Label label = (Label)page.get("myLabel");
    assertNotNull(label);
    ValueMap attr = label.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("myLabel", attr.getString("wicket:id"));

    Panel panel = (Panel)page.get("myPanel");
    assertNotNull(panel);
    attr = panel.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("myPanel", attr.getString("wicket:id"));

    label = (Label)page.get("myPanel:label");
    assertNotNull(label);
    attr = label.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("label", attr.getString("wicket:id"));

    Border border = (Border)page.get("myBorder");
    assertNotNull(border);
    attr = border.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("myBorder", attr.getString("wicket:id"));

    border = (Border)page.get("myBorder2");
    assertNotNull(border);
    attr = border.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("myBorder2", attr.getString("wicket:id"));

    // do the same test twice. Igor reported a problem with that, so we have to test it.
    border = (Border)page.get("myBorder2");
    assertNotNull(border);
    attr = border.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("myBorder2", attr.getString("wicket:id"));

    WebMarkupContainer container = (WebMarkupContainer)page.get("test");
    assertNotNull(container);
    attr = container.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("test", attr.getString("wicket:id"));

    label = (Label)page.get("test:myLabel2");
    assertNotNull(label);
    attr = label.getMarkupAttributes();
    assertNotNull(attr);
    assertEquals("myLabel2", attr.getString("wicket:id"));
  }
View Full Code Here

   * @return markup attributes
   */
  public final ValueMap getMarkupAttributes()
  {
    MarkupStream markupStream = locateMarkupStream();
    ValueMap attrs = new ValueMap(markupStream.getTag().getAttributes());
    attrs.makeImmutable();
    return attrs;
  }
View Full Code Here

      Time time = resourceReference.lastModifiedTime();
      if (time != null)
      {
        if (parameters == null)
        {
          parameters = new ValueMap();
          parameters.put("wicket:lm", new Long(time.getMilliseconds()));
        }
      }
    }
View Full Code Here

    {
      props = new Properties(key, ValueMap.EMPTY_MAP);
    }
    else
    {
      ValueMap strings = null;

      try
      {
        try
        {
          // Get the InputStream
          BufferedInputStream in = new BufferedInputStream(
            resourceStream.getInputStream());

          // Determine if resource is a XML File
          boolean loadAsXml = false;
          if (resourceStream instanceof IFixedLocationResourceStream)
          {
            String location = ((IFixedLocationResourceStream)resourceStream).locationAsString();
            if (location != null)
            {
              String ext = Strings.lastPathComponent(location, '.').toLowerCase();
              if ("xml".equals(ext))
              {
                loadAsXml = true;
              }
            }
          }

          // Load the properties
          java.util.Properties properties = new java.util.Properties();
          if (loadAsXml)
          {
            Streams.loadFromXml(properties, in);
          }
          else
          {
            properties.load(in);
          }

          // Copy the properties into the ValueMap
          strings = new ValueMap();
          Enumeration enumeration = properties.propertyNames();
          while (enumeration.hasMoreElements())
          {
            String property = (String)enumeration.nextElement();
            strings.put(property, properties.getProperty(property));
          }
        }
        finally
        {
          resourceStream.close();
View Full Code Here

    }

    @Override
    public IResourceStream getResourceStream() {

        ValueMap parameters = getParameters();
        int width = parameters.getInt("WIDTH", 400);
        int height = parameters.getInt("HEIGHT", 200);
        String bboxStr = parameters.getString("BBOX");

        ByteArrayOutputStream output = null;
        if (bboxStr != null) {

            try {
View Full Code Here

       * label.
       */
      @Override
      protected String getOnClickScript(String url)
      {
        ValueMap valueMap = new ValueMap();
        valueMap.add("anticache", "" + Math.random());
        return new AppendingStringBuffer("new Ajax.Updater('counter', '").append(
          RequestCycle.get().urlFor(this, ILinkListener.INTERFACE, valueMap))
          .append("', {method:'get'}); return false;")
          .toString();
      }
View Full Code Here

  @Test
  public void valueMap() throws IOException
  {
    CheckingObjectOutputStream checker = new CheckingObjectOutputStream(new ByteArrayOutputStream(),
        new ObjectSerializationChecker(new NotSerializableException()));
    checker.writeObject(new ValueMap());
  }
View Full Code Here

   * Tests the CPM inheritance by setting a different root model using a rendered scenario.
   */
  @Test
  public void testCompoundPropertyModelRendered()
  {
    ValueMap data1 = new ValueMap();
    data1.put("label", "foo");

    ValueMap data2 = new ValueMap();
    data2.put("label", "bar");

    InheritedTestPage page = new InheritedTestPage();


    page.setDefaultModel(new CompoundPropertyModel<>(data1));
View Full Code Here

   * Tests the CPM by setting a different root model using a direct scenario.
   */
  @Test
  public void testCompoundPropertyModelDirect()
  {
    ValueMap data1 = new ValueMap();
    data1.put("label", "foo");

    ValueMap data2 = new ValueMap();
    data2.put("label", "bar");

    WebMarkupContainer parent = new WebMarkupContainer("foo");
    Label label = new Label("label");
    parent.add(label);

    parent.setDefaultModel(new CompoundPropertyModel<>(data1));
    assertEquals("foo", label.getDefaultModelObject());

    parent.setDefaultModel(new CompoundPropertyModel<>(data2));
    assertEquals("bar", label.getDefaultModelObject());

    data2.put("label", "foo");
    assertEquals("foo", label.getDefaultModelObject());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.value.ValueMap

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.