예제 #1
0
  public void onModuleLoad() {

    topTabSet = new TabSet();
    topTabSet.setTabBarPosition(Side.TOP);
    topTabSet.setWidth(1024);
    topTabSet.setHeight(768);
    topTabSet.setTabBarThickness(50);

    Tab tTab1 = new Tab("Menu", "assets/mainMenu.png");
    Img tImg1 = new Img("pieces/48/pawn_blue.png", 96, 96);

    topTabSet.addTab(tTab1);

    Tab lTab1 = new Tab();
    lTab1.setIcon("pieces/16/pawn_blue.png", 16);
    Img lImg1 = new Img("pieces/48/pawn_blue.png", 48, 48);
    lTab1.setPane(lImg1);

    HLayout buttons = new HLayout();
    buttons.setMembersMargin(15);

    VLayout vLayout = new VLayout();
    vLayout.setMembersMargin(15);
    vLayout.addMember(topTabSet);
    vLayout.addMember(buttons);
    // vLayout.addMember(leftTabSet);
    vLayout.setHeight("*");

    vLayout.draw();

    final HLayout hLayout = new HLayout();
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setLayoutMargin(20);

    // tree menu
    TreeGrid tree = new TreeGrid();
    tree.setShowConnectors(true);
    tree.setShowResizeBar(true);

    Tree dataTree = new Tree();
    dataTree.setModelType(TreeModelType.CHILDREN);
    dataTree.setRoot(
        new TreeNode(
            "root",
            new TreeNode("Aluno"),
            new TreeNode("Funcionario"),
            new TreeNode("Contato"),
            new TreeNode("Veiculo"),
            new TreeNode("Disciplina")));

    tree.setData(dataTree);

    TreeGridField fieldTree = new TreeGridField("Navegacao");
    fieldTree.setCellFormatter(
        new CellFormatter() {
          public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
            return record.getAttribute("name");
          }
        });
    tree.setFields(fieldTree);

    // layout esquerda
    SectionStack leftSideLayout = new SectionStack();
    leftSideLayout.setWidth(200);
    leftSideLayout.setShowResizeBar(true);
    leftSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    leftSideLayout.setAnimateSections(true);

    leftSideLayout.setMembers(tree);

    // UIs
    final AlunoUI alunoUI = new AlunoUI();
    final FuncionarioUI funcionarioUI = new FuncionarioUI();
    final ContatoUI contatoUI = new ContatoUI();
    final VeiculoUI veiculoUI = new VeiculoUI();
    final DisciplinaUI disciplinaUI = new DisciplinaUI();

    // layout direita
    final SectionStack rightSideLayout = new SectionStack();
    rightSideLayout.setVisibilityMode(VisibilityMode.MULTIPLE);
    rightSideLayout.setAnimateSections(true);

    grid = alunoUI.getGrid();
    formBotoes = alunoUI.getFormBotoes();
    menuItens = new DynamicForm();
    menuItens.setWidth(100);
    menuItens.setAlign(Alignment.RIGHT);

    ButtonItem aluno = new ButtonItem("Aluno");
    aluno.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomAluno("Aluno");
          }
        });

    ButtonItem disc = new ButtonItem("Disciplina");
    disc.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomDisciplina("Disciplina");
          }
        });

    ButtonItem curso = new ButtonItem("Curso");
    curso.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomCurso("Curso");
          }
        });

    ButtonItem matric = new ButtonItem("Matricula");
    matric.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            newTabCustomMatricula("Matricula");
          }
        });

    menuItens.setFields(aluno, disc, curso, matric);

    rightSideLayout.setMembers(menuItens);
    rightSideLayout.setWidth(200);
    // seleciona tree
    tree.addNodeClickHandler(
        new NodeClickHandler() {
          public void onNodeClick(NodeClickEvent event) {
            String node = event.getNode().getAttribute("name");
            if (node.equals("Aluno")) {
              // rightSideLayout.removeMembers(formBotoes,grid);
              // Tab tab = new Tab(node);
              newTabCustomAluno(node);
            } else {
              if (node.equals("Disciplina")) {
                newTabCustomDisciplina(node);
              } else {
                if (node.equals("Curso")) {
                  //	newTabCustom(node);
                } else {
                  if (node.equals("Matricula")) {
                    //	newTabCustom(node);
                  } else {
                    if (node.equals("Disciplina")) {
                      rightSideLayout.removeMembers(formBotoes, grid);
                      grid = disciplinaUI.getGrid();
                      formBotoes = disciplinaUI.getFormBotoes();
                      rightSideLayout.setMembers(formBotoes, grid);
                    }
                  }
                }
              }
            }
          }
        });

    // hLayout

    hLayout.addMember(leftSideLayout);
    hLayout.addMember(rightSideLayout);
    hLayout.draw();

    tTab1.setPane(hLayout);
  }
