/** 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
/** * 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