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.

XSSFDataBarFormatting.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * ====================================================================
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. * ====================================================================
  18. */
  19. package org.apache.poi.xssf.usermodel;
  20. import org.apache.poi.ss.usermodel.Color;
  21. import org.apache.poi.ss.usermodel.DataBarFormatting;
  22. import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDataBar;
  23. /**
  24. * High level representation for DataBar / Data Bar Formatting
  25. * component of Conditional Formatting settings
  26. */
  27. public class XSSFDataBarFormatting implements DataBarFormatting {
  28. IndexedColorMap _colorMap;
  29. CTDataBar _databar;
  30. /*package*/ XSSFDataBarFormatting(CTDataBar databar, IndexedColorMap colorMap){
  31. _databar = databar;
  32. _colorMap = colorMap;
  33. }
  34. public boolean isIconOnly() {
  35. if (_databar.isSetShowValue())
  36. return !_databar.getShowValue();
  37. return false;
  38. }
  39. public void setIconOnly(boolean only) {
  40. _databar.setShowValue(!only);
  41. }
  42. public boolean isLeftToRight() {
  43. return true;
  44. }
  45. public void setLeftToRight(boolean ltr) {
  46. // TODO How does XSSF encode this?
  47. }
  48. public int getWidthMin() {
  49. return 0;
  50. }
  51. public void setWidthMin(int width) {
  52. // TODO How does XSSF encode this?
  53. }
  54. public int getWidthMax() {
  55. return 100;
  56. }
  57. public void setWidthMax(int width) {
  58. // TODO How does XSSF encode this?
  59. }
  60. public XSSFColor getColor() {
  61. return new XSSFColor(_databar.getColor(), _colorMap);
  62. }
  63. public void setColor(Color color) {
  64. _databar.setColor( ((XSSFColor)color).getCTColor() );
  65. }
  66. public XSSFConditionalFormattingThreshold getMinThreshold() {
  67. return new XSSFConditionalFormattingThreshold(_databar.getCfvoArray(0));
  68. }
  69. public XSSFConditionalFormattingThreshold getMaxThreshold() {
  70. return new XSSFConditionalFormattingThreshold(_databar.getCfvoArray(1));
  71. }
  72. public XSSFConditionalFormattingThreshold createThreshold() {
  73. return new XSSFConditionalFormattingThreshold(_databar.addNewCfvo());
  74. }
  75. }