블로그 이미지
초딩입맛제주아재
하고 싶은 것만 하며 살고 싶다

calendar

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 31
2006. 11. 16. 22:24 Programing/Smalltalk
>1. Class Browser로 HouseKeepingBookShell 의 "Views/New..." 명령을 내려 새 View를 만들어 줍니다. View의 이름을 물어보면 'view 2'라고 입력합니다. View Composer를 보면 기존에 만들었던 View와 똑같이 생긴 View가 있음을 볼 수 있습니다. 이 View는 기존의 'Default view'라고 불리는 기본 View와는 별개의 복사본 View입니다. 그 View를 아무리 수정해도(심하면 망가먹어도), 'Default view'는 여전히 잘 동작하게 됩니다. 그러니, 마음 푹 놓으시고 수정하기 바랍니다. 폰트를 바꾼다거나 창의 크기나 색깔등등 마음껏 바꾼 다음 창을 띄워봅니다.

>\설명이 길었죠? 이제 문제입니다. Workspace에서 HouseKeepingBookShell 를 띄울 때 showOn: 를 썼었습니다. view 2 창으로 띄워보려면 어떤 매쏘드를 써야할까요? 찾아보세요.

>힌트: showOn:과 아주 비슷한 이름의 매쏘드입니다


show: aResourceNameString on: aModel

HouseKeepingBookShell show: 'view2' on:  testBook

>2. View Composer로 view 2를 편집해 봅시다. 기존에 있던 list box를 삭제합니다.(삭제하기 전에 그것의 name을 기억해 둡시다) list box가 있던 자리에 ListPresenter.Enhanced list view를 추가해 넣습니다. 그리고 name을 지운 list box의 것으로 고칩니다. 창을 다시 열어봅니다. 열린 모습을 캡처해서 답으로 제출!!




>3. list box 와는 다르게 list view 계열은 복수 컬럼을 지원하기에 알맞는 형태로 되어 있습니다. 추가한 list view를 선택하면 속성으로 columnsList가 보입니다. Collection형태로 되어 있어 list view의 컬럼을 추가 삭제 편집할 수 있습니다. 가계부 항목의 속성은 이름, 가격, 날짜입니다.

>3개의 컬럼을 만들어 가계부 항목의 내용이 표시될 수 있도록 수정헤요.

>힌트: List Box에서 했던 것과 매우 유사합니다.



HouseKeepingBookItem >>

displayItemString
^self name.

displayPriceString
^self value.

displayDateString

 |stream|

 stream := String writeStream.
 self date printOn: stream format: 'yyyy-MM-dd'.
^stream contents.


'Programing > Smalltalk' 카테고리의 다른 글

Smalltalk의 TDD  (0) 2006.12.28
Smalltalk의 편리함과 백업의 중요성  (1) 2006.12.28
가계부 만들기 - 08  (0) 2006.11.16
가계부 만들기 - 07  (0) 2006.11.16
가계부 만들기 - 06  (0) 2006.11.16
posted by 초딩입맛제주아재
2006. 11. 16. 22:19 Programing/Smalltalk
1. HouseKeepingBookCategoriesDialog 클래스를 만듭니다. 대략 다음과 같은 형태로 뷰를 디자인합니다.

분류 이름들로 이루어진 콤보박스 하나.

그 콤보박스에 바싹 붙은 버튼 세 개(각각, 추가, 삭제, 편집)

분류이름 콤보박스에 선택된 분류의 항목이름이 나열된 리스트박스 하나.

그 리스트박스에 바싹 붙은 버튼 세 개(각각, 추가, 삭제, 편집)




2. 콤보박스에 현재 존재하는 모든 분류를 표시하게 한다.


createComponents

  super createComponents.

  categoryName := self add: ListPresenter new name: 'category name'.
  categoryItem := self add: ListPresenter new name: 'category item'
.

