/** * Add Editor to parameterPanel alernative right/left depending on m_newRow. Field Value changes * update Editors * * @param field field * @param editor editor * @param mandatory mandatory */ private void addLine(GridField field, VEditor editor, boolean mandatory) { log.fine("Field=" + field); JLabel label = VEditorFactory.getLabel(field); label.setLabelFor((Component) editor); editor.setReadWrite(true); editor.setMandatory(mandatory); // MField => VEditor field.addPropertyChangeListener(editor); // label if (m_newRow) { m_gbc.gridy = m_line++; m_gbc.gridx = 0; } else m_gbc.gridx = 2; m_gbc.insets = m_labelInsets; m_gbc.fill = GridBagConstraints.HORIZONTAL; m_gbc.weightx = 0; parameterPanel.add(label, m_gbc); // Field if (m_newRow) m_gbc.gridx = 1; else m_gbc.gridx = 3; m_gbc.insets = m_fieldInsets; m_gbc.fill = GridBagConstraints.HORIZONTAL; m_gbc.weightx = 1; parameterPanel.add((Component) editor, m_gbc); // m_newRow = !m_newRow; } // addLine
/** * This method initializes cCustomerDataPanel * * @return org.compiere.swing.CPanel */ private CPanel getCMainPanel() { if (cMainPanel == null) { cMainPanel = new CPanel(); cMainPanel.setLayout(new BorderLayout()); cMainPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5)); cMainPanel.add(getCCmdPanel(), java.awt.BorderLayout.EAST); cMainPanel.add(getCCustomerDataPanel(), java.awt.BorderLayout.CENTER); } return cMainPanel; }
/** * This method initializes cCommandPanel * * @return org.compiere.swing.CPanel */ private CPanel getCCmdPanel() { if (cCmdPanel == null) { cCmdPanel = new CPanel(); cCmdPanel.setPreferredSize(new java.awt.Dimension(BUTTON_PANEL_WIDTH, 36)); cCmdPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 5, 0, 0)); cCmdPanel.add(getCOkButton(), null); cCmdPanel.add(getCClearButton(), null); cCmdPanel.add(getCCancelButton(), null); } return cCmdPanel; }
/** * Static Init * * @throws Exception */ void jbInit() throws Exception { mainPanel.setLayout(mainLayout); mainLayout.setHgap(2); mainLayout.setVgap(2); infoPane.setBorder(BorderFactory.createLoweredBevelBorder()); infoPane.setPreferredSize(new Dimension(500, 400)); getContentPane().add(mainPanel); mainPanel.add(infoPane, BorderLayout.CENTER); mainPanel.add(confirmPanel, BorderLayout.SOUTH); infoPane.getViewport().add(info, null); confirmPanel.addActionListener(this); } // jbInit
/** * Static Init. * * <pre> * mainPanel * northPanel * centerPanel * xMatched * xPanel * xMathedTo * southPanel * </pre> * * @throws Exception */ private void jbInit() throws Exception { mainPanel.setLayout(mainLayout); northPanel.setLayout(northLayout); southPanel.setLayout(southLayout); generate.setText(Msg.translate(Env.getCtx(), "XX_PrintSelectedLabels")); generate.setEnabled(true); markall.setText(Msg.translate(Env.getCtx(), "XX_CheckAll")); markall.setEnabled(true); centerPanel.setLayout(centerLayout); xProductScrollPane.setBorder(xProductBorder); xProductScrollPane.setPreferredSize(new Dimension(1024, 350)); xPanel.setLayout(xLayout); mainPanel.add(northPanel, BorderLayout.NORTH); mainPanel.add(southPanel, BorderLayout.SOUTH); mainPanel.add(centerPanel, BorderLayout.CENTER); centerPanel.add(xProductScrollPane, BorderLayout.CENTER); xProductScrollPane.getViewport().add(xProductTable, null); southPanel.add( markall, new GridBagConstraints( 6, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 12, 5, 12), 0, 0)); southPanel.add( generate, new GridBagConstraints( 8, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 12, 5, 12), 0, 0)); } // jbInit*/
/** * Static Constructor * * @throws Exception */ private void jbInit() throws Exception { this.setJMenuBar(menuBar); confirmPanel.setActionListener( this); // set it first just to know buttons are working in case something failed // mEMail.setIcon(Images.getImageIcon2("EMailSupport16")); mEMail.setText(msgBL.getMsg(Env.getCtx(), "EMailSupport")); mEMail.addActionListener(this); mPreference.setIcon(Images.getImageIcon2("Preference16")); mPreference.setText(msgBL.getMsg(Env.getCtx(), "Preference")); mPreference.addActionListener(this); mEnd.setIcon(Images.getImageIcon2("End16")); mEnd.setText(msgBL.getMsg(Env.getCtx(), "End")); mEnd.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.ALT_MASK)); mEnd.addActionListener(this); // westPanel.setLayout(westLayout); westPanel.setName("westPanel"); westPanel.setRequestFocusEnabled(false); infoPanel.setLayout(infoLayout); infoPanel.setName("infoPanel"); infoPanel.setRequestFocusEnabled(false); this.getContentPane().add(confirmPanel, BorderLayout.SOUTH); this.getContentPane().add(westPanel, BorderLayout.WEST); westPanel.add( iconLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); this.getContentPane().add(infoPanel, BorderLayout.CENTER); infoPanel.add( info, new GridBagConstraints( 0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); // menuBar.add(mFile); mFile.add(mEMail); if (Env.getUserRolePermissions().isShowPreference()) mFile.add(mPreference); mFile.addSeparator(); mFile.add(mEnd); } // jbinit
/** * Descripción de Método * * @throws Exception */ private void jbInit() throws Exception { this.setLayout(mainLayout); this.add(splitPane, BorderLayout.CENTER); splitPane.setOpaque(false); graphPanel.setLayout(graphLayout); // splitPane.add(graphPanel, JSplitPane.LEFT); splitPane.add(cardPanel, JSplitPane.RIGHT); splitPane.setBorder(null); splitPane.setName("gc_splitPane"); // cardPanel.setLayout(cardLayout); cardPanel.add(srPane, "srPane"); // Sequence Important! cardPanel.add(mrPane, "mrPane"); cardPanel.setBorder(null); cardPanel.setName("gc_cardPanel"); // single row (w/o xPane it would be centered) srPane.setBorder(null); srPane.setName("gc_srPane"); srPane.setOrientation(JSplitPane.VERTICAL_SPLIT); srPane.add(vPane, JSplitPane.TOP); srPane.setTopComponent(vPane); vPane.getViewport().add(xPanel, null); xPanel.add(vPanel); vPane.setBorder(null); xPanel.setLayout(xLayout); xPanel.setName("gc_xPanel"); xLayout.setAlignment(FlowLayout.LEFT); xLayout.setHgap(0); xLayout.setVgap(0); // multi-row mrPane.setBorder(null); mrPane.getViewport().add(vTable, null); mrPane.setName("gc_mrPane"); // graphPanel.setBorder(null); graphPanel.setName("gc_graphPanel"); srPane.setDividerLocation(200); } // jbInit
private void init(Window owner, String title, String htmlText, boolean editable) { if (title == null) setTitle(Msg.getMsg(Env.getCtx(), "Editor")); else setTitle(title); // General Layout final CPanel mainPanel = new CPanel(); mainPanel.setLayout(new BorderLayout()); getContentPane().add(mainPanel, BorderLayout.CENTER); mainPanel.add(editor, BorderLayout.CENTER); editor.setPreferredSize(new Dimension(600, 600)); mainPanel.add(confirmPanel, BorderLayout.SOUTH); confirmPanel.setActionListener(this); // setHtmlText(htmlText); } // init
/** * Add Line to screen * * @param line line number (zero based) * @param label label * @param field field */ private void addLine(int line, JLabel label, JComponent field) { gbc.gridy = line; // label gbc.insets = labelInsets; gbc.gridx = 0; gbc.weightx = 0.0; gbc.fill = GridBagConstraints.HORIZONTAL; label.setHorizontalAlignment(SwingConstants.RIGHT); mainPanel.add(label, gbc); // Field gbc.insets = fieldInsets; gbc.gridx = 1; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.NONE; mainPanel.add(field, gbc); } // addLine
/** * This method initializes cCustomerDataPanel * * @return org.compiere.swing.CPanel */ private CPanel getCCustomerDataPanel() { if (cCustomerDataPanel == null) { GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints5.gridy = 2; gridBagConstraints5.weightx = 1.0; gridBagConstraints5.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints5.insets = new java.awt.Insets(7, 5, 0, 0); gridBagConstraints5.gridx = 1; GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints4.gridy = 1; gridBagConstraints4.weightx = 1.0; gridBagConstraints4.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints4.insets = new java.awt.Insets(7, 5, 0, 0); gridBagConstraints4.gridx = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints3.gridy = 0; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.insets = new java.awt.Insets(0, 5, 0, 0); gridBagConstraints3.gridx = 1; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints2.insets = new java.awt.Insets(7, 0, 0, 0); gridBagConstraints2.gridy = 2; cAddressLabel = new CLabel(); cAddressLabel.setText(MSG_ADDRESS); GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints1.insets = new java.awt.Insets(7, 0, 0, 0); gridBagConstraints1.gridy = 1; cIdentificationLabel = new CLabel(); cIdentificationLabel.setText(MSG_CUSTOMER_IDENTIFICATION_NUMBER); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.gridy = 0; cNameLabel = new CLabel(); cNameLabel.setText(MSG_NAME); cCustomerDataPanel = new CPanel(); cCustomerDataPanel.setLayout(new GridBagLayout()); cCustomerDataPanel.setBorder( javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED), javax.swing.BorderFactory.createEmptyBorder(0, 5, 5, 5))); cCustomerDataPanel.add(cNameLabel, gridBagConstraints); cCustomerDataPanel.add(cIdentificationLabel, gridBagConstraints1); cCustomerDataPanel.add(cAddressLabel, gridBagConstraints2); cCustomerDataPanel.add(getCNameText(), gridBagConstraints3); cCustomerDataPanel.add(getCIdentificationText(), gridBagConstraints4); cCustomerDataPanel.add(getCAddressText(), gridBagConstraints5); } return cCustomerDataPanel; }
/** * Layout * * @throws Exception */ private void jbInit() throws Exception { this.getContentPane().setLayout(mainLayout); this.getContentPane().add(centerPanel, BorderLayout.CENTER); this.getContentPane().add(confirmPanel, BorderLayout.SOUTH); centerPanel.setLayout(centerLayout); // confirmPanel.setActionListener(this); } // jbInit
private void init() { CPanel panel = new CPanel(); panel.setLayout(new MigLayout()); getContentPane().add(panel); panel.add(new CLabel(Msg.translate(posPanel.getCtx(), "SalesRep_ID"))); username = new PosTextField( Msg.translate(posPanel.getCtx(), "SalesRep_ID"), posPanel, posPanel.p_pos.getOSK_KeyLayout_ID()); panel.add(username, "wrap"); panel.add(new CLabel(Msg.translate(posPanel.getCtx(), "UserPIN"))); pin = new PosTextField( Msg.translate(posPanel.getCtx(), "UserPIN"), posPanel, posPanel.p_pos.getOSNP_KeyLayout_ID()); panel.add(pin, ""); AppsAction act = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false); act.setDelegate(this); bProcess = (CButton) act.getButton(); bProcess.setFocusable(false); panel.add(bProcess, "h 50!, w 50!"); pack(); }
/** Remove All and their listeners */ public void removeAll() { m_nodes.clear(); m_lines.clear(); Component[] components = getComponents(); for (int i = 0; i < components.length; i++) { Component component = components[i]; component.removeMouseListener(this); component.removeMouseMotionListener(this); } super.removeAll(); } // removeAll
/** * Static component init. * * <pre> * - panel * - northPanel * - parameterPanel * - toolBar * - gridController * - confirmPanel * - statusBar * </pre> * * @throws Exception */ void jbInit() throws Exception { // [ 1707303 ] Account Combination Form(VAccountDialog) translation issue titledBorder = new TitledBorder( BorderFactory.createEtchedBorder(Color.white, new Color(134, 134, 134)), Msg.getMsg(Env.getCtx(), "Parameter")); // panelLayout.setHgap(5); panelLayout.setVgap(5); northLayout.setHgap(5); northLayout.setVgap(5); // parameterPanel.setLayout(parameterLayout); parameterPanel.setBorder(titledBorder); northPanel.setLayout(northLayout); toolBar.setOrientation(JToolBar.VERTICAL); toolBar.setBorder(null); toolBar.setRequestFocusEnabled(false); toolBar.setBorderPainted(false); toolBar.setMargin(new Insets(5, 5, 5, 5)); bSave.setIcon(new ImageIcon(ResourceFinder.getResource("images/Save24.gif"))); bSave.setMargin(new Insets(2, 2, 2, 2)); bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AccountNewUpdate")); bSave.addActionListener(this); bRefresh.setIcon(new ImageIcon(ResourceFinder.getResource("images/Refresh24.gif"))); bRefresh.setMargin(new Insets(2, 2, 2, 2)); bRefresh.setToolTipText(Msg.getMsg(Env.getCtx(), "Refresh")); bRefresh.addActionListener(this); bIgnore.setIcon(new ImageIcon(ResourceFinder.getResource("images/Ignore24.gif"))); bIgnore.setMargin(new Insets(2, 2, 2, 2)); bIgnore.setToolTipText(Msg.getMsg(Env.getCtx(), "Ignore")); bIgnore.addActionListener(this); // toolBar.addSeparator(); toolBar.add(bRefresh, null); toolBar.add(bIgnore, null); toolBar.add(bSave, null); // getContentPane().add(panel); panel.setLayout(panelLayout); panel.add(confirmPanel, BorderLayout.SOUTH); panel.add(northPanel, BorderLayout.NORTH); northPanel.add(parameterPanel, BorderLayout.CENTER); northPanel.add(toolBar, BorderLayout.EAST); // this.getContentPane().add(statusBar, BorderLayout.SOUTH); confirmPanel.addActionListener(this); } // jbInit
/** * Add Product * * @param element panel * @param product product */ private void addProduct(CPanel element, MProduct product) { Insets ii = new Insets(2, 4, 2, 4); int M_Product_ID = product.getM_Product_ID(); CPanel pe = new CPanel(); pe.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1)); pe.setLayout(new GridBagLayout()); // Product Value - Price pe.add( new JLabel(product.getValue()), new GridBagConstraints( 0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, ii, 0, 0)); String formatted = ""; if (m_M_PriceList_Version_ID != 0) { MProductPrice pp = MProductPrice.get(Env.getCtx(), m_M_PriceList_Version_ID, M_Product_ID, null); if (pp != null) { BigDecimal price = pp.getPriceStd(); formatted = m_price.format(price); } else formatted = "-"; } pe.add( new JLabel(formatted, JLabel.RIGHT), new GridBagConstraints( 1, 0, 1, 1, .5, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, ii, 0, 0)); // Product Name - Qty pe.add( new JLabel(product.getName()), new GridBagConstraints( 0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, ii, 0, 0)); formatted = ""; if (m_M_Warehouse_ID != 0) { BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null); if (qty == null) formatted = "-"; else formatted = m_qty.format(qty); } pe.add( new JLabel(formatted, JLabel.RIGHT), new GridBagConstraints( 1, 1, 1, 1, .5, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, ii, 0, 0)); // element.add(pe); } // addProduct
/** * ************************************************************************ Paint Component. Paint * Lines directly as not added. * * @param g graphics */ protected void paintComponent(Graphics g) { super.paintComponent(g); // Paint Lines for (int i = 0; i < m_lines.size(); i++) { WFLine line = (WFLine) m_lines.get(i); line.paint(g); } // Paint Position = right next to the box if (m_dragged && m_draggedNode != null) { Point loc = m_draggedNode.getLocation(); String text = "(" + loc.x + "," + loc.y + ")"; Graphics2D g2D = (Graphics2D) g; Font font = new Font("Dialog", Font.PLAIN, 10); g2D.setColor(Color.magenta); TextLayout layout = new TextLayout(text, font, g2D.getFontRenderContext()); loc.x += m_draggedNode.getWidth(); loc.y += layout.getAscent(); layout.draw(g2D, loc.x, loc.y); } } // paintComponents
/** * Static Init * * @throws Exception */ private void jbInit() throws Exception { mainPanel.setLayout(mainLayout); this.getContentPane().add(mainPanel, BorderLayout.CENTER); // North northPanel.setLayout(new ALayout()); northPanel.add(showAll, new ALayoutConstraint(0, 0)); showAll.addActionListener(this); this.getContentPane().add(northPanel, BorderLayout.NORTH); // Center mainPanel.add(centerScrollPane, BorderLayout.CENTER); centerScrollPane.getViewport().add(m_table, null); // South mainPanel.add(confirmPanel, BorderLayout.SOUTH); mainPanel.setPreferredSize(new Dimension(SCREEN_WIDTH, SCREEN_HEIGHT)); confirmPanel.addActionListener(this); }
/** * Static component init * * @throws Exception */ void jbInit() throws Exception { panel.setLayout(panelLayout); southPanel.setLayout(southLayout); mainPanel.setLayout(gridBagLayout); panelLayout.setHgap(5); panelLayout.setVgap(10); getContentPane().add(panel); panel.add(mainPanel, BorderLayout.NORTH); panel.add(southPanel, BorderLayout.SOUTH); southPanel.add(confirmPanel, BorderLayout.CENTER); toLink.setText(TO_LINK); toLink.addActionListener(this); toLink.setMargin(ConfirmPanel.s_insets); confirmPanel.addComponent(toLink); toRoute.setText(TO_ROUTE); toRoute.addActionListener(this); toRoute.setMargin(ConfirmPanel.s_insets); confirmPanel.addComponent(toRoute); getAddress.setText("Procurar"); getAddress.addActionListener(this); getAddress.setMargin(ConfirmPanel.s_insets); confirmPanel.addComponent(getAddress); // fAddress1.setMandatory( new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address1"), null) .isMandatory()); fAddress2.setMandatory( new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address2"), null) .isMandatory()); fAddress3.setMandatory( new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address3"), null) .isMandatory()); fAddress4.setMandatory( new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Address4"), null) .isMandatory()); fPostal.setMandatory( new MColumn(Env.getCtx(), MColumn.getColumn_ID("C_Location", "Postal"), null) .isMandatory()); confirmPanel.addActionListener(this); } // jbInit
private CPanel generateInstalledSoftPanel() { CPanel panel = new CPanel(); panel.setLayout(new BorderLayout()); // Installed apps installedAppsList = new BasicEventList<IUnitModel>(); FilterList<IUnitModel> installedFilterList = new FilterList<IUnitModel>(installedAppsList); EventTableModel<IUnitModel> installedTableModel = new EventTableModel<IUnitModel>(installedFilterList, new IUnitTableFormat()); table = new JTable(installedTableModel); panel.add(new JScrollPane(table), BorderLayout.CENTER); CPanel btnPanel = new CPanel(); panel.add(btnPanel, BorderLayout.SOUTH); updateBtn = new CButton(Msg.getMsg(Env.getAD_Language(ctx), "Update")); updateBtn.addActionListener(this); btnPanel.add(updateBtn); return panel; }
/** * Dyanmic Init. When a row is selected, the editor values are set (editors do not change grid) * * @return true if initialized */ private boolean initAccount() { m_AD_Client_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "AD_Client_ID"); // Get AcctSchema Info if (s_AcctSchema == null || s_AcctSchema.getC_AcctSchema_ID() != m_C_AcctSchema_ID) s_AcctSchema = new MAcctSchema(Env.getCtx(), m_C_AcctSchema_ID, null); log.config(s_AcctSchema.toString() + ", #" + s_AcctSchema.getAcctSchemaElements().length); Env.setContext(Env.getCtx(), m_WindowNo, "C_AcctSchema_ID", m_C_AcctSchema_ID); // Model int AD_Window_ID = 153; // Maintain Account Combinations GridWindowVO wVO = AEnv.getMWindowVO(m_WindowNo, AD_Window_ID, 0); if (wVO == null) return false; m_mWindow = new GridWindow(wVO); m_mTab = m_mWindow.getTab(0); // Make sure is the tab is loaded - teo_sarca [ 1659124 ] if (!m_mTab.isLoadComplete()) m_mWindow.initTab(0); // ParameterPanel restrictions m_mTab.getField("Alias").setDisplayLength(15); m_mTab.getField("Combination").setDisplayLength(15); // Grid restrictions m_mTab.getField("AD_Client_ID").setDisplayed(false); m_mTab.getField("C_AcctSchema_ID").setDisplayed(false); m_mTab.getField("IsActive").setDisplayed(false); m_mTab.getField("IsFullyQualified").setDisplayed(false); // don't show fields not being displayed in this environment for (int i = 0; i < m_mTab.getFieldCount(); i++) { GridField field = m_mTab.getField(i); if (!field.isDisplayed(true)) // check context field.setDisplayed(false); } // GridController m_gridController = new GridController(); m_gridController.initGrid(m_mTab, true, m_WindowNo, null, null); m_gridController.setPreferredSize(new Dimension(300, 100)); panel.add(m_gridController, BorderLayout.CENTER); // Prepare Parameter m_gbc.anchor = GridBagConstraints.NORTHWEST; m_gbc.gridy = 0; // line m_gbc.gridx = 0; m_gbc.gridwidth = 1; m_gbc.insets = m_fieldInsets; m_gbc.fill = GridBagConstraints.HORIZONTAL; m_gbc.weightx = 0; m_gbc.weighty = 0; int TabNo = 0; // Alias if (s_AcctSchema.isHasAlias()) { GridField alias = m_mTab.getField("Alias"); f_Alias = VEditorFactory.getEditor(m_mTab, alias, false); addLine(alias, f_Alias, false); } // Alias // Combination GridField combination = m_mTab.getField("Combination"); f_Combination = VEditorFactory.getEditor(m_mTab, combination, false); addLine(combination, f_Combination, false); m_newRow = true; /** Create Fields in Element Order */ MAcctSchemaElement[] elements = s_AcctSchema.getAcctSchemaElements(); for (int i = 0; i < elements.length; i++) { MAcctSchemaElement ase = elements[i]; String type = ase.getElementType(); boolean isMandatory = ase.isMandatory(); // if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Organization)) { GridField field = m_mTab.getField("AD_Org_ID"); f_AD_Org_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_AD_Org_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Account)) { GridField field = m_mTab.getField("Account_ID"); f_Account_ID = VEditorFactory.getEditor(m_mTab, field, false); // ((VLookup)f_Account_ID).setWidth(400); addLine(field, f_Account_ID, isMandatory); f_Account_ID.addVetoableChangeListener(this); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_SubAccount)) { GridField field = m_mTab.getField("C_SubAcct_ID"); f_SubAcct_ID = VEditorFactory.getEditor(m_mTab, field, false); // ((VLookup)f_SubAcct_ID).setWidth(400); addLine(field, f_SubAcct_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Product)) { GridField field = m_mTab.getField("M_Product_ID"); f_M_Product_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_M_Product_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_BPartner)) { GridField field = m_mTab.getField("C_BPartner_ID"); f_C_BPartner_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_BPartner_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Campaign)) { GridField field = m_mTab.getField("C_Campaign_ID"); f_C_Campaign_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_Campaign_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_LocationFrom)) { GridField field = m_mTab.getField("C_LocFrom_ID"); f_C_LocFrom_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_LocFrom_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_LocationTo)) { GridField field = m_mTab.getField("C_LocTo_ID"); f_C_LocTo_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_LocTo_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Project)) { GridField field = m_mTab.getField("C_Project_ID"); f_C_Project_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_Project_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_SalesRegion)) { GridField field = m_mTab.getField("C_SalesRegion_ID"); f_C_SalesRegion_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_SalesRegion_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_OrgTrx)) { GridField field = m_mTab.getField("AD_OrgTrx_ID"); f_AD_OrgTrx_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_AD_OrgTrx_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_Activity)) { GridField field = m_mTab.getField("C_Activity_ID"); f_C_Activity_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_C_Activity_ID, isMandatory); } // User1 else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_UserList1)) { GridField field = m_mTab.getField("User1_ID"); f_User1_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_User1_ID, isMandatory); } else if (type.equals(MAcctSchemaElement.ELEMENTTYPE_UserList2)) { GridField field = m_mTab.getField("User2_ID"); f_User2_ID = VEditorFactory.getEditor(m_mTab, field, false); addLine(field, f_User2_ID, isMandatory); } } // Create Fields in Element Order // Add description m_newRow = true; m_gbc.gridy = m_line++; m_gbc.gridx = 0; m_gbc.gridwidth = 4; m_gbc.insets = new Insets(5, 15, 2, 0); // top,left,bottom,right m_gbc.fill = GridBagConstraints.HORIZONTAL; f_Description.setFont(f_Description.getFont().deriveFont(Font.ITALIC)); parameterPanel.add(f_Description, m_gbc); // Finish m_query = new MQuery(); m_query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID); m_query.addRestriction("IsFullyQualified", MQuery.EQUAL, "Y"); if (m_mAccount.C_ValidCombination_ID == 0) m_mTab.setQuery(MQuery.getEqualQuery("1", "2")); else { MQuery query = new MQuery(); query.addRestriction("C_AcctSchema_ID", MQuery.EQUAL, m_C_AcctSchema_ID); query.addRestriction("C_ValidCombination_ID", MQuery.EQUAL, m_mAccount.C_ValidCombination_ID); m_mTab.setQuery(query); } m_mTab.query(false); m_gridController.getTable().addMouseListener(new VAccountDialog_mouseAdapter(this)); m_gridController.addDataStatusListener(this); statusBar.setStatusLine(s_AcctSchema.toString()); statusBar.setStatusDB("?"); // Initial value if (m_mAccount.C_ValidCombination_ID != 0) m_mTab.navigate(0); log.config("fini"); return true; } // initAccount
/** Static Setup - add fields to parameterPanel */ private void statInit() { labelValue.setText(Msg.getMsg(Env.getCtx(), "Value")); fieldValue.setBackground(AdempierePLAF.getInfoBackground()); fieldValue.addActionListener(this); labelName.setText(Msg.getMsg(Env.getCtx(), "Name")); fieldName.setBackground(AdempierePLAF.getInfoBackground()); fieldName.addActionListener(this); labelUPC.setText(Msg.translate(Env.getCtx(), "UPC")); fieldUPC.setBackground(AdempierePLAF.getInfoBackground()); fieldUPC.addActionListener(this); labelSKU.setText(Msg.translate(Env.getCtx(), "SKU")); fieldSKU.setBackground(AdempierePLAF.getInfoBackground()); fieldSKU.addActionListener(this); labelWarehouse.setText(Msg.getMsg(Env.getCtx(), "Warehouse")); pickWarehouse.setBackground(AdempierePLAF.getInfoBackground()); labelPriceList.setText(Msg.getMsg(Env.getCtx(), "PriceListVersion")); pickPriceList.setBackground(AdempierePLAF.getInfoBackground()); labelProductCategory.setText(Msg.translate(Env.getCtx(), "M_Product_Category_ID")); pickProductCategory.setBackground(AdempierePLAF.getInfoBackground()); // @Trifon labelAS.setText(Msg.translate(Env.getCtx(), "M_AttributeSet_ID")); pickAS.setBackground(AdempierePLAF.getInfoBackground()); m_InfoPAttributeButton.setMargin(new Insets(2, 2, 2, 2)); m_InfoPAttributeButton.setToolTipText(Msg.getMsg(Env.getCtx(), "InfoPAttribute")); m_InfoPAttributeButton.addActionListener(this); labelVendor.setText(Msg.translate(Env.getCtx(), "Vendor")); fieldVendor.setBackground(AdempierePLAF.getInfoBackground()); fieldVendor.addActionListener(this); // Line 1 parameterPanel.setLayout(new ALayout()); parameterPanel.add(labelValue, new ALayoutConstraint(0, 0)); parameterPanel.add(fieldValue, null); parameterPanel.add(labelUPC, null); parameterPanel.add(fieldUPC, null); parameterPanel.add(labelWarehouse, null); parameterPanel.add(pickWarehouse, null); parameterPanel.add(m_InfoPAttributeButton); // Line 2 parameterPanel.add(labelName, new ALayoutConstraint(1, 0)); parameterPanel.add(fieldName, null); parameterPanel.add(labelSKU, null); parameterPanel.add(fieldSKU, null); parameterPanel.add(labelVendor, null); parameterPanel.add(fieldVendor, null); // Line 3 parameterPanel.add(labelPriceList, new ALayoutConstraint(2, 0)); parameterPanel.add(pickPriceList, null); parameterPanel.add(labelProductCategory, null); parameterPanel.add(pickProductCategory, null); parameterPanel.add(labelAS, null); // @Trifon parameterPanel.add(pickAS, null); // @Trifon // Product Attribute Instance m_PAttributeButton = ConfirmPanel.createPAttributeButton(true); confirmPanel.addButton(m_PAttributeButton); m_PAttributeButton.addActionListener(this); m_PAttributeButton.setEnabled(false); // Begin - fer_luck @ centuryon // add taskpane fieldDescription.setBackground(AdempierePLAF.getInfoBackground()); fieldDescription.setEditable(false); fieldDescription.setPreferredSize(new Dimension(INFO_WIDTH - 100, 100)); warehouseStockPanel.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock")); warehouseStockPanel.setUI(new AdempiereTaskPaneUI()); warehouseStockPanel.getContentPane().setBackground(new ColorUIResource(251, 248, 241)); warehouseStockPanel.getContentPane().setForeground(new ColorUIResource(251, 0, 0)); ColumnInfo[] s_layoutWarehouse = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "Warehouse", String.class), new ColumnInfo( Msg.translate(Env.getCtx(), "QtyAvailable"), "sum(QtyAvailable)", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "sum(QtyOnHand)", Double.class), new ColumnInfo( Msg.translate(Env.getCtx(), "QtyReserved"), "sum(QtyReserved)", Double.class), new ColumnInfo( Msg.translate(Env.getCtx(), "QtyAllocated"), "sum(QtyAllocated)", Double.class) }; /** From Clause */ String s_sqlFrom = " M_PRODUCT_STOCK_V "; /** Where Clause */ String s_sqlWhere = "Value = ?"; m_sqlWarehouse = warehouseTbl.prepareTable( s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V"); m_sqlWarehouse += " Group By Warehouse, documentnote "; warehouseTbl.setRowSelectionAllowed(true); warehouseTbl.setMultiSelection(false); warehouseTbl.addMouseListener(this); warehouseTbl.getSelectionModel().addListSelectionListener(this); warehouseTbl.setShowTotals(true); warehouseTbl.autoSize(); ColumnInfo[] s_layoutSubstitute = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo( Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) }; s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V"; s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'"; m_sqlSubstitute = substituteTbl.prepareTable( s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V"); substituteTbl.setRowSelectionAllowed(false); substituteTbl.setMultiSelection(false); substituteTbl.addMouseListener(this); substituteTbl.getSelectionModel().addListSelectionListener(this); substituteTbl.autoSize(); ColumnInfo[] s_layoutRelated = new ColumnInfo[] { new ColumnInfo(Msg.translate(Env.getCtx(), "Warehouse"), "orgname", String.class), new ColumnInfo( Msg.translate(Env.getCtx(), "Value"), "(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.Substitute_ID)", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Name"), "Name", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class) }; s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V"; s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'"; m_sqlRelated = relatedTbl.prepareTable( s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V"); relatedTbl.setRowSelectionAllowed(false); relatedTbl.setMultiSelection(false); relatedTbl.addMouseListener(this); relatedTbl.getSelectionModel().addListSelectionListener(this); relatedTbl.autoSize(); // Available to Promise Tab m_tableAtp.setRowSelectionAllowed(false); m_tableAtp.setMultiSelection(false); CTabbedPane jTab = new CTabbedPane(); jTab.addTab(Msg.translate(Env.getCtx(), "Warehouse"), new JScrollPane(warehouseTbl)); jTab.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 250 : 105)); jTab.addTab(Msg.translate(Env.getCtx(), "Description"), new JScrollPane(fieldDescription)); jTab.addTab(Msg.translate(Env.getCtx(), "Substitute_ID"), new JScrollPane(substituteTbl)); jTab.addTab(Msg.translate(Env.getCtx(), "RelatedProduct_ID"), new JScrollPane(relatedTbl)); jTab.addTab(Msg.getMsg(Env.getCtx(), "ATP"), new JScrollPane(m_tableAtp)); jTab.addChangeListener(this); tablePanel.setPreferredSize(new Dimension(INFO_WIDTH, SCREEN_HEIGHT > 600 ? 255 : 110)); tablePanel.add(jTab); warehouseStockPanel.setCollapsed(true); warehouseStockPanel.add(tablePanel); this.addonPanel.add(warehouseStockPanel); this.p_table.addKeyListener( new KeyAdapter() { public void keyReleased(KeyEvent ke) { int row = ((MiniTable) ke.getSource()).getSelectedRow(); refresh( ((MiniTable) ke.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue()); warehouseStockPanel.setCollapsed(false); } }); this.p_table.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent me) { int row = ((MiniTable) me.getSource()).getSelectedRow(); refresh( ((MiniTable) me.getSource()).getValueAt(row, 2), new BigDecimal(pickWarehouse.getValue().toString()).intValue(), new BigDecimal(pickPriceList.getValue().toString()).intValue()); warehouseStockPanel.setCollapsed(false); } }); // End - fer_luck @ centuryon } // statInit
/** * Descripción de Método * * @throws Exception */ private void jbInit() throws Exception { CompiereColor.setBackground(this); panel.setLayout(panelLayout); southPanel.setLayout(southLayout); mainPanel.setLayout(gridBagLayout); panelLayout.setHgap(5); panelLayout.setVgap(10); fCreateNew.setText(Msg.getMsg(Env.getCtx(), "CreateNew")); fX.setColumns(15); fY.setColumns(15); fZ.setColumns(15); lLocator.setLabelFor(fLocator); lLocator.setText(Msg.translate(Env.getCtx(), "M_Locator_ID")); fWarehouseInfo.setBackground(CompierePLAF.getFieldBackground_Inactive()); fWarehouseInfo.setReadWrite(false); fWarehouseInfo.setColumns(15); fValue.setColumns(15); lWarehouseInfo.setLabelFor(fWarehouseInfo); lWarehouseInfo.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID")); lWarehouse.setLabelFor(fWarehouse); lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID")); lX.setLabelFor(fX); lX.setText(Msg.getElement(Env.getCtx(), "X")); lY.setLabelFor(fY); lY.setText(Msg.getElement(Env.getCtx(), "Y")); lZ.setLabelFor(fZ); lZ.setText(Msg.getElement(Env.getCtx(), "Z")); lValue.setLabelFor(fValue); lValue.setText(Msg.translate(Env.getCtx(), "Value")); getContentPane().add(panel); panel.add(mainPanel, BorderLayout.CENTER); // mainPanel.add( lLocator, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fLocator, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); mainPanel.add( fCreateNew, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 5), 0, 0)); mainPanel.add( lWarehouseInfo, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fWarehouseInfo, new GridBagConstraints( 1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); mainPanel.add( lWarehouse, new GridBagConstraints( 0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fWarehouse, new GridBagConstraints( 1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); mainPanel.add( lX, new GridBagConstraints( 0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fX, new GridBagConstraints( 1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); mainPanel.add( lY, new GridBagConstraints( 0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fY, new GridBagConstraints( 1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); mainPanel.add( lZ, new GridBagConstraints( 0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fZ, new GridBagConstraints( 1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); mainPanel.add( lValue, new GridBagConstraints( 0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 0, 5), 0, 0)); mainPanel.add( fValue, new GridBagConstraints( 1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 5), 0, 0)); // panel.add(southPanel, BorderLayout.SOUTH); southPanel.add(confirmPanel, BorderLayout.NORTH); confirmPanel.addActionListener(this); } // jbInit
/** * Init Main Panel * * @return void */ private void initMainPanel() { // Instance Panel // For Table m_table = new PosTable(); v_MainPanel = new CPanel(new GridBagLayout()); v_ParameterPanel = new CPanel(new GridBagLayout()); v_CenterScroll = new CScrollPane(m_table); v_ConfirmPanel = new CPanel(new GridBagLayout()); // v_CenterScroll.setPreferredSize(new Dimension(800, 400)); // // Create Buttons f_New = createButtonAction("New", KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)); f_Reset = createButtonAction("Reset", KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0)); f_Refresh = createButtonAction("Refresh", KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); f_Cancel = createButtonAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)); f_Ok = createButtonAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)); // v_ConfirmPanel.add( f_New, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0)); v_ConfirmPanel.add( f_Reset, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0)); v_ConfirmPanel.add( f_Refresh, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0)); v_ConfirmPanel.add( f_Ok, new GridBagConstraints( 3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0)); v_ConfirmPanel.add( f_Cancel, new GridBagConstraints( 4, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0)); // Add To Main Panel v_MainPanel.add( v_ParameterPanel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0)); v_MainPanel.add( v_CenterScroll, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); v_MainPanel.add( v_ConfirmPanel, new GridBagConstraints( 0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); // Add Main Panel to Content getContentPane().add(v_MainPanel); // Visible New f_New.setVisible(false); }
/** * ActionListener * * @param e ActionEvent */ public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(ConfirmPanel.A_OK)) { if (fAddress1.isMandatory() && ((((String) fAddress1.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else if (fAddress2.isMandatory() && ((((String) fAddress2.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else if (fAddress3.isMandatory() && ((((String) fAddress3.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else if (fPostal.isMandatory() && ((((String) fPostal.getValue()).trim()).isEmpty())) JOptionPane.showMessageDialog(null, "Preencha todos os campos corretamente"); else { action_OK(); m_change = true; dispose(); } } else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) { m_change = false; dispose(); } else if (e.getSource() == fCountry) { // Country Changed - display in new Format // Modifier for Mouse selection is 16 - for any key selection 0 MCountry c = (MCountry) fCountry.getSelectedItem(); m_location.setCountry(c); // refrseh mainPanel.removeAll(); initLocation(); fCountry.requestFocus(); // allows to use Keybord selection } // Kenos else if (e.getSource() == fRegion) { // Modifier for Mouse selection is 16 - for any key selection 0 MRegion r = (MRegion) fRegion.getSelectedItem(); m_location.setRegion(r); // refrseh mainPanel.removeAll(); initLocation(); fRegion.requestFocus(); // allows to use Keybord selection } // Kenos else if (e.getSource() == toLink) { String urlString = GOOGLE_MAPS_URL_PREFIX + getGoogleMapsLocation(m_location); String message = null; try { new URL(urlString); Env.startBrowser(urlString); } catch (Exception ex) { message = ex.getMessage(); ADialog.warn(0, this, "URLnotValid", message); } } else if (e.getSource() == toRoute) { int AD_Org_ID = Env.getAD_Org_ID(Env.getCtx()); if (AD_Org_ID != 0) { MOrgInfo orgInfo = MOrgInfo.get(Env.getCtx(), AD_Org_ID, null); MLocation orgLocation = new MLocation(Env.getCtx(), orgInfo.getC_Location_ID(), null); String urlString = GOOGLE_MAPS_ROUTE_PREFIX + GOOGLE_SOURCE_ADDRESS + getGoogleMapsLocation(orgLocation) + // org GOOGLE_DESTINATION_ADDRESS + getGoogleMapsLocation(m_location); // partner String message = null; try { new URL(urlString); Env.startBrowser(urlString); } catch (Exception ex) { message = ex.getMessage(); ADialog.warn(0, this, "URLnotValid", message); } } } else if (e.getSource() == getAddress) { if (fPostal != null && !fPostal.getText().equals("")) { if (!fAddress1.getText().equals("") || !fAddress2.getText().equals("") || !fAddress3.getText().equals("") || !fAddress4.getText().equals("") || fCity.getSelectedIndex() > 0) { String warningMsg = "O endereço atual será substituido. Deseja continuar?"; String warningTitle = "Aviso"; int response = JOptionPane.showConfirmDialog( null, warningMsg, warningTitle, JOptionPane.YES_NO_OPTION); if (response == JOptionPane.NO_OPTION) return; } WebServiceCep cep = WebServiceCep.searchCep(fPostal.getText()); if (cep.wasSuccessful()) { MRegion[] regions = MRegion.getRegions(Env.getCtx(), 139); for (MRegion r : regions) if (r.getName() != null && r.getName().equals(cep.getUf())) { fRegion.setSelectedItem(r); break; } fCity.setSelectedItem(cep.getCidade()); fAddress1.setText(cep.getLogradouroType() + " " + cep.getLogradouro()); fAddress3.setText(cep.getBairro()); if (cep.getCep().length() == 8) fPostal.setText(cep.getCep().substring(0, 5) + "-" + cep.getCep().substring(5)); else fPostal.setText(cep.getCep()); } else if (cep.getResulCode() == 0) JOptionPane.showMessageDialog(null, "CEP não encontrado na base de dados."); else if (cep.getResulCode() == 14) JOptionPane.showMessageDialog( null, "Não foi possível fazer a busca. (Possível problema com a Internet)."); else JOptionPane.showMessageDialog(null, "Erro ao fazer a busca."); } else JOptionPane.showMessageDialog(null, "Preencha o CEP."); } } // actionPerformed
/** Dynanmic Init & fill fields - Called when Country changes! */ private void initLocation() { // Kenos fCity.setPreferredSize(new Dimension(225, 25)); fCountry.setPreferredSize(new Dimension(225, 25)); // MCountry country = m_location.getCountry(); log.fine( country.getName() + ", Region=" + country.isHasRegion() + " " + country.getDisplaySequence() + ", C_Location_ID=" + m_location.getC_Location_ID()); // new Region if (m_location.getC_Country_ID() != s_oldCountry_ID && country.isHasRegion()) { fRegion = new CComboBox(MRegion.getRegions(Env.getCtx(), country.getC_Country_ID())); if (m_location.getRegion() != null) fRegion.setSelectedItem(m_location.getRegion()); /*else if(m_location.getCountry().getC_Country_ID() == 139 && m_location.getAD_Org_ID() != 0){ int C_Location_ID = MOrgInfo.get(Env.getCtx(),m_location.getAD_Org_ID()).getC_Location_ID(); if (C_Location_ID != 0) { MLocation location = new MLocation(Env.getCtx(), C_Location_ID, null); MRegion region = new MRegion(Env.getCtx(), location.getC_Region_ID(), null); fRegion.setSelectedItem(region); m_location.setRegion(region); // refrseh fRegion.requestFocus(); // allows to use Keybord selection } } */ // Kenos fRegion.addActionListener(this); // lRegion.setText(country.getRegionName()); s_oldCountry_ID = m_location.getC_Country_ID(); } // Kenos// Faire if (m_location.getCountry().isHasRegion() && m_location.getRegion() != null && m_location.getCountry().getC_Country_ID() == 139) // 139 = Brasil { fCity.setEditable(false); fCity.removeAllItems(); fCity = new CComboBox(getCCity()); if (m_location.getC_City_ID() != 0) fCity.setSelectedItem(new MCity(Env.getCtx(), m_location.getC_City_ID(), null)); } else { fCity.removeAllItems(); fCity.setEditable(true); fCity.setSelectedItem(m_location.getCity()); } // Kenos gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridy = 0; // line gbc.gridx = 0; gbc.gridwidth = 1; gbc.insets = fieldInsets; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0; gbc.weighty = 0; mainPanel.add(Box.createVerticalStrut(5), gbc); // top gap int line = 1; addLine(line++, lAddress1, fAddress1); addLine(line++, lAddress2, fAddress2); addLine(line++, lAddress3, fAddress3); addLine(line++, lAddress4, fAddress4); // sequence of City Postal Region - @P@ @C@ - @C@, @R@ @P@ String ds = country.getDisplaySequence(); if (ds == null || ds.length() == 0) { log.log(Level.SEVERE, "DisplaySequence empty - " + country); ds = ""; // @C@, @P@ } StringTokenizer st = new StringTokenizer(ds, "@", false); while (st.hasMoreTokens()) { String s = st.nextToken(); if (s.startsWith("C")) addLine(line++, lCity, fCity); else if (s.startsWith("P")) addLine(line++, lPostal, fPostal); else if (s.startsWith("A")) addLine(line++, lPostalAdd, fPostalAdd); else if (s.startsWith("R") && m_location.getCountry().isHasRegion()) addLine(line++, lRegion, fRegion); } // Country Last addLine(line++, lCountry, fCountry); // Fill it if (m_location.getC_Location_ID() != 0) { fAddress1.setText(m_location.getAddress1()); fAddress2.setText(m_location.getAddress2()); fAddress3.setText(m_location.getAddress3()); fAddress4.setText(m_location.getAddress4()); // fCity.setText(m_location.getCity()); - Kenos (linha comentada) fPostal.setText(m_location.getPostal()); fPostalAdd.setText(m_location.getPostal_Add()); if (m_location.getCountry().isHasRegion()) { lRegion.setText(m_location.getCountry().getRegionName()); fRegion.setSelectedItem(m_location.getRegion()); } fCountry.setSelectedItem(country); } // Update UI pack(); } // initLocation
/** * Static Init * * @throws Exception */ private void jbInit() throws Exception { CompiereColor.setBackground(panel); newBorder = new TitledBorder(""); accountBorder = new TitledBorder(""); mainPanel.setLayout(mainLayout); newPanel.setBorder(newBorder); newPanel.setLayout(newLayout); newBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeNewAccount")); valueLabel.setText(Msg.translate(Env.getCtx(), "Value")); isExpense.setSelected(true); isExpense.setText(Msg.getMsg(Env.getCtx(), "Expense")); nameLabel.setText(Msg.translate(Env.getCtx(), "Name")); nameField.setColumns(20); valueField.setColumns(10); newButton.setText( Msg.getMsg(Env.getCtx(), "Create") + " " + Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New"))); newButton.addActionListener(this); accountPanel.setBorder(accountBorder); accountPanel.setLayout(accountLayout); accountBorder.setTitle(Msg.getMsg(Env.getCtx(), "ChargeFromAccount")); accountButton.setText( Msg.getMsg(Env.getCtx(), "Create") + " " + Msg.getMsg(Env.getCtx(), "From") + " " + Msg.getElement(Env.getCtx(), "Account_ID")); accountButton.addActionListener(this); accountOKPanel.setLayout(accountOKLayout); accountOKLayout.setAlignment(FlowLayout.RIGHT); confirmPanel.setActionListener(this); // mainPanel.add(newPanel, BorderLayout.NORTH); newPanel.add( valueLabel, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); newPanel.add( valueField, new GridBagConstraints( 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); newPanel.add( nameLabel, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); newPanel.add( nameField, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); newPanel.add( isExpense, new GridBagConstraints( 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); newPanel.add( newButton, new GridBagConstraints( 2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); mainPanel.add(accountPanel, BorderLayout.CENTER); accountPanel.add(accountOKPanel, BorderLayout.SOUTH); accountOKPanel.add(accountButton, null); accountPanel.add(dataPane, BorderLayout.CENTER); dataPane.getViewport().add(dataTable, null); } // jbInit
/** * Get Grid Element * * @param xValue X value * @param yValue Y value * @return Panel with Info */ private CPanel getGridElement(MAttributeValue xValue, MAttributeValue yValue) { CPanel element = new CPanel(); element.setBorder(BorderFactory.createLineBorder(Color.BLACK, 2)); element.setLayout(new BoxLayout(element, BoxLayout.Y_AXIS)); String sql = "SELECT * FROM M_Product WHERE IsActive='Y'"; // Product Attributes if (xValue != null) sql += " AND M_AttributeSetInstance_ID IN " + "(SELECT M_AttributeSetInstance_ID " + "FROM M_AttributeInstance " + "WHERE M_Attribute_ID=" + xValue.getM_Attribute_ID() + " AND M_AttributeValue_ID=" + xValue.getM_AttributeValue_ID() + ")"; if (yValue != null) sql += " AND M_AttributeSetInstance_ID IN " + "(SELECT M_AttributeSetInstance_ID " + "FROM M_AttributeInstance " + "WHERE M_Attribute_ID=" + yValue.getM_Attribute_ID() + " AND M_AttributeValue_ID=" + yValue.getM_AttributeValue_ID() + ")"; sql = MRole.getDefault().addAccessSQL(sql, "M_Product", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO); PreparedStatement pstmt = null; int noProducts = 0; try { pstmt = DB.prepareStatement(sql, null); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { MProduct product = new MProduct(Env.getCtx(), rs, null); addProduct(element, product); noProducts++; } rs.close(); pstmt.close(); pstmt = null; } catch (Exception e) { log.log(Level.SEVERE, sql, e); } try { if (pstmt != null) pstmt.close(); pstmt = null; } catch (Exception e) { pstmt = null; } int mode = modeCombo.getSelectedIndex(); // No Products if (noProducts == 0 && mode == MODE_VIEW) { // CButton button = ConfirmPanel.createNewButton(true); // button.addActionListener(this); // element.add(button); } else // Additional Elements { if (mode == MODE_PRICE) { // Price Field } else if (mode == MODE_PO) { // Qty Field } } return element; } // getGridElement
/** * Descripción de Método * * @param index */ private void displayData(int index) { MAttachmentEntry entry = m_attachment.getEntry(index); log.config("Index=" + index + " - " + entry); // Reset UI gifPanel.setImage(null); graphPanel.removeAll(); // bDelete.setEnabled(false); bOpen.setEnabled(false); bSave.setEnabled(false); Dimension size = null; // no attachment if ((entry == null) || (entry.getData() == null)) { info.setText("-"); } else { bOpen.setEnabled(true); bSave.setEnabled(true); bDelete.setEnabled(true); log.config(entry.toStringX()); // info.setText(entry.toStringX()); if (entry.isPDF()) { try { graphPanel.getInsets(); PdfPanel pdfpanel = PdfPanel.loadPdf(entry.getFile(), graphPanel, false, false, true, true, true, true); size = pdfpanel.getSize(); // } catch (Exception e) { log.log(Level.SEVERE, "(pdf)", e); } } else if (entry.isGraphic()) { // Can we display it Image image = Toolkit.getDefaultToolkit().createImage(entry.getData()); if (image != null) { gifPanel.setImage(image); size = gifPanel.getPreferredSize(); if ((size.width == -1) && (size.height == -1)) { log.log(Level.SEVERE, "Invalid Image"); } else { // size.width += 40; // size.height += 40; graphPanel.add(gifScroll, BorderLayout.CENTER); } } else { log.log(Level.SEVERE, "Could not create image"); } } } if (graphPanel.getComponentCount() == 0) { graphPanel.add(info, BorderLayout.CENTER); } log.config("Size=" + size); // graphPanel.setPreferredSize(size); // centerPane.setDividerLocation(size.width+30); // size.width += 100; // size.height += 100; // centerPane.setPreferredSize(size); pack(); } // displayData
/** Descripción de Método */ private void jbInit() { CPanel panel = new CPanel(new ALayout()); panel.add(lCN, new ALayoutConstraint(0, 0)); panel.add(fCN, null); panel.add(lOU, new ALayoutConstraint(1, 0)); panel.add(fOU, null); panel.add(lO, new ALayoutConstraint(2, 0)); panel.add(fO, null); panel.add(lL, new ALayoutConstraint(3, 0)); panel.add(fL, null); panel.add(lS, new ALayoutConstraint(4, 0)); panel.add(fS, null); panel.add(lC, new ALayoutConstraint(5, 0)); panel.add(fC, null); panel.setPreferredSize(new Dimension(400, 150)); // getContentPane().setLayout(new BorderLayout()); getContentPane().add(panel, BorderLayout.CENTER); // CPanel confirmPanel = new CPanel(new FlowLayout(FlowLayout.RIGHT)); confirmPanel.add(bCancel); confirmPanel.add(bOK); getContentPane().add(confirmPanel, BorderLayout.SOUTH); // bCancel.addActionListener(this); bOK.addActionListener(this); } // jbInit
/** * Descripción de Método * * @throws Exception */ void jbInit() throws Exception { CompiereColor.setBackground(this); mainPanel.setLayout(mainLayout); mainLayout.setHgap(5); mainLayout.setVgap(5); this.getContentPane().add(mainPanel); northPanel.setLayout(northLayout); northPanel.add(toolBar, BorderLayout.CENTER); toolBar.add(bLoad); toolBar.add(bDelete); toolBar.add(bSave); toolBar.add(bOpen); toolBar.add(cbContent); mainPanel.add(northPanel, BorderLayout.NORTH); // bOpen.setEnabled(false); bOpen.setIcon(Env.getImageIcon("Editor24.gif")); bOpen.setMargin(new Insets(0, 2, 0, 2)); bOpen.setToolTipText(Msg.getMsg(Env.getCtx(), "Open")); bOpen.addActionListener(this); // bSave.setEnabled(false); bSave.setIcon(Env.getImageIcon("Export24.gif")); bSave.setMargin(new Insets(0, 2, 0, 2)); bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AttachmentSave")); bSave.addActionListener(this); // bLoad.setIcon(Env.getImageIcon("Import24.gif")); bLoad.setMargin(new Insets(0, 2, 0, 2)); bLoad.setToolTipText(Msg.getMsg(Env.getCtx(), "Load")); bLoad.addActionListener(this); // bDelete.setIcon(Env.getImageIcon("Delete24.gif")); bDelete.setMargin(new Insets(0, 2, 0, 2)); bDelete.setToolTipText(Msg.getMsg(Env.getCtx(), "Delete")); bDelete.addActionListener(this); // Dimension size = cbContent.getPreferredSize(); size.width = 200; cbContent.setPreferredSize(size); // cbContent.setToolTipText(text); cbContent.addActionListener(this); cbContent.setLightWeightPopupEnabled(false); // Acrobat Panel is heavy // text.setBackground(CompierePLAF.getInfoBackground()); text.setPreferredSize(new Dimension(200, 200)); // mainPanel.add(confirmPanel, BorderLayout.SOUTH); confirmPanel.addActionListener(this); bDeleteAll = ConfirmPanel.createDeleteButton(true); confirmPanel.addButton(bDeleteAll); bDeleteAll.addActionListener(this); // info.setText("-"); info.setReadWrite(false); graphPanel.add(info, BorderLayout.CENTER); // mainPanel.add(centerPane, BorderLayout.CENTER); centerPane.add(graphPanel, JSplitPane.LEFT); centerPane.add(text, JSplitPane.RIGHT); centerPane.setResizeWeight(.75); // more to graph } // jbInit