예제 #2
0
  /** This is the entry point method. */
  public void onModuleLoad() {

    final HelpCanvas help1 = new HelpCanvas("help1");
    final HelpCanvas help2 = new HelpCanvas("help2");

    HLayout layout = new HLayout();
    layout.setMembersMargin(20);

    final SectionStack sectionStack = new SectionStack();
    sectionStack.setVisibilityMode(VisibilityMode.MUTEX);
    sectionStack.setWidth(800);
    sectionStack.setHeight(600);

    SectionStackSection section1 = new SectionStackSection("Settings for Stream Recorder");
    section1.setExpanded(true);
    section1.setResizeable(false);

    // VLayout layout = new VLayout(25);

    layout.setAlign(Alignment.CENTER);
    layout.setMargin(23);
    layout.setWidth("93%");

    final DataSource dataSource = SettingsDS.getInstance();

    final DynamicForm form = new DynamicForm();
    form.setIsGroup(true);
    form.setGroupTitle("Update");
    form.setNumCols(4);
    form.setDataSource(dataSource);
    form.setMargin(1);

    final ListGrid listGrid = new ListGrid();
    listGrid.setWidth100();
    listGrid.setHeight(130);
    listGrid.setDataSource(dataSource);
    listGrid.setAutoFetchData(true);
    listGrid.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            form.reset();
            form.editSelectedData(listGrid);
          }
        });

    section1.addItem(listGrid);
    section1.addItem(form);

    IButton butt = new IButton("Save");
    butt.setMargin(2);

    butt.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            form.saveData();
          }
        });
    section1.addItem(butt);

    Button button = new Button("Hello from Admin");
    button.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            Services.getHelloService()
                .hello(
                    "Admin",
                    new AsyncCallback<Void>() {

                      @Override
                      public void onFailure(Throwable caught) {
                        // TODO Auto-generated method stub

                      }

                      @Override
                      public void onSuccess(Void result) {
                        // TODO Auto-generated method stub

                      }
                    });
          }
        });

    sectionStack.addSection(section1);

    SectionStackSection section2 = new SectionStackSection("Help 1");
    section2.setExpanded(true);
    section2.setCanCollapse(true);

    section2.addItem(help1);
    sectionStack.addSection(section2);
    // SectionStackSection section3 = new SectionStackSection("Help 2");
    // section3.setExpanded(true);
    // section3.setCanCollapse(true);
    // section3.addItem(help2);
    // sectionStack.addSection(section3);

    // IButton resizeButton = new IButton("Resize Help 1");
    // resizeButton.setWidth(150);
    // resizeButton.addClickHandler(new ClickHandler() {
    // public void onClick(ClickEvent event) {
    // help1.setHeight(200);
    // }
    // });

    layout.addMember(sectionStack);

    // VLayout buttons = new VLayout(25);
    // buttons.setMembersMargin(10);
    // buttons.addMember(resizeButton);

    // layout.addMember(buttons);

    layout.addMember(button);
    layout.draw();

    // RootPanel.get().add(topTabSet);
  }