목 차 JFace는? Hello World 예제 Image,Font, Color Registry 소개 Action과 Contribution 소개 Viewer 소개 TreeViewer TableViewer Dialog,Wizard, Preference 소개 팀 회의 실습
JFace는?
모델 기반 어뎁터 or 헬퍼 클래스
www.eclipse.org/swt
UI Framework 문제 : 구조적인 도메인 모델을 탐색 및 조작 할 수 있어야 한다. 도메인이 바뀌어도 UI와 싱크를 맞추어야 한다.
HelloWorld예제 public class HelloWorldJFace extends ApplicationWindow { public HelloWorldJFace() { // 2 super(null); createActions(); addToolBar(SWT.FLAT | SWT.WRAP); addMenuBar(); addStatusLine(); } protected Control createContents(Composite parent) // 8 composit 생성 private void createActions() // 3 명령 설정 protected ToolBarManager createToolBarManager(int style) // 4 메뉴 아래에 툴바 protected MenuManager createMenuManager() // 5 최상위 메뉴 설정 protected StatusLineManager createStatusLineManager() // 6 하단에 상태바 public static void main(String args[]) { // 1 try { HelloWorldJFace window = new HelloWorldJFace(); window.setBlockOnOpen(true); window.open(); Display.getCurrent().dispose(); } catch (Exception e) { e.printStackTrace(); } } protected void configureShell(Shell newShell) // 7 protected Point getInitialSize() // 9
HelloWorld 예제 실행 SWT Designer사용 File -> New -> Project -> Designer -> SWT/JFace Java Project
Image,Font, Color Registry 소개 JFaceResources ImageRegistry FontRegistry ColorRegistry
Action과 Contribution View와 Control분리 운영체제 Event Queue Display public class StatusAction extends Action { public StatusAction() { super("&Trigger@Ctrl+T", AS_PUSH_BUTTON); setToolTipText("Trigger the Action"); setImageDescriptor(ImageDescriptor.createFromFile(this.getClass(), "property.png")); } public void run() { System.out.println("The status action has fired."); } } Application Window Contiribution Run
Viewer소개 Viewer는? Model + View + Control을 분리. 정렬 필터링 랜더링( 아이콘, 레벨) Action을 제공 종류 List, Table, Tree, Text
Table Viewer 소개
Tree Viewer 소개 Domain Data
Tree Viewer 소개 모델변경 – 모델변경 -> view 변경 Domain Data
0 comments
Post a comment