Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

CustomLayoutWithMissingSlot.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.customlayout;
  17. import java.io.ByteArrayInputStream;
  18. import java.io.IOException;
  19. import com.vaadin.server.VaadinRequest;
  20. import com.vaadin.tests.components.AbstractTestUIWithLog;
  21. import com.vaadin.ui.Button;
  22. import com.vaadin.ui.Button.ClickEvent;
  23. import com.vaadin.ui.Button.ClickListener;
  24. import com.vaadin.ui.CustomLayout;
  25. import com.vaadin.v7.ui.LegacyTextField;
  26. public class CustomLayoutWithMissingSlot extends AbstractTestUIWithLog {
  27. @Override
  28. protected void setup(VaadinRequest request) {
  29. CustomLayout cl;
  30. try {
  31. cl = new CustomLayout(new ByteArrayInputStream(
  32. "<div>First: <div location='first'></div><p>Second: <div location='second'></div><p>"
  33. .getBytes("UTF-8")));
  34. cl.addComponent(new LegacyTextField("This should be visible"),
  35. "first");
  36. Button button = new Button(
  37. "This button is visible, together with one label");
  38. button.addClickListener(new ClickListener() {
  39. @Override
  40. public void buttonClick(ClickEvent event) {
  41. log("Button clicked");
  42. }
  43. });
  44. cl.addComponent(button, "second");
  45. cl.addComponent(
  46. new LegacyTextField("This won't be as the slot is missing"),
  47. "third");
  48. addComponent(cl);
  49. } catch (IOException e) {
  50. // TODO Auto-generated catch block
  51. e.printStackTrace();
  52. }
  53. }
  54. }