model: aHouseKeepingBoolCategory

   super model: aHouseKeepingBoolCategory.

  categoryName model: (ListModel on: aHouseKeepingBoolCategory categories ).

"categoryName 의 model을 변경하면서 추가한 메서드"

Association >> stringTheCombobox >>

  ^self value.

위 메서드를 새로 만들어준다음 HouseKeepingBookCategoryDialog의 view에서

콤보박스(category name)의 getTextBlock속성에 #stringTheCombobox를 입력해줍니다.



3. 분류이름 콤보박스의 선택이 바뀌면, 항목이름 리스트박스가 그에 맞게 초기화 되도록 이벤트를 달아 줍니다.

model: aHouseKeepingBoolCategory

   categoryName when: #selectionChanged send: #changeItem to: self.




4. 분류 추가 버튼을 누르면, Prompter를 띄워 문자열을 받아 그 이름의 분류를 추가하는 기능을 넣습니다.

설명: Prompter는 Dialog의 일종으로서 보편적으로 많이 사용되는 문답 형태의 Dialog를 표준화시킨 객체입니다. 사용법은 비슷합니다.

addCategoryName

  |newCategoryName|
  newCategoryName := Prompter prompt: '추가할 카테고리 이름을 입력하세요.' caption: '카테고리 추가'.


   newCategoryName ifNotNil: [:value |
       categoryName model add: #()->value.
       categoryName selectionByIndex: categoryName  model  size.
  ].


5. 분류 삭제 버튼을 누르면, 콤보박스에서 그 항목을 삭제합니다. (항목이름 리스트박스는 텅 비게 되겠죠?)

deleteCategoryName

  |index|
   index := categoryName selectionByIndex.
   categoryName selectionByIndex: 1.
   categoryName model removeAtIndex: index.


queryCommand: aCommandQuery

  super queryCommand: aCommandQuery.

  (#(#deleteCategoryName) includes: aCommandQuery command) ifTrue: [
       aCommandQuery isEnabled: categoryName hasSelection].


6. 분류 편집 버튼을 누르면, 4번과 마찬가지로 Prompter를 띄워 현재 분류의 이름을 바꾸는 기능을 넣습니다.

editCategoryName

  |newCategoryName|
   newCategoryName := Prompter on: categoryName selection value  prompt: '원하시는 카테고리명을 입력해주세요.' caption: '카테고리 수정'.
   newCategoryName ifNotNil: [:value | (categoryName  model at: categoryName selectionByIndex) value: value ].

queryCommand: >>

(#(#editCategoryName) includes: aCommandQuery command) ifTrue: [
aCommandQuery isEnabled: categoryName hasSelection].


7. 4~6번과 마찬가지로 리스트박스에 대해서도 항목 추가, 삭제, 편집 버튼을 구현해 줍니다.

"항목 추가"

addCategoryItem

  newcategoryItem categoryNameModel|
  newCategoryItem := Prompter prompt: '추가할 항목을 입력하세요.' caption: '항목 추가'.
  categoryNameModel := (categoryName model select: [:each | each value = categoryName selection value ] ) at:1.

   newCategoryItem ifNotNil: [:value |
       categoryNameModel key: (categoryNameModel key,(Array with: value)).
       self changeItem.
    ].


"항목 삭제"

deleteCategoryItem

  |categoryNameModel|
   categoryNameModel := (categoryName model select: [:each | each value = categoryName selection value ]) at: 1.
   categoryNameModel key: (categoryNameModel key select: [:each | each ~= categoryItem selection]).

   self changeItem.

"항목 편집"

editCategoryItem

  |newCategoryItem categoryNameModel|
   newCategoryItem := Prompter on: categoryItem selection prompt: '원하시는 항목을 입력해주세요.' caption: '항목 수정'.

  categoryNameModel := categoryName  model at: categoryName selectionByIndex.
 
newCategoryItem ifNotNil: [:value |
       categoryNameModel key: ((categoryNameModel key select: [:each | each ~= categoryItem selection]) , (Array with: value)).
       self changeItem.
  ].


