public Canvas getViewPanel() { final TabSet topTabSet = new TabSet(); topTabSet.setTabBarPosition(Side.TOP); topTabSet.setTabBarAlign(Side.LEFT); topTabSet.setWidth(400); topTabSet.setHeight(200); Tab tTab1 = new Tab("Blue", "pieces/16/pawn_blue.png"); tTab1.setCanClose(true); Img tImg1 = new Img("pieces/48/pawn_blue.png", 48, 48); tTab1.setPane(tImg1); Tab tTab2 = new Tab("Green", "pieces/16/pawn_green.png"); Img tImg2 = new Img("pieces/48/pawn_green.png", 48, 48); tTab2.setPane(tImg2); topTabSet.addTab(tTab1); topTabSet.addTab(tTab2); HLayout buttons = new HLayout(); buttons.setMembersMargin(15); IButton addButton = new IButton("Add Tab"); addButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { String title = topTabSet.getTabs().length % 2 == 0 ? "Yellow" : "Green"; String iconType = topTabSet.getTabs().length % 2 == 0 ? "pawn" : "cube"; Tab tTab = new Tab(title, "pieces/16/" + iconType + "_" + title.toLowerCase() + ".png"); tTab.setCanClose(true); Img tImg = new Img("pieces/48/" + iconType + "_" + title.toLowerCase() + ".png", 48, 48); tTab.setPane(tImg); topTabSet.addTab(tTab); } }); IButton removeButton = new IButton("Remove Tab"); removeButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { topTabSet.removeTab(topTabSet.getTabs().length - 1); } }); buttons.addMember(addButton); buttons.addMember(removeButton); VLayout vLayout = new VLayout(); vLayout.setMembersMargin(15); vLayout.addMember(topTabSet); vLayout.addMember(buttons); vLayout.setHeight("auto"); return vLayout; }
public Canvas getViewPanel() { final TabSet tabSet = new TabSet(); tabSet.setTabBarPosition(Side.TOP); // required so that the select item doesnt touch the tab pane tabSet.setTabBarThickness(25); tabSet.setTabBarAlign(Side.LEFT); tabSet.setWidth(400); tabSet.setHeight(200); final Tab statusTab = new Tab("Status"); final Canvas statusPane = new Canvas(); statusTab.setPane(statusPane); tabSet.addTab(statusTab); SelectItem selectItem = new SelectItem(); selectItem.setValueMap("Development", "Staging", "Production"); selectItem.setShowTitle(false); selectItem.setDefaultValue("Development"); selectItem.addChangeHandler( new ChangeHandler() { public void onChange(ChangeEvent event) { statusPane.setContents( event.getValue() + ": <span style='color:green;font-weight:bold'>Normal</span><br>"); } }); DynamicForm form = new DynamicForm(); // form.setHeight(1); form.setPadding(0); form.setMargin(0); form.setCellPadding(1); form.setNumCols(1); form.setFields(selectItem); tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form); return tabSet; }
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); }
public void onModuleLoad() { /* * SmartGWT components */ topTabSet.setTabBarPosition(Side.TOP); topTabSet.setTabBarAlign(Side.LEFT); topTabSet.setHeight100(); topTabSet.setWidth100(); topTabSet.addTab(loadTab); topTabSet.addTab(editTab); topTabSet.addTab(errorTab); topTabSet.setTabBarControls( TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, suggestCanvasItem, confirmFactorValues, exportIDFButton, exportSDRFButton, revalidateButton); RootPanel.get("contentsarea").add(topTabSet); /* * Buttons */ // Confirm Factor Values confirmFactorValues.setWidth(150); confirmFactorValues.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { guiMediator.showIDFFactorValue_ValidatorWindow(); } }); // Export SDRF exportSDRFButton.setIcon("[SKIN]actions/download.png"); exportSDRFButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!guiMediator.getCurrentSDRFTitle().equals("null")) { logger.log(Level.INFO, "Export SDRF Button was pressed"); fileService.writeFile( guiMediator.getCurrentSDRFTitle(), guiMediator.getSDRFAsString(), new FileServiceCallback(guiMediator.getCurrentSDRFTitle())); } } }); // Export IDF exportIDFButton.setIcon("[SKIN]actions/download.png"); exportIDFButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!guiMediator.getCurrentIDFTitle().equals("null")) { logger.log(Level.INFO, "Export IDF Button was pressed"); fileService.writeFile( guiMediator.getCurrentIDFTitle(), guiMediator.getIDFAsString(), new FileServiceCallback(guiMediator.getCurrentIDFTitle())); } } }); // Revalidate Button revalidateButton.addClickHandler( new ClickHandler() { public void onClick(ClickEvent event) { if (!guiMediator.getCurrentSDRFTitle().equals("null") && !guiMediator.getCurrentIDFTitle().equals("null")) { validationService.validate( guiMediator.getCurrentIDFTitle(), guiMediator.getIDFAsString(), guiMediator.getCurrentSDRFTitle(), guiMediator.getSDRFAsString(), new ValidationServiceCallback(guiMediator)); } } }); // ***************************** // Layout // ***************************** TagCloudWindow tagCloudWindow = new TagCloudWindow(guiMediator); tagCloudWindow.show(); tagCloudWindow.moveTo(250, 85); // tagCloudWindow.moveAbove(canvas) // mainLayout.setHtmlElement(DOM.getElementById("webapp")); // mainLayout.show(); // topTabSet.setHtmlElement(DOM.getElementById("webapp")); Window.addWindowClosingHandler( new Window.ClosingHandler() { public void onWindowClosing(Window.ClosingEvent closingEvent) { closingEvent.setMessage("Do you really want to leave the page?"); } }); }