private void jbInit() throws Exception { hierarTreePanel.setEnabled(false); warehousePanel.setLayout(borderLayout1); warehouseForm.setVOClassName("org.jallinone.warehouse.java.WarehouseVO"); this.setTitle(ClientSettings.getInstance().getResources().getResource("warehouse detail")); buttonsPanel.setLayout(flowLayout1); flowLayout1.setAlignment(FlowLayout.LEFT); insertButton.setText("insertButton1"); reloadButton.setText("reloadButton1"); deleteButton.setText("deleteButton1"); warehouseForm.setInsertButton(insertButton); warehouseForm.setCopyButton(copyButton); warehouseForm.setEditButton(editButton); warehouseForm.setReloadButton(reloadButton); warehouseForm.setDeleteButton(deleteButton); warehouseForm.setSaveButton(saveButton); warehouseForm.setFunctionId("WAR01"); warehouseForm.setLayout(gridBagLayout1); controlZip.setAttributeName("zipWAR01"); controlZip.setCanCopy(true); controlZip.setLinkLabel(labelZip); controlZip.setMaxCharacters(20); controlProv.setAttributeName("provinceWAR01"); controlProv.setCanCopy(true); controlProv.setLinkLabel(labelProv); controlProv.setMaxCharacters(20); controlProv.setTrimText(true); controlProv.setUpperCase(true); controlCity.setAttributeName("cityWAR01"); controlCity.setCanCopy(true); controlCity.setLinkLabel(labelCity); controlAddress.setAttributeName("addressWAR01"); controlAddress.setCanCopy(true); controlAddress.setLinkLabel(labelAddress); labelAddress.setText("address"); controlCountry.setAttributeName("countryWAR01"); controlCountry.setCanCopy(true); controlCountry.setLinkLabel(labelCountry); controlCountry.setMaxCharacters(20); controlCountry.setTrimText(true); controlCountry.setUpperCase(true); labelZip.setText("zip"); labelCity.setText("city"); labelCountry.setText("country"); labelProv.setText("prov"); controlWarCode.setAttributeName("warehouseCodeWAR01"); controlWarCode.setLinkLabel(labelWarCode); controlWarCode.setMaxCharacters(20); controlWarCode.setRequired(true); controlWarCode.setRpadding(false); controlWarCode.setTrimText(true); controlWarCode.setUpperCase(true); controlWarCode.setEnabledOnEdit(false); labelWarCode.setText("warehouseCodeWAR01"); labelDescr.setText("descriptionWAR01"); controlDescr.setAttributeName("descriptionWAR01"); controlDescr.setLinkLabel(labelDescr); controlDescr.setRequired(true); labelCompanyCode.setText("companyCodeSys01WAR01"); controlCompaniesCombo.setAttributeName("companyCodeSys01WAR01"); controlCompaniesCombo.setCanCopy(true); controlCompaniesCombo.setLinkLabel(labelCompanyCode); controlCompaniesCombo.setRequired(true); controlCompaniesCombo.setEnabledOnEdit(false); labelRoles.setText("edit/delete warehouse role"); controlRoles.setAttributeName("progressiveSys04WAR01"); controlRoles.setDomainId("USERROLES"); controlRoles.setLinkLabel(labelRoles); locationsPanel.setLayout(borderLayout2); tabbedPane.add(warehousePanel, "warehousePanel"); this.getContentPane().add(buttonsPanel, BorderLayout.NORTH); this.getContentPane().add(tabbedPane, BorderLayout.CENTER); warehouseForm.add( labelZip, new GridBagConstraints( 3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelCity, new GridBagConstraints( 0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelAddress, new GridBagConstraints( 0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlAddress, new GridBagConstraints( 2, 3, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlCity, new GridBagConstraints( 2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0)); warehouseForm.add( controlZip, new GridBagConstraints( 4, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlWarCode, new GridBagConstraints( 2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 100, 0)); warehousePanel.add(warehouseForm, BorderLayout.CENTER); buttonsPanel.add(insertButton, null); buttonsPanel.add(copyButton, null); buttonsPanel.add(editButton, null); buttonsPanel.add(saveButton, null); buttonsPanel.add(reloadButton, null); buttonsPanel.add(deleteButton, null); buttonsPanel.add(navigatorBar, null); warehouseForm.add( labelWarCode, new GridBagConstraints( 0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 0, 0)); warehouseForm.add( labelDescr, new GridBagConstraints( 0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlDescr, new GridBagConstraints( 2, 2, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlCountry, new GridBagConstraints( 4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelCountry, new GridBagConstraints( 3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelProv, new GridBagConstraints( 0, 5, 1, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 0, 0), 0, 0)); warehouseForm.add( controlProv, new GridBagConstraints( 2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelCompanyCode, new GridBagConstraints( 0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); tabbedPane.add(locationsPanel, "locationsPanel"); locationsPanel.add(split, BorderLayout.CENTER); split.setDividerLocation(150); split.add(hierarTreePanel, JSplitPane.LEFT); split.add(availPanel, JSplitPane.RIGHT); tabbedPane.add(bookedItemsPanel, "bookedItemsPanel"); tabbedPane.add(orderedItemsPanel, "orderedItemsPanel"); hierarTreePanel.setFunctionId("WAR01"); tabbedPane.setTitleAt( 0, ClientSettings.getInstance().getResources().getResource("warehouse detail")); tabbedPane.setTitleAt(1, ClientSettings.getInstance().getResources().getResource("positions")); tabbedPane.setTitleAt( 2, ClientSettings.getInstance().getResources().getResource("bookedItemsPanel")); tabbedPane.setTitleAt( 3, ClientSettings.getInstance().getResources().getResource("orderedItemsPanel")); warehouseForm.add( controlCompaniesCombo, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( controlRoles, new GridBagConstraints( 2, 6, 1, 2, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); warehouseForm.add( labelRoles, new GridBagConstraints( 0, 7, 2, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); }
public DlgPatrocinador(PatrocinadorVO p, GridControl gridControl) { setModal(true); _gridControl = gridControl; _patrocinador = p; setModalityType(ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setResizable(false); mainPanel.setVOClassName( BUNDLE.getString("DlgPatrocinador.mainPanel.VOClassName")); // $NON-NLS-1$ setSize(590, 274); setTitle(BUNDLE.getString("DlgPatrocinador.this.title")); // $NON-NLS-1$ gridBagLayout1.columnWeights = new double[] {0.0, 1.0, 0.0, 0.0, 0.0, 0.0}; gridBagLayout1.rowWeights = new double[] {0.0, 1.0, 1.0, 1.0, 1.0, 1.0}; gridBagLayout1.rowHeights = new int[] {2, 0, 0, 0, 56, 48}; mainPanel.setLayout(gridBagLayout1); mainPanel.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); GridBagConstraints gbc_lblNombre = new GridBagConstraints(); gbc_lblNombre.insets = new Insets(5, 5, 5, 5); gbc_lblNombre.fill = GridBagConstraints.BOTH; gbc_lblNombre.gridx = 0; gbc_lblNombre.gridy = 1; lblNombre.setText(BUNDLE.getString("DlgProducto.lblNombre.text")); mainPanel.add(lblNombre, gbc_lblNombre); GridBagConstraints gbc_txtFldNombre = new GridBagConstraints(); gbc_txtFldNombre.insets = new Insets(5, 5, 5, 5); gbc_txtFldNombre.fill = GridBagConstraints.BOTH; gbc_txtFldNombre.gridx = 1; gbc_txtFldNombre.gridy = 1; txtFldNombre.setTrimText(true); txtFldNombre.setAttributeName("nombre"); txtFldNombre.setRequired(true); txtFldNombre.setLinkLabel(lblNombre); mainPanel.add(txtFldNombre, gbc_txtFldNombre); GridBagConstraints gbc_lblActivo = new GridBagConstraints(); gbc_lblActivo.insets = new Insets(5, 5, 5, 5); gbc_lblActivo.fill = GridBagConstraints.BOTH; gbc_lblActivo.gridx = 0; gbc_lblActivo.gridy = 2; lblActivo.setText(BUNDLE.getString("DlgProducto.lblActivo.text")); mainPanel.add(lblActivo, gbc_lblActivo); GridBagConstraints gbc_chkbxActivo = new GridBagConstraints(); gbc_chkbxActivo.fill = GridBagConstraints.VERTICAL; gbc_chkbxActivo.anchor = GridBagConstraints.WEST; gbc_chkbxActivo.insets = new Insets(0, 0, 5, 5); gbc_chkbxActivo.gridx = 1; gbc_chkbxActivo.gridy = 2; chkbxActivo.setAttributeName("activo"); chkbxActivo.setLinkLabel(lblActivo); mainPanel.add(chkbxActivo, gbc_chkbxActivo); GridBagConstraints gbc_lblDescripcion = new GridBagConstraints(); gbc_lblDescripcion.insets = new Insets(5, 5, 5, 5); gbc_lblDescripcion.fill = GridBagConstraints.BOTH; gbc_lblDescripcion.gridx = 0; gbc_lblDescripcion.gridy = 3; lblDescripcion.setText(BUNDLE.getString("DlgProducto.lblDescripcion.text")); // $NON-NLS-1$ mainPanel.add(lblDescripcion, gbc_lblDescripcion); GridBagConstraints gbc_txtDescripcion = new GridBagConstraints(); gbc_txtDescripcion.gridwidth = 6; gbc_txtDescripcion.insets = new Insets(5, 5, 5, 0); gbc_txtDescripcion.fill = GridBagConstraints.BOTH; gbc_txtDescripcion.gridx = 0; gbc_txtDescripcion.gridy = 4; txtDescripcion.setRequired(true); txtDescripcion.setAttributeName("descripcion"); txtDescripcion.setLinkLabel(lblDescripcion); mainPanel.add(txtDescripcion, gbc_txtDescripcion); GridBagConstraints gbc_panel = new GridBagConstraints(); gbc_panel.gridwidth = 6; gbc_panel.fill = GridBagConstraints.BOTH; gbc_panel.gridx = 0; gbc_panel.gridy = 5; FlowLayout flowLayout = (FlowLayout) panel.getLayout(); flowLayout.setAlignment(FlowLayout.RIGHT); mainPanel.add(panel, gbc_panel); panel.add(btnGuardar); panel.add(btnCancelar); this.getContentPane().add(mainPanel, BorderLayout.CENTER); mainPanel.setFormController(new PatrocinadorFormController(_patrocinador)); if (_patrocinador != null) { mainPanel.reload(); } else { mainPanel.setMode(Consts.INSERT); } LicmanUtils.locateOnScreenCenter(this); // Actions // **************************************************************** addComponentListener( new ComponentAdapter() { public void componentShown(ComponentEvent e) { System.out.println("Requested"); txtFldNombre.requestFocus(); // BUG. Checkbox null old value if (_patrocinador != null) { mainPanel.setMode(Consts.EDIT); } } }); @SuppressWarnings("serial") AbstractAction closeAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { dispose(); } }; @SuppressWarnings("serial") AbstractAction guardarAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (mainPanel.isChanged()) { boolean resultOK = mainPanel.save(); if (resultOK) { _gridControl.reloadCurrentBlockOfData(); dispose(); LicmanUtils.MsgBox("msg.operacion.exitosa"); } } else { dispose(); } } }; KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); getRootPane().registerKeyboardAction(closeAction, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW); btnGuardar.addActionListener(guardarAction); btnCancelar.addActionListener(closeAction); }