queryCommand >>추가

(#(#addCategoryItem) includes: aCommandQuery command) ifTrue: [
aCommandQuery isEnabled: categoryName hasSelection].

#(deleteCategoryItem editCategoryItem) includes: aCommandQuery command) ifTrue: [
aCommandQuery isEnabled: categoryItem hasSelection].


8.
HouseKeepingBookShell에 editCategories라는 메뉴를 만들어 HouseKeepingBookCategoriesDialog 을 띄울 수 있게 합니다.

editCategory

  |newCategories|

  newCategories := HouseKeepingBookCategoriesDialog showModalOn: self model categories.

  newCategories ifNotNil: [:value | self model categories: value].




9. HouseKeepingBookShell에 showItemCategory라는 메뉴를 만들어 선택한 항목의 분류를 MessageBox로 볼 수 있게 합니다.

showItemCategory

  MessageBox notify: (self model categories categoryNameOfItemName:  items selection name).


'Programing > Smalltalk' 카테고리의 다른 글

Smalltalk의 편리함과 백업의 중요성  (1) 2006.12.28
가계부 만들기 - 짧은숙제  (0) 2006.11.16
가계부 만들기 - 07  (0) 2006.11.16
가계부 만들기 - 06  (0) 2006.11.16
Array를 OrderedCollection으로 바꾸기  (0) 2006.11.02
posted by 초딩입맛제주아재
2006. 11. 16. 22:16 Programing/Smalltalk
1. Dialog 클래스 아래 HouseKeepingBookItemDialog라는 클래스를 만들고, View/New 하여 새 뷰를 만든다. 만들어진 뷰는 Shell의 뷰와는 모양이 조금 다를겁니다. 어떻게 다른가요?

Ok와 Cancel 버튼 두개가 만들어져 있습니다.

2. HouseKeepingBookItemDialog는 HouseKeepingBookItem 객체를 모델로 삼아  수정하는 Dialog가 될 것입니다. Shell에서 했던 것과 같은 방법으로 item의 name, value, date를 표현할 컨트롤들을 꾸며봅니다. (화면 캡쳐해주세요)
힌트: 
작성해야 할 매쏘드들 ...  model:   createComponents
사용할 클래스들 ... TextPresenter, DatePresenter, NumberPresenter
주의할 점: Date


createComponents

super createComponents.

namePresenter := self add: TextPresenter new name: 'name'.
valuePresenter := self add: NumberPresenter new name: 'value'.
datePresenter := self add: DatePresenter new name: 'date'.

model: aHouseKeepingBookItem

super model: aHouseKeepingBookItem.

