블로그 이미지
올해목표 // 10월 어학연수 떠나자~ 자수씨

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
GWT (64)
Google Gears (2)
Google Chart API (4)
Android (2)
Spring (31)
JAVA (176)
JavaScript (59)
WEB (49)
Database (20)
OS (26)
Tools (8)
Tips (26)
IT정보 (1)
Book (21)
Programming (37)
외부행사 (43)
주변인들 (17)
여행노트 (60)
학교생활 (30)
회사생활 (52)
사회생활 (5)
외국어공부 (12)
잡동사니 (30)
Total
Today
Yesterday
 
04-28 00:02
 

달력

« » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
 

최근에 올라온 글

최근에 달린 댓글

원문 : http://groups.google.com/group/Google-Web-Toolkit/msg/e6bf7acc9d16af6b

#1
http://xstream.codehaus.org/
Server 단에서 손쉽게 XML과 json으로 변경할 수 있는 라이브러리 제공

#2
there is no JSON_RPC in default tookit api, Simply use plain HTTP
rquest (e.g. restfull) and convert results to JSON object
GWT-RPC를 쓰지 않는 다는 소리인지;; 쩝;; 영어는 인생의 벽 ㅠ_ㅠ

#3
http://code.google.com/p/rocket-gwt/wiki/JsonSerialization
GWT client 단에서 사용할 수 있는 json 라이브러리

#4
http://code.google.com/p/gwt-api-interop/
요건 Java Script 단에서 사용할 수 있는 라이브러리

gwt-ext 를 하려다 보니 GWT-RPC의 반환 값을 grid에 적용시키기에는

공통을 뽑기가 어려워서 json으로 변환하여 사용해보려고 시도중입니다.

