올바른 질문인지 잘 모르겠습니다 만 CompositeCell
이 DefaultNodeInfo
인 매개 변수로 TreeViewModel
의 일부입니다.GWT CompositeCell에서 간격을 설정하는 방법은 무엇입니까?
는 기본적으로 CompositeCell
은 다음과 같습니다
Tree item1 [button1]
내가 이것을 달성하는 방법을 잘 모르겠어요 :
Tree item1[button1]
Tree item2[button2]
...
가 지금은 트리 항목과 버튼 사이의 간격을 설정합니다. 어쩌면
CompositeCell
은
setSpacing
방법이 없기 때문에 나에게 맞는 것이 아니겠습니까?
그러나 어쨌든 NodeInfo
을 구성하려면 셀이 필요합니다.
========================================
나를 보자 내 질문을 더 분명하게해라.
내가 가지고있는 Widget
은 CellTree입니다.
cellTree = new CellTree(
new SomeTreeViewModel(), null);
내가 DefaultNodeInfo
을 제공 할 필요가 TreeViewModel
구성하려면 다음 CellTree
을 구성하기 위해 나는 TreeViewModel
제공해야합니다. 다른 단어에서, TreeViewModel
에 다음 메서드를 재정의합니다 :
public <T> NodeInfo<?> getNodeInfo(final T value)
을 구성하려면 DefaultNodeInfo
: 나는 Cell
(결국 내 질문에 온다 ...)
public DefaultNodeInfo(AbstractDataProvider<T> dataProvider, Cell<T> cell)
Cell
은 Widget
이 아니라 인터페이스입니다. 여기
내가 필요 AbstractCell
포함하는 CompositeCell
:
Tree item1
과 ButtonCell
:
[button1]
CompositeCell
는 다음과 같이 표시됩니다
Tree item1[button1]
내가 설정할을 스타일에 전자 나는 그것이 단지 나무의 스타일이 아니라 나무 항목에 영향을주기 때문에 도움이 될 것입니다 CellTree
에 CSS를 적용 생각하지 않는다
Tree item1 [button1]
... : ither ButtonCell
또는 CompositeCell
또는 Cell
는 간격을 추가
ButtonCell
의
render
방법을 재정의하다, 격려 생각하지 않습니다
public void render(final Context context, final SafeHtml data,
final SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<button type=\"button\" tabindex=\"-1\" style=\"margin-left:10px;\">");
if (data != null) {
sb.append(data);
}
sb.appendHtmlConstant("</button>");
}
다른 생각을?
나는 단추 형 전지의 렌더링 메소드를 오버라이드 (override) 할 수있는 해결 방법이 있습니다. 하지만 멋지게 보이지 않습니다 ... – ericbado
왜 CSS를 사용하지 않습니까? –
@AndreiVolgin 그래,하지만 여전히 렌더링을 오버라이드해야하지, 그렇지? 나는 확실하지 않다 ... – ericbado