Search in sources :

Example 36 with CButton

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

the class POSSubPanel method createButton.

//	getButtonAction
/**
	 * 	Create Standard Button
	 *	@param text text
	 *	@return button
	 */
protected CButton createButton(String text) {
    //	if (text.indexOf("<html>") == -1)
    //		text = "<html><h4>" + text + "</h4></html>";
    CButton button = new CButton(text);
    button.addActionListener(this);
    button.setPreferredSize(new Dimension(WIDTH, HEIGHT));
    button.setMinimumSize(new Dimension(WIDTH, HEIGHT));
    button.setMaximumSize(new Dimension(WIDTH, HEIGHT));
    button.setFocusable(false);
    return button;
}
Also used : Dimension(java.awt.Dimension) CButton(org.compiere.swing.CButton)

Example 37 with CButton

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

the class ALogin method jbInit.

/**************************************************************************
	 *	Component initialization
	 *  @throws Exception
	 */
private void jbInit() throws Exception {
    this.setName("Login");
    titleLabel.setFont(new java.awt.Font("Serif", 2, 10));
    titleLabel.setForeground(Color.blue);
    titleLabel.setRequestFocusEnabled(false);
    titleLabel.setToolTipText(Adempiere.getURL());
    titleLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    titleLabel.setIcon(Adempiere.getImageIconLogo());
    titleLabel.setText(Adempiere.getSubtitle());
    titleLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
    versionLabel.setRequestFocusEnabled(false);
    versionLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    versionLabel.setHorizontalTextPosition(SwingConstants.RIGHT);
    hostLabel.setRequestFocusEnabled(false);
    hostLabel.setLabelFor(hostField);
    hostField.addActionListener(this);
    userLabel.setRequestFocusEnabled(false);
    userLabel.setLabelFor(userTextField);
    passwordLabel.setRequestFocusEnabled(false);
    passwordLabel.setLabelFor(passwordField);
    languageLabel.setLabelFor(languageCombo);
    copy0Label.setFont(new java.awt.Font("Serif", 2, 10));
    copy0Label.setForeground(Color.blue);
    copy0Label.setRequestFocusEnabled(false);
    copy1Label.setRequestFocusEnabled(false);
    roleLabel.setRequestFocusEnabled(false);
    roleLabel.setLabelFor(roleCombo);
    clientLabel.setRequestFocusEnabled(false);
    orgLabel.setRequestFocusEnabled(false);
    dateLabel.setRequestFocusEnabled(false);
    warehouseLabel.setRequestFocusEnabled(false);
    printerLabel.setRequestFocusEnabled(false);
    compileDate.setHorizontalAlignment(SwingConstants.RIGHT);
    compileDate.setHorizontalTextPosition(SwingConstants.RIGHT);
    compileDate.setText(Adempiere.DATE_VERSION);
    compileDate.setToolTipText(Adempiere.getImplementationVendor());
    southPanel.setLayout(southLayout);
    loginTabPane.addChangeListener(this);
    //	ConnectionTab
    connectionPanel.setLayout(connectionLayout);
    //
    titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setText(Adempiere.MAIN_VERSION);
    versionLabel.setToolTipText(Adempiere.getImplementationVersion());
    hostLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    hostLabel.setText("Host");
    hostLabel.setLabelFor(hostField);
    connectionPanel.add(hostLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    connectionPanel.add(hostField, new GridBagConstraints(1, 2, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    userLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    userLabel.setText("User");
    userLabel.setLabelFor(userTextField);
    connectionPanel.add(userLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    //	default
    userTextField.setText("System");
    connectionPanel.add(userTextField, new GridBagConstraints(1, 3, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    passwordLabel.setText("Password");
    passwordLabel.setLabelFor(passwordField);
    connectionPanel.add(passwordLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
    //	default
    passwordField.setText("System");
    connectionPanel.add(passwordField, new GridBagConstraints(1, 4, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
    languageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    languageLabel.setText("Language");
    languageLabel.setLabelFor(languageCombo);
    languageCombo.addActionListener(this);
    // @Trifon - begin
    connectionPanel.add(languageLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    connectionPanel.add(languageCombo, new GridBagConstraints(1, 5, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    // @Trifon - end
    copy0Label.setHorizontalAlignment(SwingConstants.RIGHT);
    connectionPanel.add(copy0Label, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    copy1Label.setText(Adempiere.COPYRIGHT);
    connectionPanel.add(copy1Label, new GridBagConstraints(1, 6, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 12, 12), 0, 0));
    connectionPanel.add(compileDate, new GridBagConstraints(2, 1, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(2, 0, 0, 12), 0, 0));
    connectionPanel.add(titleLabel, new GridBagConstraints(0, 0, 2, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
    connectionPanel.add(versionLabel, new GridBagConstraints(2, 0, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 5, 0, 12), 0, 0));
    loginTabPane.add(connectionPanel, res.getString("Connection"));
    //	DefaultTab
    defaultPanel.setLayout(defaultPanelLayout);
    //
    roleLabel.setText("Role");
    roleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    roleLabel.setLabelFor(roleCombo);
    roleCombo.addActionListener(this);
    defaultPanel.add(roleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
    defaultPanel.add(roleCombo, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0));
    clientLabel.setText("Client");
    clientLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    clientLabel.setLabelFor(clientCombo);
    defaultPanel.add(clientLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    clientCombo.addActionListener(this);
    defaultPanel.add(clientCombo, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    orgLabel.setText("Organization");
    orgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    orgLabel.setLabelFor(orgCombo);
    defaultPanel.add(orgLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
    orgCombo.addActionListener(this);
    defaultPanel.add(orgCombo, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
    dateLabel.setText("Date");
    dateLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    dateLabel.setLabelFor(dateField);
    defaultPanel.add(dateLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    defaultPanel.add(dateField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    //
    warehouseLabel.setText("Warehouse");
    warehouseLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    warehouseLabel.setLabelFor(warehouseCombo);
    printerLabel.setText("Printer");
    printerLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    printerLabel.setLabelFor(printerField);
    defaultPanel.add(printerLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 12, 5), 0, 0));
    defaultPanel.add(printerField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 12), 0, 0));
    defaultPanel.add(warehouseLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    defaultPanel.add(warehouseCombo, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    // @Trifon - begin
    /*		
		defaultPanel.add(languageLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0
				, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
		defaultPanel.add(languageCombo,    new GridBagConstraints(1, 6, 3, 1, 1.0, 0.0
				, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
*/
    // @Trifon - end
    //
    loginTabPane.add(defaultPanel, res.getString("Defaults"));
    //  Help
    /*
		helpPanel.setLayout(helpLayout);
		helpPanel.setPreferredSize(new Dimension (100,100));
		helpPanel.add(helpScollPane,  BorderLayout.CENTER);
		loginTabPane.add(helpPanel,  "?");*/
    //
    this.getContentPane().add(mainPanel);
    mainPanel.add(loginTabPane, BorderLayout.CENTER);
    mainPanel.setName("loginMainPanel");
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    //
    southPanel.add(confirmPanel, BorderLayout.NORTH);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    //helpScollPane.getViewport().add(onlineHelp, null);
    confirmPanel.addActionListener(this);
    CButton helpBtn = new CButton(Env.getImageIcon2("Help24"));
    helpBtn.setActionCommand("onlineLoginHelp");
    helpBtn.addActionListener(this);
    helpBtn.setToolTipText(res.getString("Help"));
    confirmPanel.addComponent(helpBtn);
    statusBar.setStatusDB(null);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) CButton(org.compiere.swing.CButton)

Example 38 with CButton

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

the class ALogin method jbInit.

/**
 ************************************************************************
 *	Component initialization
 *  @throws Exception
 */
private void jbInit() throws Exception {
    this.setName("Login");
    // red1 - giving names to input fields for UISpec4J calling during tests
    orgCombo.setName("orgCombo");
    clientCombo.setName("clientCombo");
    userTextField.setName("userTextField");
    passwordField.setName("passwordField");
    // red1 - end -
    titleLabel.setFont(new java.awt.Font("Serif", 2, 10));
    titleLabel.setForeground(Color.blue);
    titleLabel.setRequestFocusEnabled(false);
    titleLabel.setToolTipText(Adempiere.getURL());
    titleLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    titleLabel.setIcon(Adempiere.getImageIconLogo());
    titleLabel.setText(Adempiere.getSubtitle());
    titleLabel.setVerticalTextPosition(SwingConstants.BOTTOM);
    versionLabel.setRequestFocusEnabled(false);
    versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    hostLabel.setRequestFocusEnabled(false);
    hostLabel.setLabelFor(hostField);
    hostField.addActionListener(this);
    userLabel.setRequestFocusEnabled(false);
    userLabel.setLabelFor(userTextField);
    passwordLabel.setRequestFocusEnabled(false);
    passwordLabel.setLabelFor(passwordField);
    languageLabel.setLabelFor(languageCombo);
    copy0Label.setFont(new java.awt.Font("Serif", 2, 10));
    copy0Label.setForeground(Color.blue);
    copy0Label.setRequestFocusEnabled(false);
    copy1Label.setRequestFocusEnabled(false);
    roleLabel.setRequestFocusEnabled(false);
    roleLabel.setLabelFor(roleCombo);
    clientLabel.setRequestFocusEnabled(false);
    orgLabel.setRequestFocusEnabled(false);
    dateLabel.setRequestFocusEnabled(false);
    warehouseLabel.setRequestFocusEnabled(false);
    printerLabel.setRequestFocusEnabled(false);
    compileDate.setHorizontalAlignment(SwingConstants.CENTER);
    compileDate.setHorizontalTextPosition(SwingConstants.CENTER);
    compileDate.setText(Adempiere.DATE_VERSION);
    compileDate.setToolTipText(Adempiere.getImplementationVendor());
    southPanel.setLayout(southLayout);
    loginTabPane.addChangeListener(this);
    // ConnectionTab
    connectionPanel.setLayout(connectionLayout);
    // 
    titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setText(Adempiere.MAIN_VERSION);
    versionLabel.setToolTipText(Adempiere.getImplementationVersion());
    hostLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    hostLabel.setText("Host");
    hostLabel.setLabelFor(hostField);
    connectionPanel.add(hostLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    connectionPanel.add(hostField, new GridBagConstraints(1, 2, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    userLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    userLabel.setText("User");
    userLabel.setLabelFor(userTextField);
    connectionPanel.add(userLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    // default
    userTextField.setText("System");
    connectionPanel.add(userTextField, new GridBagConstraints(1, 3, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    passwordLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    passwordLabel.setText("Password");
    passwordLabel.setLabelFor(passwordField);
    connectionPanel.add(passwordLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
    // default
    passwordField.setText("System");
    connectionPanel.add(passwordField, new GridBagConstraints(1, 4, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
    languageLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    languageLabel.setText("Language");
    languageLabel.setLabelFor(languageCombo);
    languageCombo.addActionListener(this);
    // @Trifon - begin
    connectionPanel.add(languageLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    connectionPanel.add(languageCombo, new GridBagConstraints(1, 5, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    // @Trifon - end
    copy0Label.setHorizontalAlignment(SwingConstants.RIGHT);
    connectionPanel.add(copy0Label, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
    copy1Label.setText(Adempiere.COPYRIGHT + " - " + Adempiere.getImplementationVendor());
    connectionPanel.add(copy1Label, new GridBagConstraints(1, 6, 2, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 12, 12), 0, 0));
    connectionPanel.add(compileDate, new GridBagConstraints(2, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 0, 0, 12), 0, 0));
    connectionPanel.add(titleLabel, new GridBagConstraints(0, 0, 2, 2, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
    connectionPanel.add(versionLabel, new GridBagConstraints(2, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(12, 5, 0, 12), 0, 0));
    loginTabPane.add(connectionPanel, res.getString("Connection"));
    // DefaultTab
    defaultPanel.setLayout(defaultPanelLayout);
    // 
    roleLabel.setText("Role");
    roleLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    roleLabel.setLabelFor(roleCombo);
    roleCombo.addActionListener(this);
    defaultPanel.add(roleLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(12, 12, 5, 5), 0, 0));
    defaultPanel.add(roleCombo, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(12, 0, 5, 12), 0, 0));
    clientLabel.setText("Client");
    clientLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    clientLabel.setLabelFor(clientCombo);
    defaultPanel.add(clientLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    clientCombo.addActionListener(this);
    defaultPanel.add(clientCombo, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    orgLabel.setText("Organization");
    orgLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    orgLabel.setLabelFor(orgCombo);
    defaultPanel.add(orgLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
    orgCombo.addActionListener(this);
    defaultPanel.add(orgCombo, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 12), 0, 0));
    dateLabel.setText("Date");
    dateLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    dateLabel.setLabelFor(dateField);
    defaultPanel.add(dateLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    defaultPanel.add(dateField, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    // 
    warehouseLabel.setText("Warehouse");
    warehouseLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    warehouseLabel.setLabelFor(warehouseCombo);
    printerLabel.setText("Printer");
    printerLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    printerLabel.setLabelFor(printerField);
    defaultPanel.add(printerLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 12, 5), 0, 0));
    defaultPanel.add(printerField, new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 12, 12), 0, 0));
    defaultPanel.add(warehouseLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
    defaultPanel.add(warehouseCombo, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
    // @Trifon - begin
    /*		
		defaultPanel.add(languageLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0
				, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 12, 5, 5), 0, 0));
		defaultPanel.add(languageCombo,    new GridBagConstraints(1, 6, 3, 1, 1.0, 0.0
				, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 12), 0, 0));
*/
    // @Trifon - end
    // 
    loginTabPane.add(defaultPanel, res.getString("Defaults"));
    // Help
    /*
		helpPanel.setLayout(helpLayout);
		helpPanel.setPreferredSize(new Dimension (100,100));
		helpPanel.add(helpScollPane,  BorderLayout.CENTER);
		loginTabPane.add(helpPanel,  "?");*/
    // 
    this.getContentPane().add(mainPanel);
    mainPanel.add(loginTabPane, BorderLayout.CENTER);
    mainPanel.setName("loginMainPanel");
    mainPanel.add(southPanel, BorderLayout.SOUTH);
    // 
    southPanel.add(confirmPanel, BorderLayout.NORTH);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    // helpScollPane.getViewport().add(onlineHelp, null);
    confirmPanel.addActionListener(this);
    CButton helpBtn = new CButton(Env.getImageIcon2("Help24"));
    helpBtn.setActionCommand("onlineLoginHelp");
    helpBtn.addActionListener(this);
    helpBtn.setToolTipText(res.getString("Help"));
    confirmPanel.addComponent(helpBtn);
    statusBar.setStatusDB(null);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) CButton(org.compiere.swing.CButton)

Example 39 with CButton

use of org.compiere.swing.CButton 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 40 with CButton

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

the class PosSubPanel method createButtonAction.

// dispose
/**
 * 	Create Action Button
 *	@param action action
 *	@return button
 */
protected CButton createButtonAction(String action, KeyStroke accelerator) {
    AppsAction act = new AppsAction(action, accelerator, false);
    act.setDelegate(this);
    CButton button = (CButton) act.getButton();
    button.setPreferredSize(new Dimension(WIDTH, HEIGHT));
    button.setMinimumSize(getPreferredSize());
    button.setMaximumSize(getPreferredSize());
    button.setFocusable(false);
    return button;
}
Also used : AppsAction(org.compiere.apps.AppsAction) Dimension(java.awt.Dimension) CButton(org.compiere.swing.CButton)

Aggregations

CButton (org.compiere.swing.CButton)40 Insets (java.awt.Insets)11 Dimension (java.awt.Dimension)9 AppsAction (org.compiere.apps.AppsAction)6 CPanel (org.compiere.swing.CPanel)5 GridBagConstraints (java.awt.GridBagConstraints)3 ImageIcon (javax.swing.ImageIcon)3 VLookup (org.compiere.grid.ed.VLookup)3 MLookup (org.compiere.model.MLookup)3 BorderLayout (java.awt.BorderLayout)2 Color (java.awt.Color)2 Font (java.awt.Font)2 Timestamp (java.sql.Timestamp)2 HashMap (java.util.HashMap)2 JScrollPane (javax.swing.JScrollPane)2 MigLayout (net.miginfocom.swing.MigLayout)2 VString (org.compiere.grid.ed.VString)2 MImage (org.compiere.model.MImage)2 MPOSKey (org.compiere.model.MPOSKey)2 MPOSKeyLayout (org.compiere.model.MPOSKeyLayout)2