You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TextAreaOption.java 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2014 gitblit.com.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of 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,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package com.gitblit.wicket.panels;
  17. import org.apache.wicket.markup.html.basic.Label;
  18. import org.apache.wicket.markup.html.form.TextArea;
  19. import org.apache.wicket.model.IModel;
  20. import com.gitblit.utils.StringUtils;
  21. import com.gitblit.wicket.WicketUtils;
  22. /**
  23. * A re-usable textarea option panel.
  24. *
  25. * title
  26. * description
  27. * [text
  28. * area]
  29. *
  30. * @author James Moger
  31. *
  32. */
  33. public class TextAreaOption extends BasePanel {
  34. private static final long serialVersionUID = 1L;
  35. public TextAreaOption(String wicketId, String title, String description, IModel<String> model) {
  36. this(wicketId, title, description, null, model);
  37. }
  38. public TextAreaOption(String wicketId, String title, String description, String css, IModel<String> model) {
  39. super(wicketId);
  40. add(new Label("name", title));
  41. add(new Label("description", description).setVisible(!StringUtils.isEmpty(description)));
  42. TextArea<String> tf = new TextArea<String>("text", model);
  43. if (!StringUtils.isEmpty(css)) {
  44. WicketUtils.setCssClass(tf, css);
  45. }
  46. add(tf);
  47. }
  48. }