Posted by 자수씨
, |
먼저 해당 프로젝트 사이트(http://gwt-ext.com/) 로 들어가서 GWT-Ext 라이브러리를 다운받습니다.

다운로드 경로는 요기~ http://gwt-ext.com/download/


gwtext.2.0.1.zip 파일을 다운받습니다.
사용자 삽입 이미지
깔끔하게 압축을 풀어줍니다.







압축을 풀면 다음과 같은 폴더와 파일들이 나옵니다.
사용자 삽입 이미지
doc 당연히 javadoc이겠죠~
samples demo가 컴파일되어 있는 폴더입니다.
gwtext.jar 이것이 라이브러리~










기존 GWT 프로젝트를 열고 라이브러리 폴더에 gwtext.jar를 붙여넣습니다.
사용자 삽입 이미지









이것만 넣는다고 끝나지는 않습니다.
프로젝트 설정파일을 열고 GwtExt 프로젝트를 inherit을 위한 설정을 추가해줍니다.



gwt 프로젝트 public 폴더에 나머지 파일들도 샤샤샥 넣어 줍니다.
물론 소스는 gwt-ext sample에서 참고를해서....
gwtext-2.0.1\samples\Showcase2\src\com\gwtext\sample\showcase2\public
사용자 삽입 이미지

Showcase2.html과 Showcase2.css를 제외한 나머지 파일을
복사해서 붙여 넣습니다.
사실 사용하지 않는 파일들도 있지만 귀차니즘 때문에????

Showcase2.css는 열어서 프로젝트의 css에 append 해주시면 되구요~
Showcase2.html은 열어서 자신의 프로젝트 html에 맞게 수정을 해줍니다.






이 분들 아이디어에 감동을 받은 점은 js는 동기적으로 내려 받기 때문에

사용자들에게 어느정도까지 진행이 되는지를 알려준다는 점이었습니다.

가뜩이나 무거운 js들을 마냥 기다리는데 지치신 분들에게는 희소식~~


-----------------------------------------------------------------------------

준비는 완료되었습니다. 이제 gwt-ext를 사용해서 개발만 하면 되겠네요~



Posted by 자수씨
, |

항상 보면서 부러워만 했던 ext-js가 gwt로 라이브러리화 되어 나왔습니다.

이제 슬슬 만지작 만지작 해봐야 할 것 같네요 캬캭~

Posted by 자수씨
, |
GWT로 엔터프라이즈 환경을 개발하려면 여러가지 문제점이 발생한다.

모 제약사 그룹웨어를 GWT로 개발하다보니 메인 모듈이 5~6개 정도로 구성이 되었는데

하나의 entry-point로 구성하기에는 소스크기가 너무 커지며 HTML로 컴파일하는데도

시간이 10여분이 걸리는 최악의 상황이 발생하기도 한다.

모듈별로 GWT 프로젝트 구성 (entry-point 분할하기)

Mail 모듈과 전자결재 모듈 간의 GWT를 통하여 작업을 처리할 일은 없을 것이다.

공통으로 사용하는 클래스들을 별도의 GWT 프로젝트로 구성하고 각각의 모듈에 대해서

GWT 프로젝트를 구성한 후 공통 프로젝트를 inherit 하는 형식으로 프로젝트를 구성한다.

이런식으로 나누어 컴파일 할 경우에는 결과물의 용량도 줄어들며 컴파일 시간도

많이 줄어들게 된다.

모듈별로 GWT 프로젝트를 분리할 경우 발생하는 문제는 엔터프라이즈 환경의 프로젝트는

혼자서 하는 것이 아니므로 CVS 나 SVN 과 같은 소스 서버를 사용할 경우 컴파일 결과가

동일한 이름으로 나오지 않기 때문에 관리에 어려움을 겪기도 한다.


컴파일 결과물 파일명 통일하기 (GWTCompiler 수정하기)

컴파일된 결과물 이름이 01C4D9CAEE45ACC08AEAA5EC3D15509D.cached.html 로 나오는데

버전관리가 안되는 것은 당연한 것이다. Mail 모듈은 MailModule.cached.html로 결과가 나오게 한다면

그 문제는 해결이 될 것이다.

GWTCompiler.java 파일을 다음과 같이 수정한다.

수정 전

	private String realizePermutation(TreeLogger logger,
			Property[] currentProps, String[] currentValues, int permNumber)
			throws UnableToCompleteException {
		String msg = "Analyzing permutation #" + permNumber;
		logger = logger.branch(TreeLogger.TRACE, msg, null);

		logProperties(logger, currentProps, currentValues);

		// Create a rebind oracle that will record decisions so that we can
		// cache
		// them and avoid future computations.
		//
		CompilationRebindOracle rebindOracle = new CompilationRebindOracle();

		// Tell the property provider above about the current property values.
		// Note that the rebindOracle is actually sensitive to these values
		// because
		// in its ctor is uses propOracle as its property oracle.
		//
		propOracle.setPropertyValues(currentProps, currentValues);

		// Check to see if we already have this compilation.
		// This will have the effect of filling the rebind oracle's cache.
		//
		String[] entryPts = module.getEntryPointTypeNames();
		Compilation cached = compilations.find(logger, rebindOracle, entryPts);
		if (cached != null) {
			msg = "Matches existing compilation " + cached.getStrongName();
			logger.log(TreeLogger.TRACE, msg, null);
			return cached.getStrongName();
		}

		// Now attach a compilation into which we can record the particular
		// inputs
		// and outputs used by this compile process.
		//
		Compilation compilation = new Compilation();
		rebindOracle.recordInto(compilation);

		// Create JavaScript.
		//
		String js = jjs.compile(logger, rebindOracle);

		// Create a wrapper and an unambiguous name for the file.
		//
		String strongName = writeHtmlAndJsWithStrongName(logger, js);

		// Write out a cache control file that correlates to this script.
		//
		compilation.setStrongName(strongName);
		writeCacheFile(logger, compilation);

		// Add this compilation to the list of known compilations.
		//
		compilations.add(compilation);
		return compilation.getStrongName();
	}

수정 후
	private String realizePermutation(TreeLogger logger,
			Property[] currentProps, String[] currentValues, int permNumber)
			throws UnableToCompleteException {
		String msg = "Analyzing permutation #" + permNumber;
		logger = logger.branch(TreeLogger.TRACE, msg, null);

		logProperties(logger, currentProps, currentValues);

		// Create a rebind oracle that will record decisions so that we can
		// cache
		// them and avoid future computations.
		//
		CompilationRebindOracle rebindOracle = new CompilationRebindOracle();

		// Tell the property provider above about the current property values.
		// Note that the rebindOracle is actually sensitive to these values
		// because
		// in its ctor is uses propOracle as its property oracle.
		//
		propOracle.setPropertyValues(currentProps, currentValues);

		// Check to see if we already have this compilation.
		// This will have the effect of filling the rebind oracle's cache.
		//
		String[] entryPts = module.getEntryPointTypeNames();
		Compilation cached = compilations.find(logger, rebindOracle, entryPts);
		if (cached != null) {
			msg = "Matches existing compilation " + cached.getStrongName();
			logger.log(TreeLogger.TRACE, msg, null);
			return cached.getStrongName();
		}

		// Now attach a compilation into which we can record the particular
		// inputs
		// and outputs used by this compile process.
		//
		Compilation compilation = new Compilation();
		rebindOracle.recordInto(compilation);

		// Create JavaScript.
		//
		String js = jjs.compile(logger, rebindOracle);

		String entryPointName = entryPts[0].substring(entryPts[0]
				.lastIndexOf(".") + 1);
		String name = entryPointName + "_" + currentValues[2] + "_"
				+ currentValues[3];

		String strongName = writeHtmlAndJsWithStrongName(logger, js, name);

		compilation.setStrongName(strongName);
		writeCacheFile(logger, compilation);

		// Add this compilation to the list of known compilations.
		//
		compilations.add(compilation);
		return compilation.getStrongName();
	}

	private String writeHtmlAndJsWithStrongName(TreeLogger logger, String js,
			String strongName) throws UnableToCompleteException {
		try {

			byte[] scriptBytes = js.getBytes("UTF-8");
			{
				byte[] prefix = getHtmlPrefix().getBytes("UTF-8");
				byte[] suffix = getHtmlSuffix().getBytes("UTF-8");
				File outFile = new File(outDir, strongName + ".cache.html");
				Util.writeBytesToFile(logger, outFile, new byte[][] { prefix,
						scriptBytes, suffix });
				String msg = "Compilation written to "
						+ outFile.getAbsolutePath();
				logger.log(TreeLogger.TRACE, msg, null);
			}
			{
				byte[] prefix = getJsPrefix().getBytes("UTF-8");
				byte[] suffix = getJsSuffix().getBytes("UTF-8");
				File outFile = new File(outDir, strongName + ".cache.js");
				Util.writeBytesToFile(logger, outFile, new byte[][] { prefix,
						scriptBytes, suffix });
				String msg = "Compilation written to "
						+ outFile.getAbsolutePath();
				logger.log(TreeLogger.TRACE, msg, null);
			}
			return strongName;
		} catch (UnsupportedEncodingException e) {
			logger.log(TreeLogger.ERROR,
					"Unable to encode compiled script as UTF-8", e);
			throw new UnableToCompleteException();
		}
	}
 
 알 수 없던 바이트코드의 조합이었던 파일 명을 entry-point의 이름과 언어 코드, 브라우저 종류의 조합으로

항상 같은 형식으로 결과가 나오게 변경하였다. ex) MailModule_default_ie6.cache.html

realizePermutation 메소드의 44~49번째 라인이 수정되었으며, writeHtmlAndJsWithStrongName 메소드는

기존 메소드를 바탕으로 파일을 만드는 부분을 수정하였다.



지난 1년 6개월 동안 GWT를 통하여 그룹웨어를 만들면서 느낀점이 많다.

다음번 프로젝트 때는 1년 6개월 간의 노하우로 더 좋은 프로젝트를 해보고 싶다.

Posted by 자수씨
, |

글 보관함

최근에 받은 트랙백