Search in sources :

Example 56 with CPanel

use of org.compiere.swing.CPanel in project adempiere by adempiere.

the class ConfigurationPanel method jbInit.

/**
	 * 	Static Layout Init
	 *  @throws Exception
	 */
private void jbInit() throws Exception {
    this.setLayout(gridBagLayout);
    Insets bInsets = new Insets(0, 5, 0, 5);
    TitledBorder titledBorder = new TitledBorder("dummy");
    //	Java
    lJavaHome.setToolTipText(res.getString("JavaHomeInfo"));
    lJavaHome.setText(res.getString("JavaHome"));
    fJavaHome.setText(".");
    okJavaHome.setEnabled(false);
    bJavaHome.setMargin(bInsets);
    bJavaHome.setToolTipText(res.getString("JavaHomeInfo"));
    lJavaType.setToolTipText(res.getString("JavaTypeInfo"));
    lJavaType.setText(res.getString("JavaType"));
    fJavaType.setPreferredSize(fJavaHome.getPreferredSize());
    JLabel sectionLabel = new JLabel("Java");
    sectionLabel.setForeground(titledBorder.getTitleColor());
    JSeparator separator = new JSeparator();
    this.add(sectionLabel, new GridBagConstraints(0, 0, 7, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 10), 0, 0));
    this.add(separator, new GridBagConstraints(0, 1, 7, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
    this.add(lJavaHome, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fJavaHome, new GridBagConstraints(1, 2, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 0), 0, 0));
    this.add(okJavaHome, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
    this.add(bJavaHome, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    this.add(lJavaType, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fJavaType, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
    //	AdempiereHome - KeyStore
    lAdempiereHome.setToolTipText(res.getString("AdempiereHomeInfo"));
    lAdempiereHome.setText(res.getString("AdempiereHome"));
    fAdempiereHome.setText(".");
    okAdempiereHome.setEnabled(false);
    bAdempiereHome.setMargin(bInsets);
    bAdempiereHome.setToolTipText(res.getString("AdempiereHomeInfo"));
    lKeyStore.setText(res.getString("KeyStorePassword"));
    lKeyStore.setToolTipText(res.getString("KeyStorePasswordInfo"));
    fKeyStore.setText("");
    okKeyStore.setEnabled(false);
    sectionLabel = new JLabel("Adempiere");
    sectionLabel.setForeground(titledBorder.getTitleColor());
    separator = new JSeparator();
    this.add(sectionLabel, new GridBagConstraints(0, 3, 7, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
    this.add(separator, new GridBagConstraints(0, 4, 7, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
    this.add(lAdempiereHome, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fAdempiereHome, new GridBagConstraints(1, 5, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
    this.add(okAdempiereHome, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
    this.add(bAdempiereHome, new GridBagConstraints(3, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    this.add(lKeyStore, new GridBagConstraints(4, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    this.add(fKeyStore, new GridBagConstraints(5, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
    this.add(okKeyStore, new GridBagConstraints(6, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    //	Apps Server - Type
    lAppsServer.setToolTipText(res.getString("AppsServerInfo"));
    lAppsServer.setText(res.getString("AppsServer"));
    lAppsServer.setFont(lAppsServer.getFont().deriveFont(Font.BOLD));
    fAppsServer.setText(".");
    okAppsServer.setEnabled(false);
    lAppsType.setToolTipText(res.getString("AppsTypeInfo"));
    lAppsType.setText(res.getString("AppsType"));
    fAppsType.setPreferredSize(fAppsServer.getPreferredSize());
    sectionLabel = new JLabel(res.getString("AppsServer"));
    sectionLabel.setForeground(titledBorder.getTitleColor());
    separator = new JSeparator();
    this.add(sectionLabel, new GridBagConstraints(0, 6, 6, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
    this.add(separator, new GridBagConstraints(0, 7, 7, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
    this.add(lAppsServer, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fAppsServer, new GridBagConstraints(1, 8, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
    this.add(okAppsServer, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
    this.add(lAppsType, new GridBagConstraints(4, 8, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fAppsType, new GridBagConstraints(5, 8, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
    // 	Deployment - JNP
    lDeployDir.setToolTipText(res.getString("DeployDirInfo"));
    lDeployDir.setText(res.getString("DeployDir"));
    fDeployDir.setText(".");
    okDeployDir.setEnabled(false);
    bDeployDir.setMargin(bInsets);
    bDeployDir.setToolTipText(res.getString("DeployDirInfo"));
    lJNPPort.setToolTipText(res.getString("JNPPortInfo"));
    lJNPPort.setText(res.getString("JNPPort"));
    fJNPPort.setText(".");
    okJNPPort.setEnabled(false);
    this.add(lDeployDir, new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fDeployDir, new GridBagConstraints(1, 9, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okDeployDir, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    this.add(bDeployDir, new GridBagConstraints(3, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    this.add(lJNPPort, new GridBagConstraints(4, 9, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fJNPPort, new GridBagConstraints(5, 9, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okJNPPort, new GridBagConstraints(6, 9, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    //	Web Ports
    lWebPort.setToolTipText(res.getString("WebPortInfo"));
    lWebPort.setText(res.getString("WebPort"));
    fWebPort.setText(".");
    okWebPort.setEnabled(false);
    lSSLPort.setText("SSL");
    fSSLPort.setText(".");
    okSSLPort.setEnabled(false);
    this.add(lWebPort, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fWebPort, new GridBagConstraints(1, 10, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okWebPort, new GridBagConstraints(2, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    this.add(lSSLPort, new GridBagConstraints(4, 10, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fSSLPort, new GridBagConstraints(5, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okSSLPort, new GridBagConstraints(6, 10, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    //	Database Server - Type
    lDatabaseServer.setToolTipText(res.getString("DatabaseServerInfo"));
    lDatabaseServer.setText(res.getString("DatabaseServer"));
    lDatabaseServer.setFont(lDatabaseServer.getFont().deriveFont(Font.BOLD));
    okDatabaseServer.setEnabled(false);
    lDatabaseType.setToolTipText(res.getString("DatabaseTypeInfo"));
    lDatabaseType.setText(res.getString("DatabaseType"));
    fDatabaseType.setPreferredSize(fDatabaseServer.getPreferredSize());
    sectionLabel = new JLabel(res.getString("DatabaseServer"));
    sectionLabel.setForeground(titledBorder.getTitleColor());
    separator = new JSeparator();
    this.add(sectionLabel, new GridBagConstraints(0, 11, 6, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
    this.add(separator, new GridBagConstraints(0, 12, 7, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
    this.add(lDatabaseServer, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fDatabaseServer, new GridBagConstraints(1, 13, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 0), 0, 0));
    this.add(okDatabaseServer, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
    this.add(lDatabaseType, new GridBagConstraints(4, 13, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fDatabaseType, new GridBagConstraints(5, 13, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
    //Database/Service Name
    lDatabaseName.setToolTipText(res.getString("DatabaseNameInfo"));
    lDatabaseName.setText(res.getString("DatabaseName"));
    fDatabaseName.setText(".");
    //TNS/Native connection
    lDatabaseDiscovered.setToolTipText(res.getString("TNSNameInfo"));
    lDatabaseDiscovered.setText(res.getString("TNSName"));
    fDatabaseDiscovered.setEditable(true);
    fDatabaseDiscovered.setPreferredSize(fDatabaseName.getPreferredSize());
    okDatabaseSQL.setEnabled(false);
    this.add(lDatabaseName, new GridBagConstraints(0, 14, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fDatabaseName, new GridBagConstraints(1, 14, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okDatabaseSQL, new GridBagConstraints(2, 14, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    this.add(lDatabaseDiscovered, new GridBagConstraints(4, 14, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    this.add(fDatabaseDiscovered, new GridBagConstraints(5, 14, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    //	Port - System
    lDatabasePort.setToolTipText(res.getString("DatabasePortInfo"));
    lDatabasePort.setText(res.getString("DatabasePort"));
    fDatabasePort.setText(".");
    lSystemPassword.setToolTipText(res.getString("SystemPasswordInfo"));
    lSystemPassword.setText(res.getString("SystemPassword"));
    fSystemPassword.setText(".");
    okDatabaseSystem.setEnabled(false);
    this.add(lDatabasePort, new GridBagConstraints(0, 15, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fDatabasePort, new GridBagConstraints(1, 15, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(lSystemPassword, new GridBagConstraints(4, 15, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fSystemPassword, new GridBagConstraints(5, 15, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okDatabaseSystem, new GridBagConstraints(6, 15, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    //	User - Password
    lDatabaseUser.setToolTipText(res.getString("DatabaseUserInfo"));
    lDatabaseUser.setText(res.getString("DatabaseUser"));
    fDatabaseUser.setText(".");
    lDatabasePassword.setToolTipText(res.getString("DatabasePasswordInfo"));
    lDatabasePassword.setText(res.getString("DatabasePassword"));
    fDatabasePassword.setText(".");
    okDatabaseUser.setEnabled(false);
    this.add(lDatabaseUser, new GridBagConstraints(0, 16, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fDatabaseUser, new GridBagConstraints(1, 16, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(2, 5, 2, 0), 0, 0));
    this.add(lDatabasePassword, new GridBagConstraints(4, 16, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fDatabasePassword, new GridBagConstraints(5, 16, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okDatabaseUser, new GridBagConstraints(6, 16, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    sectionLabel = new JLabel(res.getString("MailServer"));
    sectionLabel.setForeground(titledBorder.getTitleColor());
    separator = new JSeparator();
    this.add(sectionLabel, new GridBagConstraints(0, 17, 6, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 0, 0), 0, 0));
    this.add(separator, new GridBagConstraints(0, 18, 7, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 10), 0, 0));
    //	Mail Server - Email
    lMailServer.setToolTipText(res.getString("MailServerInfo"));
    lMailServer.setText(res.getString("MailServer"));
    lMailServer.setFont(lMailServer.getFont().deriveFont(Font.BOLD));
    fMailServer.setText(".");
    lAdminEMail.setToolTipText(res.getString("AdminEMailInfo"));
    lAdminEMail.setText(res.getString("AdminEMail"));
    fAdminEMail.setText(".");
    okMailServer.setEnabled(false);
    //	Mail User = Password
    lMailUser.setToolTipText(res.getString("MailUserInfo"));
    lMailUser.setText(res.getString("MailUser"));
    fMailUser.setText(".");
    lMailPassword.setToolTipText(res.getString("MailPasswordInfo"));
    lMailPassword.setText(res.getString("MailPassword"));
    fMailPassword.setText(".");
    //	FR [ 402 ]
    lMailProtocol.setToolTipText(res.getString("MailProtocolInfo"));
    lMailProtocol.setText(res.getString("MailProtocol"));
    fMailProtocol.setPreferredSize(fMailProtocol.getPreferredSize());
    lEncryptionType.setToolTipText(res.getString("MailEncryptionTypeInfo"));
    lEncryptionType.setText(res.getString("MailEncryptionType"));
    fEncryptionType.setPreferredSize(fEncryptionType.getPreferredSize());
    lAuthMechanism.setToolTipText(res.getString("MailAuthMechanismInfo"));
    lAuthMechanism.setText(res.getString("MailAuthMechanism"));
    fAuthMechanism.setPreferredSize(fAuthMechanism.getPreferredSize());
    lMailPort.setToolTipText(res.getString("MailPortInfo"));
    lMailPort.setText(res.getString("MailPort"));
    fMailPort.setText("25");
    okMailUser.setEnabled(false);
    this.add(lMailServer, new GridBagConstraints(0, 19, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fMailServer, new GridBagConstraints(1, 19, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
    this.add(lMailPort, new GridBagConstraints(4, 19, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fMailPort, new GridBagConstraints(5, 19, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okMailServer, new GridBagConstraints(6, 19, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 2, 5), 0, 0));
    this.add(lMailProtocol, new GridBagConstraints(0, 20, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fMailProtocol, new GridBagConstraints(1, 20, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 5), 0, 0));
    this.add(lAdminEMail, new GridBagConstraints(4, 20, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 2, 5), 0, 0));
    this.add(fAdminEMail, new GridBagConstraints(5, 20, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 2, 0), 0, 0));
    //	FR [ 402 ]
    this.add(lEncryptionType, new GridBagConstraints(0, 21, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fEncryptionType, new GridBagConstraints(1, 21, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0));
    this.add(lAuthMechanism, new GridBagConstraints(4, 21, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fAuthMechanism, new GridBagConstraints(5, 21, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0));
    //	
    this.add(lMailUser, new GridBagConstraints(0, 22, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fMailUser, new GridBagConstraints(1, 22, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
    this.add(lMailPassword, new GridBagConstraints(4, 22, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0));
    this.add(fMailPassword, new GridBagConstraints(5, 22, 1, 1, 0.5, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 0), 0, 0));
    this.add(okMailUser, new GridBagConstraints(6, 22, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 0, 2, 5), 0, 0));
    //grap extra space when window is maximized
    CPanel filler = new CPanel();
    filler.setOpaque(false);
    filler.setBorder(null);
    this.add(filler, new GridBagConstraints(0, 23, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 0), 0, 0));
    //	End
    bTest.setToolTipText(res.getString("TestInfo"));
    bTest.setText(res.getString("Test"));
    bSave.setToolTipText(res.getString("SaveInfo"));
    bSave.setText(res.getString("Save"));
    bHelp.setToolTipText(res.getString("HelpInfo"));
    this.add(bTest, new GridBagConstraints(0, 24, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
    this.add(bHelp, new GridBagConstraints(3, 24, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
    this.add(bSave, new GridBagConstraints(5, 24, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(15, 5, 10, 5), 0, 0));
    //
    bAdempiereHome.addActionListener(this);
    bJavaHome.addActionListener(this);
    bDeployDir.addActionListener(this);
    fJavaType.addActionListener(this);
    fAppsType.addActionListener(this);
    fDatabaseType.addActionListener(this);
    fDatabaseDiscovered.addActionListener(this);
    bHelp.addActionListener(this);
    bTest.addActionListener(this);
    bSave.addActionListener(this);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) CPanel(org.compiere.swing.CPanel) JLabel(javax.swing.JLabel) TitledBorder(javax.swing.border.TitledBorder) JSeparator(javax.swing.JSeparator)

Example 57 with CPanel

use of org.compiere.swing.CPanel in project lar_361 by comitsrl.

the class VCreateFromStatementUI method jbInit.

// dynInit
/**
 *  Static Init.
 *  <pre>
 *  parameterPanel
 *      parameterBankPanel
 *      parameterStdPanel
 *          bPartner/order/invoice/shopment/licator Label/Field
 *  dataPane
 *  southPanel
 *      confirmPanel
 *      statusBar
 *  </pre>
 *  @throws Exception
 */
private void jbInit() throws Exception {
    bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
    authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode"));
    documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType"));
    tipoTarjetaLabel.setText("Tipo de Tarjeta");
    documentNoLabel.setLabelFor(documentNoField);
    dateFromLabel.setLabelFor(dateFromField);
    dateFromField.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
    dateToLabel.setLabelFor(dateToField);
    dateToField.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
    amtFromLabel.setLabelFor(amtFromField);
    amtFromField.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
    amtToLabel.setLabelFor(amtToField);
    amtToField.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
    CPanel parameterPanel = dialog.getParameterPanel();
    parameterPanel.setLayout(new BorderLayout());
    CPanel parameterBankPanel = new CPanel();
    parameterBankPanel.setLayout(new GridBagLayout());
    parameterPanel.add(parameterBankPanel, BorderLayout.CENTER);
    parameterBankPanel.add(bankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    if (bankAccountField != null)
        parameterBankPanel.add(bankAccountField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(documentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    if (documentTypeField != null)
        parameterBankPanel.add(documentTypeField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(tenderTypeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    if (tenderTypeField != null)
        parameterBankPanel.add(tenderTypeField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(tipoTarjetaLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    if (tipoTarjetaField != null)
        parameterBankPanel.add(tipoTarjetaField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(BPartner_idLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterBankPanel.add(bPartnerLookup, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(documentNoLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterBankPanel.add(documentNoField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    /* parameterBankPanel.add(authorizationLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
    			,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    	parameterBankPanel.add(authorizationField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
    			,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); */
    parameterBankPanel.add(amtFromLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterBankPanel.add(amtFromField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(amtToLabel, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterBankPanel.add(amtToField, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(dateFromLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterBankPanel.add(dateFromField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
    parameterBankPanel.add(dateToLabel, new GridBagConstraints(4, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    parameterBankPanel.add(dateToField, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) CPanel(org.compiere.swing.CPanel)

Example 58 with CPanel

use of org.compiere.swing.CPanel in project lar_361 by comitsrl.

the class VPAttributeDialog method reloadWindow.

// actionPerformed
/**
 * Allow show/edit the attribute set instance recently selected
 * @author Emiliano Pereyra
 */
private void reloadWindow() {
    this.getContentPane().remove(centerPanel);
    centerLayout = new ALayout(5, 5, true);
    centerPanel = new CPanel();
    m_editors = new ArrayList<CEditor>();
    m_row = 0;
    try {
        jbInit();
    } catch (Exception ex) {
        log.log(Level.SEVERE, "VPAttributeDialog", ex);
    }
    initAttributes();
    cbNewEdit.setSelected(true);
    cmd_newEdit();
    pack();
}
Also used : CEditor(org.compiere.swing.CEditor) CPanel(org.compiere.swing.CPanel) ALayout(org.compiere.apps.ALayout)

Example 59 with CPanel

use of org.compiere.swing.CPanel in project lar_361 by comitsrl.

the class PosKeyPanel method createCard.

/**
 * @return
 */
private CPanel createCard(int C_POSKeyLayout_ID) {
    // already added
    if (keymap.containsKey(C_POSKeyLayout_ID)) {
        return null;
    }
    CPanel card = new CPanel();
    card.setLayout(new MigLayout("fill, ins 0"));
    MPOSKeyLayout keyLayout = MPOSKeyLayout.get(Env.getCtx(), C_POSKeyLayout_ID);
    Color stdColor = Color.lightGray;
    if (keyLayout.getAD_PrintColor_ID() != 0) {
        MPrintColor color = MPrintColor.get(Env.getCtx(), keyLayout.getAD_PrintColor_ID());
        stdColor = color.getColor();
    }
    Font stdFont = AdempierePLAF.getFont_Field();
    if (keyLayout.getAD_PrintFont_ID() != 0) {
        MPrintFont font = MPrintFont.get(keyLayout.getAD_PrintFont_ID());
        stdFont = font.getFont();
    }
    if (keyLayout.get_ID() == 0)
        return null;
    MPOSKey[] keys = keyLayout.getKeys(false);
    HashMap<Integer, MPOSKey> map = new HashMap<Integer, MPOSKey>(keys.length);
    keymap.put(C_POSKeyLayout_ID, map);
    // Min Columns
    int COLUMNS = 3;
    // Min Rows
    int ROWS = 3;
    int noKeys = keys.length;
    int cols = keyLayout.getColumns();
    if (cols == 0)
        cols = COLUMNS;
    int buttons = 0;
    log.fine("PosSubFunctionKeys.init - NoKeys=" + noKeys + ", Cols=" + cols);
    // Content
    CPanel content = new CPanel(new MigLayout("fill, wrap " + Math.max(cols, 3)));
    String buttonSize = "h 50, w 50, growx, growy, sg button,";
    for (MPOSKey key : keys) {
        if (key.getSubKeyLayout_ID() > 0) {
            CPanel subCard = createCard(key.getSubKeyLayout_ID());
            if (subCard != null)
                add(subCard, Integer.toString(key.getSubKeyLayout_ID()));
        }
        map.put(key.getC_POSKey_ID(), key);
        Color keyColor = stdColor;
        Font keyFont = stdFont;
        StringBuffer buttonHTML = new StringBuffer("<html><p>");
        if (key.getAD_PrintColor_ID() != 0) {
            MPrintColor color = MPrintColor.get(Env.getCtx(), key.getAD_PrintColor_ID());
            keyColor = color.getColor();
        }
        if (key.getAD_PrintFont_ID() != 0) {
            MPrintFont font = MPrintFont.get(key.getAD_PrintFont_ID());
            keyFont = font.getFont();
        }
        buttonHTML.append(key.getName());
        buttonHTML.append("</p></html>");
        log.fine("#" + map.size() + " - " + keyColor);
        CButton button = new CButton(buttonHTML.toString());
        button.setBackground(keyColor);
        button.setFont(keyFont);
        if (key.getAD_Image_ID() != 0) {
            MImage image = MImage.get(Env.getCtx(), key.getAD_Image_ID());
            Icon icon = image.getIcon();
            button.setIcon(icon);
            button.setVerticalTextPosition(SwingConstants.BOTTOM);
            button.setHorizontalTextPosition(SwingConstants.CENTER);
        }
        button.setFocusable(false);
        if (!key.isActive())
            button.setEnabled(false);
        button.setActionCommand(String.valueOf(key.getC_POSKey_ID()));
        button.addActionListener(this);
        String constraints = buttonSize;
        int size = 1;
        if (key.getSpanX() > 1) {
            constraints += "spanx " + key.getSpanX() + ",";
            size = key.getSpanX();
        }
        if (key.getSpanY() > 1) {
            constraints += "spany " + key.getSpanY() + ",";
            size = size * key.getSpanY();
        }
        buttons = buttons + size;
        content.add(button, constraints);
    }
    int rows = Math.max((buttons / cols), ROWS);
    if (buttons % cols > 0)
        rows = rows + 1;
    for (int i = buttons; i < rows * cols; i++) {
        CButton button = new CButton("");
        button.setFocusable(false);
        button.setReadWrite(false);
        content.add(button, buttonSize);
    }
    CScrollPane scroll = new CScrollPane(content);
    // scroll.setPreferredSize(new Dimension( 600 - 20, 400-20));
    card.add(scroll, "growx, growy");
    // increase scrollbar width for touchscreen
    scroll.getVerticalScrollBar().setPreferredSize(new Dimension(30, 0));
    scroll.getHorizontalScrollBar().setPreferredSize(new Dimension(0, 30));
    return card;
}
Also used : HashMap(java.util.HashMap) MPOSKeyLayout(org.compiere.model.MPOSKeyLayout) CScrollPane(org.compiere.swing.CScrollPane) MigLayout(net.miginfocom.swing.MigLayout) Color(java.awt.Color) MPrintColor(org.compiere.print.MPrintColor) CPanel(org.compiere.swing.CPanel) MPrintFont(org.compiere.print.MPrintFont) Dimension(java.awt.Dimension) Font(java.awt.Font) MPrintFont(org.compiere.print.MPrintFont) MImage(org.compiere.model.MImage) MPrintColor(org.compiere.print.MPrintColor) MPOSKey(org.compiere.model.MPOSKey) Icon(javax.swing.Icon) CButton(org.compiere.swing.CButton)

Example 60 with CPanel

use of org.compiere.swing.CPanel in project lar_361 by comitsrl.

the class PosPayment method init.

private void init() {
    Font font = AdempierePLAF.getFont_Field().deriveFont(18f);
    // North
    CPanel mainPanel = new CPanel(new MigLayout("hidemode 3", "[100:100:300, trailing]20[200:200:300,grow, trailing]"));
    getContentPane().add(mainPanel);
    mainPanel.setBorder(new TitledBorder(Msg.translate(p_ctx, "Payment")));
    CLabel gtLabel = new CLabel(Msg.translate(p_ctx, "GrandTotal"));
    mainPanel.add(gtLabel, "growx");
    mainPanel.add(fTotal, "wrap, growx");
    fTotal.setEditable(false);
    fTotal.setFont(font);
    fTotal.setHorizontalAlignment(JTextField.TRAILING);
    mainPanel.add(new CLabel(Msg.translate(p_ctx, "Balance")), "growx");
    mainPanel.add(fBalance, "wrap, growx");
    fBalance.setEditable(false);
    fBalance.setFont(font);
    fBalance.setHorizontalAlignment(JTextField.TRAILING);
    mainPanel.add(new CLabel(Msg.translate(p_ctx, "TenderType"), "growx"));
    // Payment type selection
    // C_Payment_v.TenderType
    int AD_Column_ID = 8416;
    MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, 0, AD_Column_ID, DisplayType.List);
    ArrayList<Object> types = lookup.getData(true, false, true, true);
    DefaultComboBoxModel typeModel = new DefaultComboBoxModel(types.toArray());
    tenderTypePick.setModel(typeModel);
    // default to cash payment
    for (Object obj : types) {
        if (obj instanceof ValueNamePair) {
            ValueNamePair key = (ValueNamePair) obj;
            if (key.getID().equals("X")) {
                // Cash
                tenderTypePick.setSelectedItem(key);
            }
            if (!"CDKXT".contains(key.getID())) {
                tenderTypePick.removeItem(key);
            }
            if (key.getID().equals("T")) {
                // Account
                accountKey = key;
            }
        }
    }
    tenderTypePick.setFont(font);
    tenderTypePick.addActionListener(this);
    // red1 for ID purpuse during testing
    tenderTypePick.setName("tenderTypePick");
    tenderTypePick.setRenderer(new ListCellRenderer() {

        protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            renderer.setPreferredSize(new Dimension(50, 50));
            renderer.setHorizontalAlignment(JLabel.CENTER);
            return renderer;
        }
    });
    mainPanel.add(tenderTypePick, "wrap, h 50!, growx");
    /**
     *  Load Payment Terms
     */
    String sql = "SELECT C_PaymentTerm_ID, Name " + "  FROM C_PaymentTerm " + " WHERE IsActive='Y' AND AD_Client_ID=? ORDER BY Name";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        pstmt.setInt(1, Env.getAD_Client_ID(p_ctx));
        rs = pstmt.executeQuery();
        while (rs.next()) {
            int key = rs.getInt(1);
            String name = rs.getString(2);
            KeyNamePair pp = new KeyNamePair(key, name);
            fCPaymentTerm.addItem(pp);
        }
    } catch (SQLException e) {
        log.log(Level.SEVERE, sql, e);
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    fCPaymentTerm.setFont(font);
    lCPaymentTerm = new CLabel(Msg.translate(p_ctx, "PaymentTerms"));
    mainPanel.add(lCPaymentTerm, "growx");
    mainPanel.add(fCPaymentTerm, "wrap, h 50!, growx");
    fPayAmt = new PosTextField(Msg.translate(p_ctx, "PayAmt"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), DisplayType.getNumberFormat(DisplayType.Amount));
    lPayAmt = new CLabel(Msg.translate(p_ctx, "PayAmt"));
    mainPanel.add(lPayAmt, "growx");
    fPayAmt.setFont(font);
    fPayAmt.setEditable(false);
    fPayAmt.setHorizontalAlignment(JTextField.TRAILING);
    fPayAmt.addActionListener(this);
    mainPanel.add(fPayAmt, "wrap, growx");
    fTenderAmt = new PosTextField(Msg.translate(p_ctx, "AmountTendered"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), DisplayType.getNumberFormat(DisplayType.Amount));
    lTenderAmt = new CLabel(Msg.translate(p_ctx, "AmountTendered"));
    mainPanel.add(lTenderAmt, "growx");
    fTenderAmt.addActionListener(this);
    fTenderAmt.setFont(font);
    fTenderAmt.setHorizontalAlignment(JTextField.TRAILING);
    mainPanel.add(fTenderAmt, "wrap, growx");
    fReturnAmt = new PosTextField(Msg.translate(p_ctx, "AmountReturned"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), DisplayType.getNumberFormat(DisplayType.Amount));
    lReturnAmt = new CLabel(Msg.translate(p_ctx, "AmountReturned"));
    mainPanel.add(lReturnAmt, "growx");
    fReturnAmt.setFont(font);
    fReturnAmt.setHorizontalAlignment(JTextField.TRAILING);
    mainPanel.add(fReturnAmt, "wrap, growx");
    fReturnAmt.setEditable(false);
    fCheckRouteNo = new PosTextField(Msg.translate(p_ctx, "RoutingNo"), p_posPanel, p_pos.getOSNP_KeyLayout_ID());
    lCheckRouteNo = new CLabel(Msg.translate(p_ctx, "RoutingNo"));
    mainPanel.add(lCheckRouteNo, "growx");
    mainPanel.add(fCheckRouteNo, "wrap, growx");
    fCheckRouteNo.setFont(font);
    fCheckRouteNo.setHorizontalAlignment(JTextField.TRAILING);
    fCheckAccountNo = new PosTextField(Msg.translate(p_ctx, "AccountNo"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
    lCheckAccountNo = new CLabel(Msg.translate(p_ctx, "AccountNo"));
    mainPanel.add(lCheckAccountNo, "growx");
    mainPanel.add(fCheckAccountNo, "wrap, growx");
    fCheckAccountNo.setFont(font);
    fCheckAccountNo.setHorizontalAlignment(JTextField.TRAILING);
    fCheckNo = new PosTextField(Msg.translate(p_ctx, "CheckNo"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
    lCheckNo = new CLabel(Msg.translate(p_ctx, "CheckNo"));
    mainPanel.add(lCheckNo, "growx");
    mainPanel.add(fCheckNo, "wrap, growx");
    fCheckNo.setFont(font);
    fCheckNo.setHorizontalAlignment(JTextField.TRAILING);
    fCheckAccountName = new PosTextField(Msg.translate(p_ctx, "A_Name"), p_posPanel, p_pos.getOSNP_KeyLayout_ID());
    lCheckAccountName = new CLabel(Msg.translate(p_ctx, "A_Name"));
    mainPanel.add(lCheckAccountName, "growx");
    mainPanel.add(fCheckAccountName, "wrap, growx");
    fCheckAccountName.setFont(font);
    fCheckAccountName.setHorizontalAlignment(JTextField.TRAILING);
    /**
     *	Load Credit Cards
     */
    ValueNamePair[] ccs = p_order.getCreditCards((BigDecimal) fPayAmt.getValue());
    // Set Selection
    fCCardType = new CComboBox(ccs);
    // red1 Id for testing
    fCCardType.setName("cardType");
    fCCardType.setRenderer(new ListCellRenderer() {

        protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();

        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            renderer.setPreferredSize(new Dimension(50, 50));
            renderer.setHorizontalAlignment(JLabel.CENTER);
            return renderer;
        }
    });
    lCCardType = new CLabel(Msg.translate(p_ctx, "CreditCardType"));
    mainPanel.add(lCCardType, "growx");
    mainPanel.add(fCCardType, "h 50, wrap, growx");
    fCCardType.setFont(font);
    fCCardNo = new PosTextField(Msg.translate(p_ctx, "CreditCardNumber"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
    lCCardNo = new CLabel(Msg.translate(p_ctx, "CreditCardNumber"));
    fCCardNo.setName("cardNo");
    mainPanel.add(lCCardNo, "growx");
    mainPanel.add(fCCardNo, "wrap, growx");
    fCCardNo.setFont(font);
    fCCardNo.setHorizontalAlignment(JTextField.TRAILING);
    fCCardName = new PosTextField(Msg.translate(p_ctx, "Name"), p_posPanel, p_pos.getOSK_KeyLayout_ID());
    lCCardName = new CLabel(Msg.translate(p_ctx, "Name"));
    mainPanel.add(lCCardName, "growx");
    mainPanel.add(fCCardName, "wrap, growx");
    fCCardName.setFont(font);
    fCCardName.setHorizontalAlignment(JTextField.TRAILING);
    fCCardMonth = new PosTextField(Msg.translate(p_ctx, "Expires"), p_posPanel, p_pos.getOSNP_KeyLayout_ID());
    lCCardMonth = new CLabel(Msg.translate(p_ctx, "Expires"));
    fCCardMonth.setName("expiry");
    mainPanel.add(lCCardMonth, "growx");
    mainPanel.add(fCCardMonth, "wrap, w 75!");
    fCCardMonth.setFont(font);
    fCCardMonth.setHorizontalAlignment(JTextField.TRAILING);
    fCCardVC = new PosTextField(Msg.translate(p_ctx, "CVC"), p_posPanel, p_pos.getOSNP_KeyLayout_ID(), new DecimalFormat("#"));
    lCCardVC = new CLabel(Msg.translate(p_ctx, "CVC"));
    mainPanel.add(lCCardVC, "growx");
    mainPanel.add(fCCardVC, "wrap, w 75!");
    fCCardVC.setFont(font);
    fCCardVC.setHorizontalAlignment(JTextField.TRAILING);
    fPrintShipment.setText("Imprimir Remito");
    fPrintShipment.setSelected(true);
    mainPanel.add(fPrintShipment, "skip, wrap, growx");
    AppsAction actCancel = new AppsAction("Cancel", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
    actCancel.setDelegate(this);
    f_bCancel = (CButton) actCancel.getButton();
    f_bCancel.setFocusable(false);
    mainPanel.add(f_bCancel, "h 50!, w 50!, skip, split 2, trailing");
    AppsAction act = new AppsAction("Ok", KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), false);
    act.setDelegate(this);
    f_bProcess = (CButton) act.getButton();
    f_bProcess.setFocusable(false);
    mainPanel.add(f_bProcess, "h 50!, w 50!");
    pack();
    setTotals();
}
Also used : CLabel(org.compiere.swing.CLabel) CComboBox(org.compiere.swing.CComboBox) SQLException(java.sql.SQLException) DecimalFormat(java.text.DecimalFormat) TitledBorder(javax.swing.border.TitledBorder) Font(java.awt.Font) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) DefaultListCellRenderer(javax.swing.DefaultListCellRenderer) ListCellRenderer(javax.swing.ListCellRenderer) ResultSet(java.sql.ResultSet) ValueNamePair(org.compiere.util.ValueNamePair) Component(java.awt.Component) MigLayout(net.miginfocom.swing.MigLayout) MLookup(org.compiere.model.MLookup) CPanel(org.compiere.swing.CPanel) JLabel(javax.swing.JLabel) PreparedStatement(java.sql.PreparedStatement) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) Dimension(java.awt.Dimension) AppsAction(org.compiere.apps.AppsAction) KeyNamePair(org.compiere.util.KeyNamePair) JList(javax.swing.JList)

Aggregations

CPanel (org.compiere.swing.CPanel)64 Dimension (java.awt.Dimension)29 GridBagConstraints (java.awt.GridBagConstraints)28 Insets (java.awt.Insets)28 BorderLayout (java.awt.BorderLayout)24 GridBagLayout (java.awt.GridBagLayout)21 CLabel (org.compiere.swing.CLabel)20 MigLayout (net.miginfocom.swing.MigLayout)10 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)10 TitledBorder (javax.swing.border.TitledBorder)9 ALayout (org.compiere.apps.ALayout)9 VLookup (org.compiere.grid.ed.VLookup)9 CScrollPane (org.compiere.swing.CScrollPane)9 JScrollPane (javax.swing.JScrollPane)8 FlowLayout (java.awt.FlowLayout)7 Component (java.awt.Component)6 AppsAction (org.compiere.apps.AppsAction)6 VNumber (org.compiere.grid.ed.VNumber)5 MLookup (org.compiere.model.MLookup)5 CButton (org.compiere.swing.CButton)5