Search in sources :

Example 31 with CButton

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

the class VCreateFromStatementUI method dynInit.

/**
	 *  Dynamic Init
	 *  @throws Exception if Lookups cannot be initialized
	 *  @return true if initialized
	 */
public boolean dynInit() throws Exception {
    log.config("");
    //Refresh button
    CButton refreshButton = ConfirmPanel.createRefreshButton(false);
    refreshButton.setMargin(new Insets(1, 10, 0, 10));
    refreshButton.setDefaultCapable(true);
    refreshButton.addActionListener(this);
    v_CreateFromPanel.getConfirmPanel().addButton(refreshButton);
    //	Add to Main Form
    v_Container.getContentPane().add(v_CreateFromPanel);
    //  C_BankStatement.C_BankAccount_ID
    int AD_Column_ID = 4917;
    MLookup lookup = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
    bankAccountField = new VLookup("C_BankAccount_ID", true, true, true, lookup);
    //  Set Default
    bankAccountField.setValue(getC_BankAccount_ID());
    //  initial Loading
    authorizationField = new VString("authorization", false, false, true, 10, 30, null, null);
    authorizationField.addActionListener(this);
    MLookup lookupDocument = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
    documentTypeField = new VLookup(MPayment.COLUMNNAME_C_DocType_ID, false, false, true, lookupDocument);
    documentTypeField.addActionListener(this);
    MLookup lookupTender = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
    tenderTypeField = new VLookup(MPayment.COLUMNNAME_TenderType, false, false, true, lookupTender);
    tenderTypeField.addActionListener(this);
    bPartnerLookup = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search));
    BPartner_idLabel.setLabelFor(bPartnerLookup);
    Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
    dateToField.setValue(date);
    loadBankAccount();
    return true;
}
Also used : Insets(java.awt.Insets) VString(org.compiere.grid.ed.VString) MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) CButton(org.compiere.swing.CButton) Timestamp(java.sql.Timestamp)

Example 32 with CButton

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

the class VCreateFromPanel method jbInit.

/**
	 * Create UI
	 */
protected void jbInit() {
    //	Set Layout
    setLayout(new BorderLayout());
    //	Add Parameter
    JScrollPane dataPane = new JScrollPane();
    dataPane.getViewport().add(dataTable, null);
    AppsAction selectAllAction = new AppsAction(SELECT_ALL, KeyStroke.getKeyStroke(KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK), null);
    CButton selectAllButton = (CButton) selectAllAction.getButton();
    selectAllButton.setMargin(new Insets(0, 10, 0, 10));
    selectAllButton.setDefaultCapable(true);
    selectAllButton.addActionListener(this);
    confirmPanel.addButton(selectAllButton);
    CPanel southPanel = new CPanel();
    BorderLayout southLayout = new BorderLayout();
    southPanel.setLayout(southLayout);
    southPanel.add(confirmPanel, BorderLayout.CENTER);
    southPanel.add(statusBar, BorderLayout.SOUTH);
    dataTable.setMultiSelection(true);
    //	Add to Main
    add(parameterPanel, BorderLayout.NORTH);
    add(dataPane, BorderLayout.CENTER);
    add(southPanel, BorderLayout.SOUTH);
}
Also used : JScrollPane(javax.swing.JScrollPane) AppsAction(org.compiere.apps.AppsAction) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) CPanel(org.compiere.swing.CPanel) CButton(org.compiere.swing.CButton)

Example 33 with CButton

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

the class MinuteModel method createDay.

//	createWeekday
/**
	 *	Create Day Label
	 *  @return button
	 */
private CButton createDay() {
    CButton button = new CButton();
    //button.setBorder(BorderFactory.createLoweredBevelBorder());
    button.setBorder(BorderFactory.createEmptyBorder());
    button.setHorizontalTextPosition(SwingConstants.CENTER);
    button.setMargin(ZERO_INSETS);
    button.addActionListener(this);
    button.addMouseListener(this);
    button.addKeyListener(this);
    button.setFocusPainted(false);
    button.putClientProperty("Plastic.is3D", Boolean.FALSE);
    return button;
}
Also used : CButton(org.compiere.swing.CButton)

Example 34 with CButton

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

the class POSQuery method createButtonAction.

/**
	 * 	Create Action Button
	 *	@param action action 
	 *	@return button
	 */
protected CButton createButtonAction(String action, KeyStroke accelerator) {
    String acceleratorText = "";
    if (action != null && accelerator != null) {
        int modifiers = accelerator.getModifiers();
        if (modifiers >= 0) {
            acceleratorText = "(" + KeyEvent.getKeyModifiersText(modifiers);
        //acceleratorText += "+";
        }
        acceleratorText += KeyEvent.getKeyText(accelerator.getKeyCode());
        addStatusBarInfo(action + acceleratorText + ")");
    }
    AppsAction act = new AppsAction(action, accelerator, false);
    act.setDelegate(this);
    CButton button = (CButton) act.getButton();
    button.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_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)

Example 35 with CButton

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

the class POSInfoProduct method init.

