Chamar tela em menu árvore

0 respostas
swing

Bom dia, criei um menu árvore e não sei como incluir o comando para chamar a tela.
Segue o código do menu e se alguem puder me ajudar a colocar o comando para a iserção da tela agradeço desde já.


package com.agrovale.client.gui;

import com.agrovale.client.util.GerenciadorInternalFrame;

import com.google.gwt.user.client.ui.Tree;

import com.google.gwt.user.client.ui.TreeItem;

import com.google.gwt.user.client.ui.TreeListener;

public class Trees extends Sink implements TreeListener {
GerenciadorInternalFrame gif;

private static class PendingItem extends TreeItem {

public PendingItem() {

super(Please wait…”);

}

}
private static class Proto {

public Proto[] children;

public TreeItem item;

public String text;
public Proto(String text) {
  this.text = text;
}

public Proto(String text, Proto[] children) {
  this(text);
  this.children = children;
}

}

private static Proto[] fProto = new Proto[]{

new Proto(Teste1, new Proto[]{

new Proto(Teste1.1, new Proto[]{

new Proto(Teste1.1.1),

new Proto(Teste1.1.2),

new Proto(Teste1.1.3),

new Proto(Teste1.1.4),}),}),
new Proto("Teste2", new Proto[]{
  new Proto("Teste2.1", new Proto[]{
    new Proto("Teste2.1.1"), new Proto("Parametros"),
    new Proto("Teste2.1.2"),}),
  new Proto("Teste2.2", new Proto[]{
    new Proto("Teste2.2.1"),
    new Proto("Teste2.2.2"),
    new Proto("Teste2.2.3"),}),}),}),};

public static SinkInfo init() {
return new SinkInfo(“Trees”,
"GWT has a built-in Tree widget. "
+ “The tree is focusable and has keyboard support as well.”) {
public Sink createInstance() {
return new Trees();
}
};
}

private Tree fTree = new Tree();

public Trees() {

for (int i = 0; i < fProto.length; ++i) {

createItem(fProto[i]);

fTree.addItem(fProto[i].item);

}
fTree.addTreeListener(this);
initWidget(fTree);

gif = new GerenciadorInternalFrame();
gif.showInternalFrame("Menu", 500, 280, this);

}

public void onShow() {
}

public void onTreeItemSelected(TreeItem item) {
}

public void onTreeItemStateChanged(TreeItem item) {

TreeItem child = item.getChild(0);

if (child instanceof PendingItem) {

item.removeItem(child);
Proto proto = (Proto) item.getUserObject();
  for (int i = 0; i < proto.children.length; ++i) {
    createItem(proto.children[i]);
    item.addItem(proto.children[i].item);
  }
}

}

private void createItem(Proto proto) {

proto.item = new TreeItem(proto.text);

proto.item.setUserObject(proto);

if (proto.children != null)

proto.item.addItem(new PendingItem());

}

}

grata :wink:

Criado 14 de março de 2007
Respostas 0
Participantes 1