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.

FilestoreUI.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2015 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;
  17. import org.apache.wicket.markup.html.basic.Label;
  18. import com.gitblit.models.FilestoreModel;
  19. import com.gitblit.models.FilestoreModel.Status;
  20. /**
  21. * Common filestore ui methods and classes.
  22. *
  23. * @author Paul Martin
  24. *
  25. */
  26. public class FilestoreUI {
  27. public static Label getStatusIcon(String wicketId, FilestoreModel item) {
  28. return getStatusIcon(wicketId, item.getStatus());
  29. }
  30. public static Label getStatusIcon(String wicketId, Status status) {
  31. Label label = new Label(wicketId);
  32. switch (status) {
  33. case Upload_Pending:
  34. WicketUtils.setCssClass(label, "fa fa-spinner fa-fw file-negative");
  35. break;
  36. case Upload_In_Progress:
  37. WicketUtils.setCssClass(label, "fa fa-spinner fa-spin fa-fw file-positive");
  38. break;
  39. case Available:
  40. WicketUtils.setCssClass(label, "fa fa-check fa-fw file-positive");
  41. break;
  42. case Deleted:
  43. WicketUtils.setCssClass(label, "fa fa-ban fa-fw file-negative");
  44. break;
  45. case Unavailable:
  46. WicketUtils.setCssClass(label, "fa fa-times fa-fw file-negative");
  47. break;
  48. default:
  49. WicketUtils.setCssClass(label, "fa fa-exclamation-triangle fa-fw file-negative");
  50. }
  51. WicketUtils.setHtmlTooltip(label, status.toString());
  52. return label;
  53. }
  54. }