private Label buildSecondaryMenuOption(final String title, boolean selected) { Label tmp = new Label(title); tmp.setTitle(title); tmp.setWrap(false); tmp.setValign(VerticalAlignment.BOTTOM); tmp.setAlign(Alignment.CENTER); tmp.setPadding(10); tmp.setShowRollOver(true); tmp.setCursor(Cursor.POINTER); String style; if (selected) { style = "secondaryMenuText-selected"; selectedSecondaryMenuOption = tmp; } else { style = "secondaryMenuText"; } tmp.setBaseStyle(style); tmp.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { Object o = event.getSource(); if (o instanceof Label) { Label lbl = (Label) o; if (!lbl.getTitle().equals(selectedSecondaryMenuOption.getTitle())) { selectedSecondaryMenuOption.setBaseStyle("secondaryMenuText"); lbl.setBaseStyle("secondaryMenuText-selected"); selectedSecondaryMenuOption = lbl; BLCMain.setCurrentPageKey(lbl.getTitle()); buildHistoryNewItem( lbl.getTitle(), BLCLaunch.getSelectedModule(History.getToken()), null); } } } }); return tmp; }
private VLayout createDisplayLabel() { String message = "Search for value sets. Select the value sets by checking the checkbox and then click Add to add them."; i_label = new Label("<b>" + message + "<b>"); i_label.setWidth100(); i_label.setHeight(30); i_label.setMargin(2); i_label.setValign(VerticalAlignment.CENTER); i_label.setBackgroundColor(BACKGROUND_COLOR); final VLayout vLayoutLayoutSpacers = new VLayout(); vLayoutLayoutSpacers.setWidth100(); vLayoutLayoutSpacers.setHeight(30); vLayoutLayoutSpacers.setBackgroundColor(BACKGROUND_COLOR); vLayoutLayoutSpacers.setLayoutMargin(6); vLayoutLayoutSpacers.setMembersMargin(6); vLayoutLayoutSpacers.addMember(i_label); return vLayoutLayoutSpacers; }
private Label buildPrimaryMenuOption(final Module module, boolean selected) { Label tmp = new Label(module.getModuleTitle()); tmp.setValign(VerticalAlignment.CENTER); tmp.setHeight(30); tmp.setAlign(Alignment.CENTER); tmp.setWrap(false); tmp.setPadding(0); tmp.setShowRollOver(true); tmp.setCursor(Cursor.POINTER); final String style; if (selected) { style = "primaryMenuText-selected"; } else { style = "primaryMenuText"; } tmp.setBaseStyle(style); tmp.addClickHandler( new ClickHandler() { @Override public void onClick(final ClickEvent event) { Object o = event.getSource(); if (o instanceof Label) { final Label lbl = (Label) o; if (!"primaryMenuText-selected".equals(lbl.getBaseStyle())) { selectPrimaryMenu(module.getModuleKey()); lbl.setBaseStyle("primaryMenuText-selected"); BLCMain.setCurrentModuleKey(module.getModuleKey()); buildSecondaryMenu(null, module.getModuleKey()); AppController.getInstance() .go(canvas, module.getPages(), null, module.getModuleKey(), false); } } } }); return tmp; }
public Canvas getViewPanel() { Label label = new Label( "Staging: <span style=\"color: green; font-weight: bold;\">Normal</span><br/>" + "Production: <span style=\"color: green; font-weight: bold;\">Normal</span><br/>" + "Development: <span style=\"color: green; font-weight: bold;\">Normal</span>"); label.setHeight100(); label.setPadding(5); label.setValign(VerticalAlignment.TOP); Window window = new Window(); window.setTitle("Minimizing a window"); window.setWidth(300); window.setHeight(85); window.setCanDragResize(true); window.addItem(label); Canvas canvasMain = new Canvas(); canvasMain.addChild(window); return canvasMain; }
public CargaProductoCompra(CompraDetalle compradetalle, final Sgc_capa_web mainWindow) { VLayout layout = new VLayout(10); final DynamicForm form = new DynamicForm(); form.setBackgroundColor("#006633"); form.setBorder("2px"); form.setAutoFocus(true); form.setNumCols(3); form.setWidth(500); Label label = new Label(); label.setBackgroundColor("#99ffcc"); label.setHeight(30); label.setWidth(500); label.setPadding(10); label.setAlign(Alignment.CENTER); label.setValign(VerticalAlignment.CENTER); label.setWrap(false); label.setShowEdges(true); label.setContents( "<div style='color:black;font-size:15'><b>Carga de Productos de la Compra</b></div>"); TextItem codigoText = new TextItem("codigo"); codigoText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); codigoText.setTitle("Codigo"); codigoText.setDisabled(true); codigoText.setWrapTitle(false); final TextItem productoText = new TextItem("producto"); productoText.setTitle("Producto"); productoText.setDefaultValue(new Date()); productoText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); productoText.setWrapTitle(false); final TextItem cantidadText = new TextItem("cantidad"); cantidadText.setTitle("Cantidad"); cantidadText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); cantidadText.setWrapTitle(false); final TextItem preciocompraText = new TextItem("preciocompra"); preciocompraText.setTitle("Precio"); preciocompraText.setTitleStyle("{font-color:white;font-weigh:bold;font-size:14}"); preciocompraText.setWrapTitle(false); ButtonItem button = new ButtonItem("save", "Aceptar"); button.setStartRow(false); button.setWidth(80); button.setIcon("approve.png"); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { CompraDetalleServiceAsync service = GWT.create(CompraDetalleService.class); ServiceDefTarget serviceDef = (ServiceDefTarget) service; serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "compradetalleService"); CompraDetalle compradetalle = new CompraDetalle(); compradetalle.setId_producto(Integer.parseInt(form.getValueAsString("producto"))); compradetalle.setCantidad(Integer.parseInt(form.getValueAsString("cantidad"))); compradetalle.setPrecioCompra( Double.parseDouble(form.getValueAsString("preciocompra"))); // compra.setTotalCompra(Integer.parseInt("15000")); if (form.getValueAsString("codigo") != null) { compradetalle.setIdCompDet(Integer.valueOf(form.getValueAsString("codigo"))); } try { service.guardar( compradetalle, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert( "Ocurrio un error: " + caught.getClass().getName() + " " + caught.getMessage()); } @Override public void onSuccess(Void result) { new CargaProductoCompra(mainWindow); } }); } catch (Exception e) { e.printStackTrace(); } } }); if (compradetalle != null) { codigoText.setDefaultValue(String.valueOf(compradetalle.getIdCompDet())); productoText.setDefaultValue(compradetalle.getId_producto()); cantidadText.setDefaultValue(compradetalle.getCantidad()); preciocompraText.setDefaultValue(((Object) compradetalle.getPrecioCompra()).toString()); } form.setFields(codigoText, productoText, cantidadText, preciocompraText, button); layout.addMember(label); layout.addMember(form); mainWindow.showDialog(layout); }
public ListaVentas(final Sgc_capa_web mainWindow) { String PATH_IMG = "/sgc_capa_web/images/"; VLayout layout = new VLayout(10); layout.setBackgroundColor("#006633"); final ListGrid facturaGrid = new ListGrid(); facturaGrid.setWidth(500); facturaGrid.setHeight(224); facturaGrid.setShowAllRecords(true); facturaGrid.setAlternateRecordStyles(true); facturaGrid.setShowEdges(true); facturaGrid.setBorder("0px"); facturaGrid.setBodyStyleName("normal"); facturaGrid.setLeaveScrollbarGap(false); facturaGrid.setBackgroundColor("#99ffcc"); /*-Buscar ------------------------------*/ DynamicForm buscarFields = new DynamicForm(); // buscarFields.setBackgroundColor("#99ffcc"); buscarFields.setItemLayout(FormLayoutType.ABSOLUTE); final TextItem codigoText = new TextItem("codigo"); codigoText.setWrapTitle(false); codigoText.setLeft(10); codigoText.setWidth(43); codigoText.addKeyPressHandler( new KeyPressHandler() { public void onKeyPress(KeyPressEvent event) { if ("Enter".equals(event.getKeyName())) { /* buscar por el campo correspondiente */ if (codigoText.getValue() != null) { Factura factura = new Factura(); factura.setId(Integer.parseInt(codigoText.getValue().toString())); listar(facturaGrid, factura, "codigo"); } } } }); ButtonItem buscarButton = new ButtonItem("find", ""); buscarButton.setIcon("view.png"); buscarButton.setWidth(50); buscarButton.setLeft(443); buscarButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { /* buscar por el campo correspondiente */ Factura factura = new Factura(); if (codigoText.getValue() != null) factura.setId(Integer.parseInt(codigoText.getValue().toString())); /*if(nombreusuarioText.getValue() != null) cliente.setNombreusuario(nombreusuarioText.getValue().toString());*/ listar(facturaGrid, factura, "nombre"); } }); buscarFields.setFields(codigoText, buscarButton); /*--------------------------------------*/ ListGridField codigoField = new ListGridField("codigo", "Codigo"); ListGridField fechaField = new ListGridField("fecha", "Fecha"); ListGridField numeroField = new ListGridField("numero", "Numero"); ListGridField pendienteField = new ListGridField("pendiente", "Pendiente"); ListGridField saldoField = new ListGridField("saldo", "Saldo"); ListGridField editarField = new ListGridField("edit", "Editar"); ListGridField borrarField = new ListGridField("remove", "Borrar"); codigoField.setAlign(Alignment.CENTER); editarField.setAlign(Alignment.CENTER); borrarField.setAlign(Alignment.CENTER); editarField.setType(ListGridFieldType.IMAGE); borrarField.setType(ListGridFieldType.IMAGE); editarField.setImageURLPrefix(PATH_IMG); borrarField.setImageURLPrefix(PATH_IMG); editarField.setImageURLSuffix(".png"); borrarField.setImageURLSuffix(".png"); facturaGrid.addCellClickHandler( new CellClickHandler() { @Override public void onCellClick(CellClickEvent event) { ListGridRecord record = event.getRecord(); int col = event.getColNum(); if (col > 4) { Factura factura = new Factura(); factura.setId(record.getAttributeAsInt("codigo")); factura.setFecha(record.getAttributeAsDate("fecha")); factura.setNumero(Integer.parseInt(record.getAttribute("numero"))); factura.setPendiente(record.getAttribute("pendiente")); factura.setSaldo(Double.parseDouble(record.getAttribute("saldo"))); if (col == 5) { /* Editar */ new VentaDetalle(factura, mainWindow); } else { /* Borrar */ FacturaServiceAsync service = GWT.create(FacturaService.class); ServiceDefTarget serviceDef = (ServiceDefTarget) service; serviceDef.setServiceEntryPoint(GWT.getModuleBaseURL() + "facturaService"); try { service.eliminar( record.getAttributeAsInt("codigo"), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Window.alert( "Ocurrio un error y no se puedo eliminar (objeto referenciado)"); // " // + // caught.getClass().getName() + " " + caught.getMessage()) ; } @Override public void onSuccess(Void result) { new ListaVentas(mainWindow); } }); } catch (NumberFormatException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } } }); codigoField.setWidth(50); fechaField.setWidth(180); numeroField.setWidth(50); pendienteField.setWidth(50); saldoField.setWidth(50); facturaGrid.setFields( codigoField, fechaField, numeroField, pendienteField, saldoField, editarField, borrarField); facturaGrid.setCanResizeFields(true); ButtonItem button = new ButtonItem("add", "Agregar"); button.setStartRow(false); button.setWidth(80); button.setIcon("add.png"); button.setAlign(Alignment.CENTER); button.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { new VentaDetalle(mainWindow); } }); listar(facturaGrid, new Factura(), "nombre"); Label label = new Label(); label.setBackgroundColor("#99ffcc"); label.setHeight(30); label.setWidth(500); label.setPadding(10); label.setAlign(Alignment.CENTER); label.setValign(VerticalAlignment.CENTER); label.setWrap(false); label.setShowEdges(true); label.setContents("<div style='color:black;font-size:15'><b>Lista de Ventas</b></div>"); layout.addMember(label); layout.addMember(buscarFields); layout.addMember(facturaGrid); DynamicForm form = new DynamicForm(); // form.setBackgroundColor("#99ffcc"); form.setWidth(300); form.setItems(button); layout.addMember(form); mainWindow.showDialog(layout); }
public ItemRemoveModalPanel( String title, String itemsString, final ListModel model, ObjectNameResolver nameResolver, final GridController gridController) { super(panelWidth, panelHeight, title); this.model = model; VLayout inPanel = new VLayout(); inPanel.setHeight100(); inPanel.setWidth100(); Label message = new Label("Are you sure you want to remove the following " + itemsString + "?"); message.setStyleName("removePanelLabel"); message.setAutoHeight(); inPanel.addMember(message); for (Object item : model.getSelectedItems()) { Label l = new Label("- " + nameResolver.getItemName(item)); l.setStyleName("removePanelItems"); l.setAutoHeight(); l.setValign(VerticalAlignment.TOP); inPanel.addMember(l); } model .getPropertyChangedEvent() .addListener( new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { String propertyName = ((PropertyChangedEventArgs) args).PropertyName; GWT.log("DERBA: " + propertyName); if (propertyName.equals("Window") || propertyName.equals("ConfirmationModel")) { destroy(); model.getPropertyChangedEvent().removeListener(this); if (gridController != null) gridController.gridChangePerformed(); } } }); Button okButton = new Button("OK"); okButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { model.ExecuteCommand(new UICommand("OnRemove", model)); } }); Button cancelButton = new Button("Cancel"); cancelButton.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { onClose(); } }); setFooterButtons(Alignment.RIGHT, okButton, cancelButton); addItem(inPanel); }
public RepositoryNameView(final Console console) { super(); setStyleName("repository"); setLayoutAlign(Alignment.CENTER); setLayoutAlign(VerticalAlignment.CENTER); setDefaultLayoutAlign(Alignment.CENTER); setDefaultLayoutAlign(VerticalAlignment.CENTER); setHeight(55); setWidth100(); Img logo = new Img(); logo.setSrc("icons/attach.png"); logo.setHeight(55); logo.setWidth(45); logo.setValign(VerticalAlignment.CENTER); HLayout panel0 = new HLayout(); HLayout panel1 = new HLayout(); panel1.setLayoutAlign(Alignment.RIGHT); panel1.setDefaultLayoutAlign(Alignment.RIGHT); panel1.setAlign(Alignment.RIGHT); HLayout panel = new HLayout(); // panel.setAlign(Alignment.LEFT); panel.setLayoutAlign(VerticalAlignment.CENTER); panel.setDefaultLayoutAlign(VerticalAlignment.CENTER); label.setStyleName("repository-caption"); label.setWidth("100%"); label.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { console.showRepositories(); } }); label.setBorder("1 px solid black"); label.setValign(VerticalAlignment.CENTER); Label explore = new Label("<b>Explore</b>"); explore.setAlign(Alignment.RIGHT); explore.setBorder("1ps solid green"); explore.setAutoFit(true); explore.setStyleName("tab-label"); explore.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { console.showContent(); } }); Label nodeTypes = new Label("<b>NodeTypes</b>"); nodeTypes.setAlign(Alignment.RIGHT); nodeTypes.setAutoFit(true); nodeTypes.setStyleName("tab-label"); nodeTypes.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { console.showNodeTypes(); } }); Label descriptor = new Label("<b>Descriptor</b>"); descriptor.setAlign(Alignment.RIGHT); descriptor.setAutoFit(true); descriptor.setStyleName("tab-label"); descriptor.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { console.showRepositoryInfo(); } }); Label query = new Label("<b>Query</b>"); query.setAlign(Alignment.RIGHT); query.setAutoFit(true); query.setStyleName("tab-label"); query.addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { console.showQuery(); } }); panel.addMember(logo); panel.addMember(label); panel1.addMember(explore); panel1.addMember(new Spacer(10)); panel1.addMember(nodeTypes); panel1.addMember(new Spacer(10)); panel1.addMember(descriptor); panel1.addMember(new Spacer(10)); panel1.addMember(query); panel1.setHeight(55); panel0.setWidth("70%"); panel0.setHeight(55); panel0.addMember(panel); panel0.addMember(panel1); addMember(new Strut(10)); addMember(panel0); addMember(new Strut(10)); setVisible(false); }