use of org.compiere.swing.CButton in project adempiere by adempiere.
the class VMRPDetailed method statInit.
/**
* Static Setup - add fields to parameterPanel
* @throws Exception if Lookups cannot be initialized
*/
private void statInit() throws Exception {
// Resource Lookup
// Base Language
Language language = Language.getLoginLanguage();
MLookup resourceL = MLookupFactory.get(getCtx(), p_WindowNo, MColumn.getColumn_ID(MResource.Table_Name, MResource.COLUMNNAME_S_Resource_ID), DisplayType.TableDir, language, MResource.COLUMNNAME_S_Resource_ID, 0, false, MResource.Table_Name + "." + MResource.COLUMNNAME_ManufacturingResourceType + "= '" + MResource.MANUFACTURINGRESOURCETYPE_Plant + "'");
fResource_ID = new VLookup(MPPMRP.COLUMNNAME_S_Resource_ID, false, false, true, resourceL) {
private static final long serialVersionUID = 1L;
public void setValue(Object arg0) {
super.setValue(arg0);
}
;
};
lResource_ID.setLabelFor(fResource_ID);
fResource_ID.setBackground(AdempierePLAF.getInfoBackground());
// Planner Lookup
fPlanner_ID = new VLookup(MPPMRP.COLUMNNAME_Planner_ID, false, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPPProductPlanning.Table_Name, MPPMRP.COLUMNNAME_Planner_ID), DisplayType.Table)) {
private static final long serialVersionUID = 1L;
public void setValue(Object arg0) {
super.setValue(arg0);
}
;
};
lPlanner_ID.setLabelFor(fPlanner_ID);
fPlanner_ID.setBackground(AdempierePLAF.getInfoBackground());
// Wahrehouse Lookup
fWarehouse_ID = new VLookup(MPPMRP.COLUMNNAME_M_Warehouse_ID, true, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MWarehouse.Table_Name, MPPMRP.COLUMNNAME_M_Warehouse_ID), DisplayType.TableDir)) {
private static final long serialVersionUID = 1L;
public void setValue(Object arg0) {
super.setValue(arg0);
}
;
};
lWarehouse_ID.setLabelFor(fWarehouse_ID);
fWarehouse_ID.setBackground(AdempierePLAF.getInfoBackground());
fMaster.setSelected(false);
fMaster.setReadWrite(false);
fMRPReq.setSelected(false);
fMRPReq.setReadWrite(false);
fCreatePlan.setSelected(false);
fCreatePlan.setReadWrite(false);
lUOM.setText(Msg.translate(getCtx(), MUOM.COLUMNNAME_C_UOM_ID));
fUOM.setBackground(AdempierePLAF.getInfoBackground());
fUOM.setReadWrite(false);
lType.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Policy));
fType.setBackground(AdempierePLAF.getInfoBackground());
fType.setReadWrite(false);
lOrderPeriod.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Period));
fOrderPeriod.setBackground(AdempierePLAF.getInfoBackground());
fOrderPeriod.setReadWrite(false);
lTimefence.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_TimeFence));
fTimefence.setBackground(AdempierePLAF.getInfoBackground());
fTimefence.setReadWrite(false);
lLeadtime.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_DeliveryTime_Promised));
fLeadtime.setBackground(AdempierePLAF.getInfoBackground());
fLeadtime.setReadWrite(false);
lMinOrd.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Min));
fMinOrd.setBackground(AdempierePLAF.getInfoBackground());
fMinOrd.setReadWrite(false);
lMaxOrd.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Max));
fMaxOrd.setBackground(AdempierePLAF.getInfoBackground());
fMaxOrd.setReadWrite(false);
lOrdMult.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Pack));
fOrdMult.setBackground(AdempierePLAF.getInfoBackground());
fOrdMult.setReadWrite(false);
lOrderQty.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Order_Qty));
fOrderQty.setBackground(AdempierePLAF.getInfoBackground());
fOrderQty.setReadWrite(false);
lYield.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_Yield));
fYield.setBackground(AdempierePLAF.getInfoBackground());
fYield.setReadWrite(false);
lOnhand.setText(Msg.translate(getCtx(), MStorage.COLUMNNAME_QtyOnHand));
fOnhand.setBackground(AdempierePLAF.getInfoBackground());
fOnhand.setReadWrite(false);
lSafetyStock.setText(Msg.translate(getCtx(), MPPProductPlanning.COLUMNNAME_SafetyStock));
fSafetyStock.setBackground(AdempierePLAF.getInfoBackground());
fSafetyStock.setReadWrite(false);
lReserved.setText(Msg.translate(getCtx(), MStorage.COLUMNNAME_QtyReserved));
fReserved.setBackground(AdempierePLAF.getInfoBackground());
fReserved.setReadWrite(false);
lAvailable.setText(Msg.translate(getCtx(), "QtyAvailable"));
fAvailable.setBackground(AdempierePLAF.getInfoBackground());
fAvailable.setReadWrite(false);
lOrdered.setText(Msg.translate(getCtx(), MPPOrder.COLUMNNAME_QtyOrdered));
fOrdered.setBackground(AdempierePLAF.getInfoBackground());
fOrdered.setReadWrite(false);
// Product Lookup
fProduct_ID = new VLookup(MPPMRP.COLUMNNAME_M_Product_ID, true, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MProduct.Table_Name, MPPMRP.COLUMNNAME_M_Product_ID), DisplayType.Search)) {
private static final long serialVersionUID = 1L;
public void setValue(Object arg0) {
super.setValue(arg0);
fAttrSetInstance_ID.setValue(new Integer(0));
}
;
};
fAttrSetInstance_ID = new CButton() {
private static final long serialVersionUID = 1L;
private Object value;
public Object getValue() {
return value;
}
;
public void setText(String text) {
if (text == null) {
text = "---";
}
if (text.length() > 23) {
text = text.substring(0, 20) + "...";
}
super.setText(text);
}
;
public void setValue(Object arg0) {
value = arg0;
int i = (arg0 instanceof Integer) ? ((Integer) arg0).intValue() : 0;
if (i == 0) {
setText(null);
}
}
;
};
fAttrSetInstance_ID.setValue(new Integer(0));
fAttrSetInstance_ID.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
selectAttributeSetInstance();
}
});
lProduct_ID.setLabelFor(fProduct_ID);
fProduct_ID.setBackground(AdempierePLAF.getInfoBackground());
//
lDateFrom.setLabelFor(fDateFrom);
fDateFrom.setBackground(AdempierePLAF.getInfoBackground());
fDateFrom.setToolTipText(Msg.translate(getCtx(), MLot.COLUMNNAME_DateFrom));
lDateTo.setLabelFor(fDateTo);
fDateTo.setBackground(AdempierePLAF.getInfoBackground());
fDateTo.setToolTipText(Msg.translate(getCtx(), MLot.COLUMNNAME_DateTo));
fSupplyType = new VLookup(MPPMRP.COLUMNNAME_TypeMRP, false, false, true, MLookupFactory.get(getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPPMRP.Table_Name, MPPMRP.COLUMNNAME_TypeMRP), DisplayType.List));
lSupplyType.setLabelFor(fSupplyType);
fSupplyType.setBackground(AdempierePLAF.getInfoBackground());
//
parameterPanel.setLayout(new ALayout());
// 1st Row
parameterPanel.add(lProduct_ID, new ALayoutConstraint(0, 0));
parameterPanel.add(fProduct_ID, new ALayoutConstraint(0, 1));
parameterPanel.add(lUOM, new ALayoutConstraint(0, 2));
parameterPanel.add(fUOM, new ALayoutConstraint(0, 3));
parameterPanel.add(lType, new ALayoutConstraint(0, 4));
parameterPanel.add(fType, new ALayoutConstraint(0, 5));
// 2nd Row
parameterPanel.add(lAttrSetInstance_ID, new ALayoutConstraint(1, 0));
parameterPanel.add(fAttrSetInstance_ID, new ALayoutConstraint(1, 1));
parameterPanel.add(lOnhand, new ALayoutConstraint(1, 2));
parameterPanel.add(fOnhand, new ALayoutConstraint(1, 3));
parameterPanel.add(lOrderPeriod, new ALayoutConstraint(1, 4));
parameterPanel.add(fOrderPeriod, new ALayoutConstraint(1, 5));
// 3rd Row
parameterPanel.add(lPlanner_ID, new ALayoutConstraint(2, 0));
parameterPanel.add(fPlanner_ID, new ALayoutConstraint(2, 1));
parameterPanel.add(lSafetyStock, new ALayoutConstraint(2, 2));
parameterPanel.add(fSafetyStock, new ALayoutConstraint(2, 3));
parameterPanel.add(lMinOrd, new ALayoutConstraint(2, 4));
parameterPanel.add(fMinOrd, new ALayoutConstraint(2, 5));
// 4th Row
parameterPanel.add(lWarehouse_ID, new ALayoutConstraint(3, 0));
parameterPanel.add(fWarehouse_ID, new ALayoutConstraint(3, 1));
parameterPanel.add(lReserved, new ALayoutConstraint(3, 2));
parameterPanel.add(fReserved, new ALayoutConstraint(3, 3));
parameterPanel.add(lMaxOrd, new ALayoutConstraint(3, 4));
parameterPanel.add(fMaxOrd, new ALayoutConstraint(3, 5));
// 5th Row
parameterPanel.add(lResource_ID, new ALayoutConstraint(4, 0));
parameterPanel.add(fResource_ID, new ALayoutConstraint(4, 1));
parameterPanel.add(lAvailable, new ALayoutConstraint(4, 2));
parameterPanel.add(fAvailable, new ALayoutConstraint(4, 3));
parameterPanel.add(lOrdMult, new ALayoutConstraint(4, 4));
parameterPanel.add(fOrdMult, new ALayoutConstraint(4, 5));
// 6th Row
parameterPanel.add(lDateFrom, new ALayoutConstraint(5, 0));
parameterPanel.add(fDateFrom, new ALayoutConstraint(5, 1));
parameterPanel.add(lOrdered, new ALayoutConstraint(5, 2));
parameterPanel.add(fOrdered, new ALayoutConstraint(5, 3));
parameterPanel.add(lOrderQty, new ALayoutConstraint(5, 4));
parameterPanel.add(fOrderQty, new ALayoutConstraint(5, 5));
// 7th Row
parameterPanel.add(lDateTo, new ALayoutConstraint(6, 0));
parameterPanel.add(fDateTo, new ALayoutConstraint(6, 1));
parameterPanel.add(lTimefence, new ALayoutConstraint(6, 4));
parameterPanel.add(fTimefence, new ALayoutConstraint(6, 5));
// 8th Row
parameterPanel.add(fMaster, new ALayoutConstraint(7, 1));
parameterPanel.add(fCreatePlan, new ALayoutConstraint(7, 3));
parameterPanel.add(lLeadtime, new ALayoutConstraint(7, 4));
parameterPanel.add(fLeadtime, new ALayoutConstraint(7, 5));
// 9th Row
parameterPanel.add(fMRPReq, new ALayoutConstraint(8, 3));
parameterPanel.add(lYield, new ALayoutConstraint(8, 4));
parameterPanel.add(fYield, new ALayoutConstraint(8, 5));
}
use of org.compiere.swing.CButton in project adempiere by adempiere.
the class VCreateFromDialog method jbInit.
protected void jbInit() throws Exception {
getContentPane().add(parameterPanel, BorderLayout.NORTH);
JScrollPane dataPane = new JScrollPane();
getContentPane().add(dataPane, BorderLayout.CENTER);
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();
getContentPane().add(southPanel, BorderLayout.SOUTH);
BorderLayout southLayout = new BorderLayout();
southPanel.setLayout(southLayout);
southPanel.add(confirmPanel, BorderLayout.CENTER);
southPanel.add(statusBar, BorderLayout.SOUTH);
dataTable.setMultiSelection(true);
}
use of org.compiere.swing.CButton in project adempiere by adempiere.
the class AEnv method getButton.
// positionCenterScreen
/*************************************************************************
* Get Button
* @param iconName
* @return button
*/
public static CButton getButton(String iconName) {
CButton button = new CButton(Env.getImageIcon(iconName + "16.gif"));
button.setMargin(new Insets(0, 0, 0, 0));
button.setToolTipText(Msg.getMsg(Env.getCtx(), iconName));
button.setDefaultCapable(false);
return button;
}
use of org.compiere.swing.CButton in project adempiere by adempiere.
the class POSKeyPanel method createCard.
/**
* @return
*/
private CPanel createCard(int posKeyLayoutId) {
// already added
if (keyMaps.containsKey(posKeyLayoutId)) {
return null;
}
CPanel card = new CPanel();
card.setLayout(new MigLayout("fill, ins 0"));
MPOSKeyLayout keyLayout = MPOSKeyLayout.get(Env.getCtx(), posKeyLayoutId);
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);
keyMaps.put(posKeyLayoutId, 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());
Image img = image.getImage();
// https://github.com/erpcya/AD-POS-WebUI/issues/29
// Change Image Size
Image imgResized = img.getScaledInstance(IMAGE_SIZE, IMAGE_SIZE, Image.SCALE_SMOOTH);
button.setIcon(new ImageIcon(imgResized));
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;
}
use of org.compiere.swing.CButton in project adempiere by adempiere.
the class POSScalesListener method doPerformAction.
protected void doPerformAction(ActionEvent actionEvent) {
if (((javax.swing.Timer) pos.getScalesTimer()).isRunning() && pos.getScalesTimer() != actionEvent.getSource()) {
if (actionEvent.getSource() instanceof CButton) {
CButton source = (CButton) actionEvent.getSource();
if (source.getName().equals("Ok")) {
readMeasure();
captureMeasure();
return;
}
}
return;
}
if (actionEvent.getSource() == pos.getScalesTimer()) {
readMeasure();
return;
}
}
Aggregations