@Override
protected void init() {
    //	Set Layout
    setLayout(new GridBagLayout());
    //	Set Border
    TitledBorder border = BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "InfoProduct"));
    border.setTitleFont(posPanel.getFont());
    border.setTitleColor(AdempierePLAF.getTextColor_Label());
    setBorder(border);
    //	
    FontMetrics metrics = getFontMetrics(posPanel.getPlainFont());
    //	Instance Panels
    rightPanel = new CPanel(new GridBagLayout());
    //	For Name
    labelName = new CLabel(Msg.getElement(Env.getCtx(), "ProductName"));
    labelName.setFont(posPanel.getBigFont());
    labelName.setHorizontalAlignment(CLabel.LEFT);
    //	Add
    rightPanel.add(labelName, new GridBagConstraints(0, 0, 1, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0));
    labelPriceName = new CLabel(Msg.parseTranslation(ctx, "@PriceStd@ , @PriceList@ ") + posPanel.getCurSymbol());
    labelPriceName.setFont(posPanel.getBigFont());
    labelPriceName.setHorizontalAlignment(CLabel.LEFT);
    labelPriceName.setHorizontalTextPosition(CLabel.LEFT);
    //	Add
    rightPanel.add(labelPriceName, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
    /*labelPriceLimit = new CLabel (posPanel.getNumberFormat().format(Env.ZERO));
		labelPriceLimit.setFont(posPanel.getBigFont());
		labelPriceLimit.setHorizontalAlignment(CLabel.RIGHT);
		labelPriceLimit.setHorizontalTextPosition(CLabel.RIGHT);
		labelPriceLimit.setPreferredSize(new Dimension(100, metrics.getHeight()));
		labelPriceLimit.setMinimumSize(new Dimension(150, metrics.getHeight()));
		//	Add
		rightPanel.add(labelPriceLimit, new GridBagConstraints(1, 1, 1, 1, 1, 1
				,GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));*/
    //	For Price
    labelPrice = new CLabel(posPanel.getNumberFormat().format(Env.ZERO));
    labelPrice.setFont(posPanel.getBigFont());
    labelPrice.setHorizontalAlignment(CLabel.RIGHT);
    labelPrice.setHorizontalTextPosition(CLabel.RIGHT);
    labelPrice.setPreferredSize(new Dimension(100, metrics.getHeight()));
    labelPrice.setMinimumSize(new Dimension(150, metrics.getHeight()));
    //	Add
    rightPanel.add(labelPrice, new GridBagConstraints(2, 1, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
    labelPriceList = new CLabel(posPanel.getNumberFormat().format(Env.ZERO));
    labelPriceList.setFont(posPanel.getBigFont());
    labelPriceList.setHorizontalAlignment(CLabel.RIGHT);
    labelPriceList.setHorizontalTextPosition(CLabel.RIGHT);
    labelPriceList.setPreferredSize(new Dimension(100, metrics.getHeight()));
    labelPriceList.setMinimumSize(new Dimension(150, metrics.getHeight()));
    //	Add
    rightPanel.add(labelPriceList, new GridBagConstraints(3, 1, 1, 1, 1, 1, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
    //	For Value
    labelValue = new CLabel(Msg.getElement(Env.getCtx(), "ProductValue"));
    labelValue.setFont(posPanel.getPlainFont());
    labelValue.setHorizontalAlignment(CLabel.LEFT);
    labelValue.setHorizontalTextPosition(CLabel.LEFT);
    //	Add
    rightPanel.add(labelValue, new GridBagConstraints(0, 2, 1, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For UOM
    labelUOMSymbol = new CLabel(Msg.getElement(Env.getCtx(), "C_UOM_ID"));
    labelUOMSymbol.setFont(posPanel.getPlainFont());
    labelUOMSymbol.setHorizontalAlignment(CLabel.LEFT);
    labelUOMSymbol.setHorizontalTextPosition(CLabel.LEFT);
    //	Add
    rightPanel.add(labelUOMSymbol, new GridBagConstraints(0, 3, 1, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For Category
    labelProductCategory = new CLabel(Msg.getElement(Env.getCtx(), "M_Product_Category_ID"));
    labelProductCategory.setFont(posPanel.getPlainFont());
    labelProductCategory.setHorizontalAlignment(CLabel.LEFT);
    //	Add
    rightPanel.add(labelProductCategory, new GridBagConstraints(0, 4, 2, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For Category
    labelProductTax = new CLabel(Msg.getElement(Env.getCtx(), "C_TaxCategory_ID"));
    labelProductTax.setFont(posPanel.getPlainFont());
    labelProductTax.setHorizontalAlignment(CLabel.LEFT);
    //	Add
    rightPanel.add(labelProductTax, new GridBagConstraints(0, 5, 2, 1, 1, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	For Description
    labelDescription = new CLabel(Msg.getElement(Env.getCtx(), "Description"));
    labelDescription.setFont(posPanel.getPlainFont());
    labelDescription.setHorizontalAlignment(CLabel.LEFT);
    labelDescription.setPreferredSize(new Dimension(20, metrics.getHeight()));
    labelDescription.setMaximumSize(new Dimension(20, metrics.getHeight()));
    //	Add
    rightPanel.add(labelDescription, new GridBagConstraints(0, 6, 2, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
    //	For Image
    buttonImage = new CButton();
    buttonImage.setFont(posPanel.getFont());
    buttonImage.setPreferredSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
    buttonImage.setMinimumSize(new Dimension(BUTTON_SIZE, BUTTON_SIZE));
    buttonImage.setFocusable(false);
    buttonImage.setVerticalTextPosition(SwingConstants.BOTTOM);
    buttonImage.setHorizontalTextPosition(SwingConstants.CENTER);
    //	Add to panel
    //	Add Doc Info
    add(buttonImage, new GridBagConstraints(0, 0, 1, 1, 0.1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
    //	Add to Header
    add(rightPanel, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 0, 5, 5), 0, 0));
}
Also used : CLabel(org.compiere.swing.CLabel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) FontMetrics(java.awt.FontMetrics) CPanel(org.compiere.swing.CPanel) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) 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