/** * This is a static utility method that is package protected so the message center view and the * message bar can pop up a dialog showing a message's details. * * @param message the message whose details are to be shown */ static void showDetails(Message message) { if (message == null) { return; } DynamicForm form = new LocatableDynamicForm("MessageCenterDetailsForm"); form.setWrapItemTitles(false); form.setAlign(Alignment.LEFT); StaticTextItem title = new StaticTextItem("theMessage", MSG.common_title_message()); title.setValue(message.conciseMessage); StaticTextItem severity = new StaticTextItem("severity", MSG.view_messageCenter_messageSeverity()); FormItemIcon severityIcon = new FormItemIcon(); severityIcon.setSrc(getSeverityIcon(message.severity)); severity.setIcons(severityIcon); severity.setValue(message.severity.name()); StaticTextItem date = new StaticTextItem("time", MSG.view_messageCenter_messageTime()); date.setValue( TimestampCellFormatter.format(message.fired, TimestampCellFormatter.DATE_TIME_FORMAT_FULL)); StaticTextItem detail = new StaticTextItem("detail", MSG.view_messageCenter_messageDetail()); detail.setTitleVAlign(VerticalAlignment.TOP); detail.setValue(message.detailedMessage); form.setItems(title, severity, date, detail); final Window dialogWin = new LocatableWindow("MessageCenterDetailsWindow"); dialogWin.setTitle(MSG.common_title_message()); dialogWin.setWidth(600); dialogWin.setHeight(400); dialogWin.setIsModal(true); dialogWin.setShowModalMask(true); dialogWin.setCanDragResize(true); dialogWin.setShowMaximizeButton(true); dialogWin.setShowMinimizeButton(false); dialogWin.centerInPage(); dialogWin.addItem(form); dialogWin.show(); dialogWin.addCloseClickHandler( new CloseClickHandler() { @Override public void onCloseClick(CloseClientEvent event) { dialogWin.destroy(); } }); }
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); }
private HLayout createSearchLayout() { HLayout searchLayout = new HLayout(); searchLayout.setWidth100(); searchLayout.setHeight(20); searchLayout.setMembersMargin(15); i_searchForm = new DynamicForm(); i_searchForm.setWidth(250); i_searchForm.setHeight100(); i_searchForm.setAlign(Alignment.LEFT); i_searchForm.setAutoFocus(true); i_searchTextItem = new TextItem(); i_searchTextItem.setTitle("Search"); i_searchTextItem.setWidth(200); i_searchTextItem.setHint(SEARCH_HINT); i_searchTextItem.setShowHintInField(true); i_searchTextItem.setCanFocus(true); i_searchTextItem.setSelectOnFocus(true); i_searchTextItem.addKeyUpHandler( new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { event.getKeyName(); // ignore the arrow keys if (isValidSearchText()) { i_searchListGrid.getData(i_searchTextItem.getValueAsString()); i_addButton.setDisabled(true); } } }); i_searchForm.setFields(i_searchTextItem); // add button to a Vlayout so we can position it correctly with the form // search text. VLayout buttonVlayout = new VLayout(); buttonVlayout.setWidth(40); buttonVlayout.setAlign(VerticalAlignment.CENTER); buttonVlayout.setMargin(2); i_clearButton = new IButton(CLEAR_BUTTON_TITLE); i_clearButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { i_searchTextItem.setValue(""); i_rowsRetrievedLabel.setContents(""); i_searchListGrid.clearData(); i_addButton.setDisabled(true); } }); buttonVlayout.addMember(i_clearButton); // add Label to a Vlayout so we can position it correctly with the form // search text. VLayout labelVlayout = new VLayout(); labelVlayout.setWidth(100); labelVlayout.setAlign(VerticalAlignment.BOTTOM); labelVlayout.setMargin(2); i_rowsRetrievedLabel = new Label(); i_rowsRetrievedLabel.setWrap(false); i_rowsRetrievedLabel.setWidth100(); i_rowsRetrievedLabel.setHeight(23); labelVlayout.addMember(i_rowsRetrievedLabel); searchLayout.addMember(i_searchForm); searchLayout.addMember(buttonVlayout); searchLayout.addMember(labelVlayout); return searchLayout; }