private void init() { // widgetListTable=new WidgetList(); // widgetListTable.setRound(true); main = new FlowPanel(); // Window.addResizeHandler(this); header = new HeaderMenu(); lblCenter = new Label(constants.seleccionar()); header.setCenterWidget(lblCenter); btnBack = new PushButton(new Image(MyResource.INSTANCE.getImgBack32())); header.setLeftWidget(btnBack); btnSelect = new PushButton(new Image(MyResource.INSTANCE.getImgSelect32())); header.setRightWidget(btnSelect); main.add(header); toolBar = new ToolBar(); main.add(toolBar); txtBuscar = new MSearchBox(); txtBuscar.setPlaceHolder(constants.buscarCliente()); main.add(txtBuscar); headerGrid = new HeaderGrid(); main.add(headerGrid); headerGridDni = new Label(constants.dni()); headerGrid.add(headerGridDni); headerGridCliente = new Label(constants.clientes()); headerGrid.add(headerGridCliente); container = new FlowPanel(); // main.add(container); scrollPanel = new ScrollPanel(); scrollPanel.setScrollingEnabledY(true); scrollPanel.setScrollingEnabledX(false); scrollPanel.setAutoHandleResize(true); /*scrollPanel.setScrollingEnabledX(false); scrollPanel.setScrollingEnabledY(true); scrollPanel.setAutoHandleResize(true);*/ // scrollPanel.setUsePos(MGWT.getOsDetection().isAndroid()); grid = new GridCliente(); container.add(grid); // widgetListTable.add(container); scrollPanel.setWidget(container); // cargarTabla(); main.add(scrollPanel); Window.addResizeHandler( new ResizeHandler() { @Override public void onResize(ResizeEvent event) { // TODO Auto-generated method stub reCalcularWindows(); } }); initWidget(main); }
@Override public void onClick(ClickEvent event) { // TODO Auto-generated method stub if (event.getSource().equals(toolBar.getBtnNuevo())) { // Window.alert("ok"); goToUICMantCliente(constants.modoNuevo()); } else if (event.getSource().equals(toolBar.getBtnEditar())) { goToUICMantCliente(constants.modoEditar()); } else if (event.getSource().equals(toolBar.getBtnEliminar())) { goToUICMantCliente(constants.modoEliminar()); } else if (event.getSource().equals(toolBar.getBtnActualizar())) { cargarTabla(); } else if (event.getSource().equals(btnBack)) { goToBack(); } else if (event.getSource().equals(btnSelect)) { selecciona(); } }
@Override public void goToUICMantCliente(String modo) { // TODO Auto-generated method stub if (modo.equalsIgnoreCase(constants.modoNuevo())) { uiHomeCliente.getUIMantCliente().setModo(modo); uiHomeCliente.getUIMantCliente().activarCampos(); uiHomeCliente.getContainer().showWidget(1); uiHomeCliente.getUIMantCliente().refreshScroll(); } else if (modo.equalsIgnoreCase(constants.modoEditar())) { ClienteProxy bean = grid.getSelectionModel().getSelectedObject(); // Window.alert(bean.getIdCliente()); if (bean == null) { // Dialogs.alert(constants.alerta(), constants.seleccioneCliente(), null); // Window.alert(constants.seleccioneCliente()); Notification not = new Notification(Notification.ALERT, constants.seleccioneCliente()); not.showPopup(); return; } uiHomeCliente.getUIMantCliente().setModo(modo); uiHomeCliente.getUIMantCliente().setBean(bean); uiHomeCliente.getUIMantCliente().activarCampos(); uiHomeCliente.getContainer().showWidget(1); uiHomeCliente.getUIMantCliente().refreshScroll(); } else if (modo.equalsIgnoreCase(constants.modoEliminar())) { ClienteProxy bean = grid.getSelectionModel().getSelectedObject(); // Window.alert(bean.getIdCliente()); if (bean == null) { // Dialogs.alert(constants.alerta(),constants.seleccioneCliente(), null); // Window.alert(constants.seleccioneCliente()); Notification not = new Notification(Notification.ALERT, constants.seleccioneCliente()); not.showPopup(); return; } uiHomeCliente.getUIMantCliente().setModo(modo); uiHomeCliente.getUIMantCliente().setBean(bean); uiHomeCliente.getUIMantCliente().activarCampos(); uiHomeCliente.getContainer().showWidget(1); uiHomeCliente.getUIMantCliente().refreshScroll(); } }
@Override public void selecciona() { // TODO Auto-generated method stub ClienteProxy bean = grid.getSelectionModel().getSelectedObject(); if (bean != null) { uiHomePrestamo.getHeader().getLblTitulo().setText("DEVOL"); uiHomePrestamo.getHeader().setVisibleBtnMenu(true); uiHomePrestamo.getUIMantPrestamoImpl().setBeanCliente(bean); uiHomePrestamo.getContainer().showWidget(1); } else { // Dialogs.alert(constants.alerta(), constants.seleccioneCliente(), null); // Window.alert(constants.seleccioneCliente()); Notification not = new Notification(Notification.ALERT, constants.seleccioneCliente()); not.showPopup(); } }