namePresenter model: (self model aspectValue: #name).
valuePresenter model: (self model aspectValue: #value).
datePresenter model: (self model aspectValue: #date).


3. Workspace로 가서 간단한 테스트를 해봅시다.
myItem := HouseKeepingBookItem new.
HouseKeepingBookItemDialog showModalOn: myItem.

Dialog에 뭔가 적당한 값들을 기입해 줍니다. OK버튼을 누릅니다.
myItem의 값이 어떻게 되었나요?

입력한 값으로 바뀌었습니다.


4. Workspace로 가서 간단한 테스트를 해봅시다.
myItem := HouseKeepingBookItem new.
HouseKeepingBookItemDialog showModalOn: myItem.

Dialog에 뭔가 적당한 수정을 해 줍니다.
CANCEL버튼을 누릅니다.
myItem의 값이 어떻게 되었나요?

바뀌지 않았습니다.


5. HouseKeepingBookShell의 newItem매쏘드에서 임시 item을 생성했었죠? 이제, HouseKeepingBookItemDialog 가 있으니까, 정식으로 추가 할 수 있게 되었습니다.

HouseKeepingBookShell의 newItem매쏘드를 수정하여, 사용자가 입력한 값을 새 가계부 항목으로 등록하도록 수정하세요.

newItem
items model add:  (HouseKeepingBookItemDialog showModalOn: HouseKeepingBookItem new)


6. 5번 문제에서 사용자가 Cancel을 눌러버린다면? item을 추가하면 안되겠죠? newItem 매쏘드를 수정하여 그 기능을 추가하세요.

newItem

(HouseKeepingBookItemDialog showModalOn: HouseKeepingBookItem new)
ifNotNil: [:value | items model add: value].


7. IT에서 추가와 편집은 큰 차이가 없습니다. HouseKeepingBookShell에 편집메뉴명령을 추가하고 editItem 이라는 매쏘드에 그 기능을 구현하세요. 합산과 흑/적 상태가 바르게

바뀌도록 하세요. deleteItem과 마찬가지로 선택된 것이 없으면 수정할 수 없에 커맨드비활성화하는 것도 잊지마시고요.

queryCommand: aCommandQuery

super queryCommand: aCommandQuery.

#(deleteItem editItem) includes: aCommandQuery command)

  ifTrue: [aCommandQuery isEnabled: items hasSelection].

 

editItem

(HouseKeepingBookItemDialog showModalOn: ( items model at: items selectionByIndex ))
ifNotNil: [:value | items model updateItem: value]


model: 이벤트 추가

items model when: #item:updatedAtIndex: send: #refreshSumAndStatus to: self.


8. 추가와 수정이 아무리 흡사하더라도, 사용자가 구별할 수 있게 해줘야겠죠? 추가일 때는 Dialog의 제목이 '가계부 항목 추가'로, 수정일 때는 '가계부 항목 수정'으로 표시되게 하세요.
힌트: createOn:   caption:   showModal


HouseKeepingBookShell > newItem,editItem 메서드 수정

newItem

((HouseKeepingBookItemDialog createOn: HouseKeepingBookItem new) caption: '가계부 항목 추가'; showModal)
ifNotNil: [:value | items model add: value ].

editItem

((HouseKeepingBookItemDialog createOn: ( items model at: items selectionByIndex )) caption: '가계부 항목 수정'; showModal )
ifNotNil: [:value | items model updateItem: value].

'Programing > Smalltalk' 카테고리의 다른 글

가계부 만들기 - 짧은숙제  (0) 2006.11.16
가계부 만들기 - 08  (0) 2006.11.16
가계부 만들기 - 06  (0) 2006.11.16
Array를 OrderedCollection으로 바꾸기  (0) 2006.11.02
객체를 배열로 만들어주는 Array with:  (0) 2006.10.30
posted by 초딩입맛제주아재
2006. 11. 16. 22:10 Programing/Smalltalk
1. 가계부의 원금란을 수정하면, 합산을 표시하던 NumberPresenter와 흑자/적자를 표시하던 TextPresenter가 자동으로 갱신되도록 하세요. createSchematicWiring라는 매쏘드를 만들어서 두 Presenter사이의 관계를 지어주면 됩니다.

힌트: Shell의 상위 클래스인 Presenter 클래스에는 createSchematicWiring이라는 매쏘드가 있습니다. 이 매쏘드는 창이 처음 열릴때 한 번만 호출되며, 창 자신을 포함한 모든 하위창들 사이의 메세지 핸들링을 초기화합니다. 다른 사람들이 작성한 createSchematicWiring 매쏘드를 Method Browser로 검색해보시면, 대강 감이 오실 겁니다. 잘 모르겠으면, 메신저로 연락주세요. 추가 힌트 나갑니다.


createSchematicWiring

   super createSchematicWiring.

   pocketMoney when: #valueChanged send: #refreshSumAndStatus to: self.


2. View Composer를 열어서 HouseKeepingBookShell에 메뉴바를 추가합니다.

Item/New 메뉴를 만듭니다. (메뉴속성에서 command는 #newItem로 합니다)

showOn: 해서 메뉴를 테스트해봅니다. 메뉴의 상태가 어떻습니까?

힌트: View Composer를 열어서 Modify메뉴의 Menu Bar... 라는 명령을 실행합니다.


"New"항목이 비활성화 상태입니다...


3. Class Browser로 HouseKeepingBookShell에 newItem이라는 매쏘드를 만들어 줍니다.

showOn: 해서 메뉴를 테스트해봅니다. 메뉴의 상태가 어떻게 달라졌습니까?

"New"항목이 활성화 되었습니다.



4. 3번 문제에서 만든 newItem은 HouseKeepingBookShell의 메뉴가 선택되면 불리는 매쏘드 입니다. 이 매쏘드를 편집하여 '임시'라는 이름을 가진, 가격은 30인, 날짜는 오늘인 항목하나를 추가하게 합니다. 맞게 하셨다면, 항목추가와 함께 합산과 흑/적자 표시도 동시에 갱신됨을 확인하실 수 있습니다.

제약조건: 리스트컨트롤을 직접 제어하면 안되며, HouseKeepingBookShell의 모델을 수정한 다음, Shell로 하여금 재초기화 하도록 해야 함.

newItem 정의를 답으로 제출하세요.


newItem

items model add: (
  HouseKeepingBookItem new
   name: '임시';
   value: 30;
   date: Date today
).



5. View Composer를 열어서 Item/Delete 메뉴를 만듭니다. (메뉴속성에서 command는 #deleteItem로 합니다)

HouseKeepingBookShell에 deleteItem매쏘드를 두어, 리스트에 선택된 항목들을 지우게끔 하세요. 4번과 마찬가지로, 합산과  흑/적자 표시가 갱신될겁니다.

deleteItem 매쏘드를 답으로 제출하세요.

힌트:  selection , remove: , model:


deleteItem

items model removeAtIndex: items selectionByIndex.


4~5번 관련하여 이벤트를 통한 자동갱신을 위하여 model: 메서드를 수정하였습니다.

model:>>

items model: (ListModel on: aHouseKeepingBook items).
items model when: #item:addedAtIndex: send: #refreshSumAndStatus to: self.
items model when: #item:removedAtIndex: send: #refreshSumAndStatus to: self.

6. View Composer를 열어서 PushButton을 하나 추가해서, 클릭하면 4번과 같은 동작을 하게끔 하세요.

힌트: 클래스 소스는 일절 수정할 필요가 없습니다. 오로지 View Composer만으로 해낼 수 있습니다.

어떤 방법으로 해냈는지 설명하는 글을 답으로 제출하세요.

View Composer의 우측 하단 속성창에서

commandDescription > command: #newItem





7. View Composer를 열어서 PushButton을 하나 추가해서, 클릭하면 5번과 같은 동작을 하게끔 하세요.

힌트: 클래스 소스는 일절 수정할 필요가 없습니다. 오로지 View Composer만으로 해낼 수 있습니다.

어떤 방법으로 해냈는지 설명하는 글을 답으로 제출하세요.


commandDescription > command: #deleteItem




8. 가계부 item을 삭제하면, 리스트에서 다른 item을 선택하지 않은 채, 또 삭제를 시도해 보세요. 에러가 나죠?

에러가 나지 않게, 선택한 item이 없을 때는 메뉴를 비활성화 해야 합니다. queryCommand:라는 매쏘드를 작성하면 됩니다.

queryCommand: 를 검색해서 다른 사람들은 어떻게 작성했는지 참고하세요.

힌트:  isEnabled:  를 사용하면 됩니다.


queryCommand: aCommandQuery

   super queryCommand: aCommandQuery.

   (#(deleteItem) includes: aCommandQuery command)

       ifTrue: [aCommandQuery isEnabled: items hasSelection].



9. 8번에서 작업한 것이 버튼에 어떤 영향을 미쳤는지 보고하세요.

프로그램을 실행하면 삭제 버튼이 비활성화 되있습니다.

posted by 초딩입맛제주아재
2006. 11. 13. 23:00 도서


이름값을 하는 책이다.
그다지 얇지만은 아닌책인데
지루하지 않게 이야기를 풀어나가고 있다.
저자도 밝혔듯
프로그램을 전혀 모르는 사람이라면 다소 무리가 있는 내용이지만
조금 맛을 본 사람들에게는 자바의 개념을 정확하게 심어 줄 것이라 생각한다.
나도 경험하는 중이니까...

'도서' 카테고리의 다른 글

CSS 마스터 전략  (0) 2007.08.07
Ajax in Action  (0) 2007.08.07
Head First Design Patterns  (0) 2007.03.06
소설 '이휘소' - 공석하 저  (0) 2006.07.29
posted by 초딩입맛제주아재
2006. 11. 13. 22:48 영화/애니

최고다.

역시 고스트바둑왕의 작가 오바타 타케시  답다.

그는 천재다.

고스트바둑왕때도 날 미치게 하더니....

인간의 머리로 어찌 이런 스토리를 생각할 수 있단 말인가.


인간계로 떨어지는 데스노트

하우투 유즈??



사과킬러 류크

광기어린 저 표정은..

역시 라이토!!

'영화/애니' 카테고리의 다른 글

라디오 스타  (0) 2006.12.24
우리들의 행복한 시간  (0) 2006.12.24
영화 - 데스노트 1편  (0) 2006.11.13
연예,그 참을 수 없는 가벼움  (0) 2006.11.08
타짜  (2) 2006.10.26
posted by 초딩입맛제주아재
2006. 11. 13. 22:35 영화/애니

애니를 본 후에 봐서 그런가...
뭔가 부족한 느낌이다.
특히 'L'이 내맘에 쏙 들지가 않는다.
3D로 만들어진 사신 류크는 자연스럽게 잘 만들어진것 같다.
하지만 역시나 그 긴 내용을 단 두편에 축약하려니 수많은 칼질을 감행했으리라 본다.
때문에 억지로 짜맞춘 듯 한 부분들이 눈에 거슬렸다.
역시나 애니의 영향이 클 것이다.
자막도 시원치 않은걸 구해서 중간중간 일본어를 그대로 흘려버려야 했던 것도 한 몫 거들었다.
애니의 점수는 최고점이지만
영화의 점수는 중간정도....


'영화/애니' 카테고리의 다른 글

우리들의 행복한 시간  (0) 2006.12.24
애니메이션 - 데스노트  (1) 2006.11.13
연예,그 참을 수 없는 가벼움  (0) 2006.11.08
타짜  (2) 2006.10.26
식스틴 블럭 (16 Blocks, 2006)  (0) 2006.10.08
posted by 초딩입맛제주아재
2006. 11. 10. 17:45 Programing/HTML/JavaScript/CSS
posted by 초딩입맛제주아재
2006. 11. 10. 16:27 LINUX
/proc 디렉토리는 리눅스 시스템에서 아주 중요한 곳이다.
실행중인 프로세스 목록들도 있고
시스템 정보도 이곳에서 확인 할 수 있다.

파일이름들을 보면 감이 확 온다. -_-

1.cpu정보 - cpuinfo(하이퍼스레딩을 지원하는 cpu일 경우 cpu1개당 2개로 표시가 된다.)
2.메모리정보 - meminfo
3.디스크정보 - diskstats,scsi/scsi

'LINUX' 카테고리의 다른 글

crontab  (0) 2007.01.26
서버 시간 맞추기  (2) 2007.01.22
iptables  (0) 2006.09.22
Yum  (0) 2006.09.17
X윈도우에서 Consol로  (0) 2006.09.17
posted by 초딩입맛제주아재
2006. 11. 10. 10:40 Programing/아뜰리에
posted by 초딩입맛제주아재