2011-08-05 9 views
1

gwt 2.3 UIbinder.UnbiderWindget.ui.xml 파일에 UIbider에서 하나의 CSS를 인라인으로 적용합니다.UIBinder의 한 파일에서 CSS를 적용하는 방법은 무엇입니까?

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> 

.important { 폰트 중량 : 굵은; } .grid { 테두리 : 1px 단색 #BBBBBB; 신장 : 자동; 패딩 : 3px; GWT에서 컨트롤에 적용이 XML 파일의 CSS에서 지금

<g:> 
<g:HTMLPanel> 
Label, 
    <g:Button styleName="{style.important}" ui:field="button" /> 
    <g:TextBox ui:field="text1" width="15em" /> 
    <g:Grid ui:field="grid1" styleName="{style.grid}"> 

     <g:row> 
      <g:customCell> 
       <g:TextBox ui:field="text2" width="15em" /> 
      </g:customCell> 
      <g:customCell> 
       <g:TextBox ui:field="text3" width="15em" /> 
      </g:customCell> 
     </g:row> 

     <g:row> 
      <g:customCell> 
       <g:Button ui:field="buttonA">Button A</g:Button> 
      </g:customCell> 
      <g:customCell> 
       <g:Button ui:field="buttonB">Button B</g:Button> 
      </g:customCell> 
     </g:row> 
     <g:row> 
      <g:customCell> 
       <g:Button ui:field="addNewRow">Add New Row</g:Button> 
      </g:customCell> 
     </g:row> 
    </g:Grid> 

</g:HTMLPanel> 
} 위의 선언에 있습니다. 나는 하나의 파일에 모든 CSS를 넣을 수있는 방법을 알고 싶습니다. 그리고 나는 한 번 CSS 파일에만 CSS를 적용 할 수 있습니까?

모든 ui.xml에 CSS를 쓰는 대신 하나의 파일에서만 적용하고 싶습니다. (style.css와 유사) 미리 감사드립니다.

<ui:style src='path/to/my/css' /> 

그러나 일반적으로, 나는 그 전부 CSS와 HTML을 유지하는 것이 좋습니다 생각 :

답변

3

당신은이 ui:style 같이 선언 할 수 있습니다.

+0

안녕하세요, reply.but의 경로 설정 방법 모든 유형을 설정하여 경로를 선언했지만 오류가있는 CSS 파일 인 uibinder/LoginPanel.css가 누락되었습니다 .uibinder는 war 폴더입니다. –

+2

경로는 uibinder 파일이있는 폴더에 상대적입니다. 따라서 ../를 사용하여 필요한 경우 위로 이동하십시오. – Luismahou

+1

BTW에서 'path/to/my/css'는 gwt.xml 모듈에 정의 된 소스 경로에서 도달 할 수있는 파일을 가리켜 야합니다. CSS에있는 것이 무엇이든간에 GWT에 의해 '컴파일'되고 난독 화되고 최소화되고 최적화 된 버전으로 변형됩니다. – Luismahou

관련 문제