use of org.compiere.swing.CButton in project adempiere by adempiere.
the class ConfirmPanel method createPAttributeButton.
// createPAttributeButton
/**
* Create Product Attribute Button with label text
* @param text text
* @return Product Attribute Button
*/
public static final CButton createPAttributeButton(String text) {
AppsAction aa = new AppsAction(A_PATTRIBUTE, null, text);
CButton button = (CButton) aa.getButton();
button.setMargin(s_insets);
return button;
}
use of org.compiere.swing.CButton in project adempiere by adempiere.
the class VTreePanel method addToBar.
/**
* Add TreeNode to Bar
* @param nd node
*/
private void addToBar(MTreeNode nd, JToolBar currentToolBar, boolean isLabel) {
// Only first word of Label
String label = nd.toString().trim();
if (!isLabel) {
CButton button = new CButton(label);
button.setOpaque(false);
button.setHorizontalAlignment(JButton.LEFT);
button.setMargin(new Insets(0, 0, 0, 0));
button.setIcon(nd.getIcon());
button.setRequestFocusEnabled(false);
button.setToolTipText(nd.getDescription());
button.setActionCommand(String.valueOf(nd.getNode_ID()));
button.addActionListener(this);
button.addMouseListener(mouseListener);
currentToolBar.add(button);
} else {
currentToolBar.add(new JLabel("<html><u><b>" + label + "</b></u></html>"));
}
bar.validate();
//if (centerSplitPane.getDividerLocation() == -1)
// centerSplitPane.setDividerLocation(button.getPreferredSize().width);
bar.repaint();
}
use of org.compiere.swing.CButton in project adempiere by adempiere.
the class VTreePanel method mouseClicked.
// keyPressed
/*************************************************************************/
/**
* Mouse clicked
* @param e event
*/
protected void mouseClicked(MouseEvent e) {
// *** JTree ***
if (e.getSource() instanceof JTree) {
// Left Double Click
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 0) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (selRow != -1) {
MTreeNode tn = (MTreeNode) tree.getPathForLocation(e.getX(), e.getY()).getLastPathComponent();
setSelectedNode(tn);
}
} else // Right Click for PopUp
if ((m_editable || m_hasBar) && SwingUtilities.isRightMouseButton(e)) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (selRow != -1) {
tree.setSelectionRow(selRow);
}
if (// need select first
tree.getSelectionPath() != null) {
MTreeNode nd = (MTreeNode) tree.getSelectionPath().getLastPathComponent();
if (// only add leaves to bar
nd.isLeaf())
mBarAdd.setEnabled(true);
else
mBarAdd.setEnabled(false);
Rectangle r = tree.getPathBounds(tree.getSelectionPath());
popMenuTree.show(tree, (int) r.getMaxX(), (int) r.getY());
}
}
} else // *** JButton ***
if (e.getSource() instanceof JButton) {
if (SwingUtilities.isRightMouseButton(e)) {
m_buttonSelected = (CButton) e.getSource();
popMenuBar.show(m_buttonSelected, e.getX(), e.getY());
}
}
// JButton
}
use of org.compiere.swing.CButton in project lar_361 by comitsrl.
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("");
super.dynInit();
// Refresh button
CButton refreshButton = ConfirmPanel.createRefreshButton(false);
refreshButton.setMargin(new Insets(1, 10, 0, 10));
refreshButton.setDefaultCapable(true);
refreshButton.addActionListener(this);
dialog.getConfirmPanel().addButton(refreshButton);
dialog.getRootPane().setDefaultButton(refreshButton);
if (getGridTab().getValue("C_BankStatement_ID") == null) {
ADialog.error(0, dialog, "SaveErrorRowNotFound");
return false;
}
dialog.setTitle(getTitle());
// C_BankStatement.C_BankAccount_ID
int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID;
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
int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID");
bankAccountField.setValue(new Integer(C_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.setName("TenderType");
tenderTypeField.addActionListener(this);
MLookup lookupTipoTarjeta = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MLARTarjetaCredito.Table_Name, "CreditCardType"), DisplayType.List);
tipoTarjetaField = new VLookup("CreditCardType", false, false, true, lookupTipoTarjeta);
tipoTarjetaField.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);
bankAccount = new MBankAccount(Env.getCtx(), C_BankAccount_ID, null);
loadBankAccount();
return true;
}
use of org.compiere.swing.CButton in project lar_361 by comitsrl.
the class PosQuery method createButtonAction.
// valueChanged
/**
* 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;
}
Aggregations