Package org.jboss.seam.excel

Examples of org.jboss.seam.excel.ExcelWorkbookException


               {
                  cellFormat = new WritableCellFormat(new NumberFormat(cellStyle.formatMask));
               }
               catch (IllegalArgumentException e)
               {
                  throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not create number format for mask {0}", cellStyle.formatMask), e);
               }
            }
         }
         break;
      case date:
         /*
          * If there is no mask, creates a default date format cell If there is
          * a mask, tries to match it against a constant name If the constant
          * can't be created, creates a custom date format from the mask
          */

         if (cellStyle.formatMask == null)
         {
            cellFormat = new WritableCellFormat(DateFormats.DEFAULT);
         }
         else
         {
            DisplayFormat displayFormat = JXLFactory.createDateFormat(cellStyle.formatMask);
            if (displayFormat != null)
            {
               cellFormat = new WritableCellFormat(displayFormat);
            }
            else
            {
               try
               {
                  cellFormat = new WritableCellFormat(new DateFormat(cellStyle.formatMask));
               }
               catch (IllegalArgumentException e)
               {
                  throw new ExcelWorkbookException(Interpolator.instance().interpolate("Could not create date format for mask {0}", cellStyle.formatMask), e);
               }
            }
         }
         break;
      case formula:
View Full Code Here


            break;
         case list:
            addListValidation(cellFeatures, (UIListValidation) validation);
            break;
         default:
            throw new ExcelWorkbookException(Interpolator.instance().interpolate("Unknown validation type {0}", validation.getType()));
         }
      }
      return cellFeatures;
   }
View Full Code Here

         {
            cellFormat = createCellFormat(uiCell, cellType);
         }
         catch (WriteException e)
         {
            throw new ExcelWorkbookException("Could not create cellformat", e);
         }
         cellInfoCache.setCachedCellFormat(uiCell.getId(), cellFormat);
      }
      return cellFormat;
   }
View Full Code Here

   private static void addListValidation(WritableCellFeatures cellFeatures, UIListValidation validation)
   {
      List<UIListValidationItem> items = ExcelComponent.getChildrenOfType(validation.getChildren(), UIListValidationItem.class);
      if (items.isEmpty())
      {
         throw new ExcelWorkbookException("No items in validation list");
      }

      List<String> validations = new ArrayList<String>();
      for (UIListValidationItem item : items)
      {
View Full Code Here

    */
   private static void addRangeValidation(WritableCellFeatures cellFeatures, UIRangeValidation validation)
   {
      if (validation.getStartColumn() == null || validation.getStartRow() == null || validation.getEndColumn() == null || validation.getEndRow() == null)
      {
         throw new ExcelWorkbookException("Must set all start/end columns/rows for range validation");
      }

      cellFeatures.setDataValidationRange(validation.getStartColumn(), validation.getStartRow(), validation.getEndColumn(), validation.getEndRow());
   }
View Full Code Here

    */
   private static void addNumericValidation(WritableCellFeatures cellFeatures, UINumericValidation validation)
   {
      if (validation.getValue() == null)
      {
         throw new ExcelWorkbookException("Must define value in validation");
      }
      if ((ValidationCondition.between.equals(validation.getCondition()) || ValidationCondition.not_between.equals(validation.getCondition())) && validation.getValue2() == null)
      {
         throw new ExcelWorkbookException("Must define both values in validation for between/not_between");
      }
      switch (validation.getCondition())
      {
      case equal:
         cellFeatures.setNumberValidation(validation.getValue(), WritableCellFeatures.EQUAL);
View Full Code Here

            log.trace("Moving from row #0 to #1", currentRowIndex,
                    currentRowIndex + 1);
        }
        currentRowIndex++;
        if (currentRowIndex >= MAX_ROWS) {
            throw new ExcelWorkbookException(Interpolator.instance()
                    .interpolate("Excel only supports {0} rows", MAX_COLUMNS));
        }
    }
View Full Code Here

            log.trace("Moving from column #0 to #1", currentColumnIndex,
                    currentColumnIndex + 1);
        }
        currentColumnIndex++;
        if (currentColumnIndex > MAX_COLUMNS) {
            throw new ExcelWorkbookException(Interpolator.instance()
                    .interpolate("Excel doesn't support more than {0} columns",
                            MAX_COLUMNS));
        }
        if (currentRowIndex > maxRowIndex) {
            maxRowIndex = currentRowIndex;
View Full Code Here

    private boolean workbookContainsSheet(String name) {
        if (log.isTraceEnabled()) {
            log.trace("Checking if workbook contains sheet named #0", name);
        }
        if (workbook == null) {
            throw new ExcelWorkbookException(
                    "Can't search for sheets before creating a workbook");
        }
        boolean found = false;
        for (String sheetName : workbook.getSheetNames()) {
            if (sheetName.equalsIgnoreCase(name)) {
View Full Code Here

     * @param uiWorksheet
     *            The worksheet to create or select in the workbook
     */
    public void createOrSelectWorksheet(UIWorksheet uiWorksheet) {
        if (workbook == null) {
            throw new ExcelWorkbookException(
                    "You cannot create a worksheet before creating a workbook");
        }
        if (log.isDebugEnabled()) {
            log
                    .debug(
View Full Code Here

TOP

Related Classes of org.jboss.seam.excel.ExcelWorkbookException

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.