com.poscoict.glueframework.web.control.spring.view
Class GlueJExcelView

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.view.AbstractView
              extended by org.springframework.web.servlet.view.document.AbstractJExcelView
                  extended by com.poscoict.glueframework.web.control.spring.view.GlueJExcelView
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.View

public class GlueJExcelView
extends org.springframework.web.servlet.view.document.AbstractJExcelView

JExcel 기반으로 Excel을 Export하기 위한 View Class이다.


Nested Class Summary
 class GlueJExcelView.JExcelFormat
          JExcel의 Cell Type에 대한 정의를 가진 Class이다.
 
Field Summary
static String DEFAULT_DATE_FORMAT
           
 
Fields inherited from class org.springframework.web.servlet.view.AbstractView
DEFAULT_CONTENT_TYPE
 
Fields inherited from interface org.springframework.web.servlet.View
PATH_VARIABLES, RESPONSE_STATUS_ATTRIBUTE, SELECTED_CONTENT_TYPE
 
Constructor Summary
GlueJExcelView()
           
 
Method Summary
protected  void buildExcelDocument(Map<String,Object> model, jxl.write.WritableWorkbook workbook, HttpServletRequest request, HttpServletResponse response)
           
protected  String[] getColumnIds(GlueContext ctx, String sheetId)
          GlueContext에서 Column Id를 가져오는 메소드이다.
protected  String getFileName(GlueContext ctx)
          설정 값에 따라 FileName을 만들어 Return하는 메소드이다.
protected  void writeBody(jxl.write.WritableSheet sheet, List<Map<String,Object>> list, String[] columnIds)
          Excel Data부를 작성하는 메소드이다.
protected  void writeCell(jxl.write.WritableSheet sheet, int x, int y, Object data, String comment)
          한 Cell을 Write하는 메소드이다.
protected  void writeHeader(jxl.write.WritableSheet sheet, String[] columnIds, String[] columnNames)
          Excel Header를 작성하는 메소드이다.
protected  void writeImage()
          필요 시 구현.
protected  void writeRow(jxl.write.WritableSheet sheet, Map<String,Object> map, String[] columnIds, int y)
          Excel에 하나의 Row를 작성하는 메소드이다.
protected  void writeSheet(GlueContext ctx, jxl.write.WritableSheet sheet, String sheetId)
          GlueContext에 SheetId로 지정한 객체을 Get하여 Excel Sheet를 Write하는 메소드이다.
 
Methods inherited from class org.springframework.web.servlet.view.document.AbstractJExcelView
generatesDownloadContent, getTemplateSource, renderMergedOutputModel, setUrl
 
Methods inherited from class org.springframework.web.servlet.view.AbstractView
addStaticAttribute, createMergedOutputModel, createRequestContext, createTemporaryOutputStream, exposeModelAsRequestAttributes, getAttributesMap, getBeanName, getContentType, getRequestContextAttribute, getStaticAttributes, isExposePathVariables, prepareResponse, render, setAttributes, setAttributesCSV, setAttributesMap, setBeanName, setContentType, setExposePathVariables, setRequestContextAttribute, setResponseContentType, toString, writeToResponse
 
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
 
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, initApplicationContext, requiredContextClass, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DATE_FORMAT

public static String DEFAULT_DATE_FORMAT
Constructor Detail

GlueJExcelView

public GlueJExcelView()
Method Detail

buildExcelDocument

protected void buildExcelDocument(Map<String,Object> model,
                                  jxl.write.WritableWorkbook workbook,
                                  HttpServletRequest request,
                                  HttpServletResponse response)
                           throws Exception
Specified by:
buildExcelDocument in class org.springframework.web.servlet.view.document.AbstractJExcelView
Throws:
Exception

getFileName

protected String getFileName(GlueContext ctx)
설정 값에 따라 FileName을 만들어 Return하는 메소드이다.

Parameters:
ctx - GlueContext 객체
Returns:
String fileName

writeSheet

protected void writeSheet(GlueContext ctx,
                          jxl.write.WritableSheet sheet,
                          String sheetId)
                   throws Exception
GlueContext에 SheetId로 지정한 객체을 Get하여 Excel Sheet를 Write하는 메소드이다.

Parameters:
ctx - GlueContext 객체
sheet - WritableSheet 객체
sheetId - Sheet Id로 Export하려는 Data의 Key
Throws:
Exception

getColumnIds

protected String[] getColumnIds(GlueContext ctx,
                                String sheetId)
GlueContext에서 Column Id를 가져오는 메소드이다. GlueContext에 설정된 값이 없는 경우 RowSet ColumnDef에서 Column Id 정보를 가져온다.

Parameters:
ctx - GlueContext 객체
sheetId - Excel의
Returns:
String[] Column 정보에 대한 String배열

writeHeader

protected void writeHeader(jxl.write.WritableSheet sheet,
                           String[] columnIds,
                           String[] columnNames)
                    throws Exception
Excel Header를 작성하는 메소드이다.

Parameters:
sheet - WritableSheet 객체
columnIds - Column Id에 대한 String[]
columnNames - Column명에 대한 String[]
Throws:
Exception

writeBody

protected void writeBody(jxl.write.WritableSheet sheet,
                         List<Map<String,Object>> list,
                         String[] columnIds)
                  throws Exception
Excel Data부를 작성하는 메소드이다.

Parameters:
sheet - WritableSheet 객체
list - Excel에 Write하려는 Data 객체
columnIds - Column Id에 대한 String[]
Throws:
Exception

writeRow

protected void writeRow(jxl.write.WritableSheet sheet,
                        Map<String,Object> map,
                        String[] columnIds,
                        int y)
                 throws Exception
Excel에 하나의 Row를 작성하는 메소드이다.

Parameters:
sheet - WritableSheet 객체
map - Write하려는 Data Map.
columnIds - Column Id에 대한 String[]
y - write하려는 Line.
Throws:
Exception

writeCell

protected void writeCell(jxl.write.WritableSheet sheet,
                         int x,
                         int y,
                         Object data,
                         String comment)
                  throws Exception
한 Cell을 Write하는 메소드이다.

Parameters:
sheet - WritableSheet 객체
x - cell의 x 좌표 위치
y - cell의 y 좌표 위치
data - cell에 표기하려는 내용
comment - Column Id로 null이 아닌 경우 Comment(메모)로 삽입된다.
Throws:
Exception

writeImage

protected void writeImage()
필요 시 구현.



Copyright © 2013–2014 POSCO ICT SW제품기술팀. All rights reserved.