use of org.compiere.grid.ed.Calculator in project adempiere by adempiere.
the class AEnv method actionPerformed.
// addMenuItem
/**
* Perform action command for common menu items.
* Created in AMenu.createMenu(), APanel.createMenu(), FormFrame.createMenu()
* @param actionCommand known action command
* @param WindowNo window no
* @param c Container parent
* @return true if actionCommand was found and performed
*/
public static boolean actionPerformed(String actionCommand, int WindowNo, Container c) {
MRole role = MRole.getDefault();
// File Menu ------------------------
if (actionCommand.equals("PrintScreen")) {
PrintScreenPainter.printScreen(Env.getFrame(c));
} else if (actionCommand.equals("ScreenShot")) {
ScreenShot.createJPEG(Env.getFrame(c), null);
} else // }
if (actionCommand.equals("Exit")) {
if (ADialog.ask(WindowNo, c, "ExitApplication?")) {
AMenu aMenu = (AMenu) Env.getWindow(0);
aMenu.dispose();
}
} else if (actionCommand.equals("Logout")) {
AMenu aMenu = (AMenu) Env.getWindow(0);
aMenu.logout();
} else // View Menu ------------------------
if (actionCommand.equals("InfoProduct") && AEnv.canAccessInfo("PRODUCT")) {
org.compiere.apps.search.Info.showProduct(Env.getFrame(c), WindowNo);
} else if (actionCommand.equals("InfoBPartner") && AEnv.canAccessInfo("BPARTNER")) {
org.compiere.apps.search.Info.showBPartner(Env.getFrame(c), WindowNo);
} else if (actionCommand.equals("InfoAsset") && AEnv.canAccessInfo("ASSET")) {
org.compiere.apps.search.Info.showAsset(Env.getFrame(c), WindowNo);
} else if (actionCommand.equals("InfoAccount") && MRole.getDefault().isShowAcct() && AEnv.canAccessInfo("ACCOUNT")) {
new org.compiere.acct.AcctViewer();
} else if (actionCommand.equals("InfoSchedule") && AEnv.canAccessInfo("SCHEDULE")) {
new org.compiere.apps.search.InfoSchedule(Env.getFrame(c), null, false);
} else //FR [ 1966328 ]
if (actionCommand.equals("InfoMRP") && AEnv.canAccessInfo("MRP")) {
CFrame frame = (CFrame) Env.getFrame(c);
int m_menu_id = MMenu.getMenu_ID("MRP Info");
AMenu menu = AEnv.getAMenu(frame);
// async load
AMenuStartItem form = new AMenuStartItem(m_menu_id, true, Msg.translate(Env.getCtx(), "MRP Info"), menu);
form.start();
} else if (actionCommand.equals("InfoCRP") && AEnv.canAccessInfo("CRP")) {
CFrame frame = (CFrame) Env.getFrame(c);
int m_menu_id = MMenu.getMenu_ID("CRP Info");
AMenu menu = AEnv.getAMenu(frame);
// async load
AMenuStartItem form = new AMenuStartItem(m_menu_id, true, Msg.translate(Env.getCtx(), "CRP Info"), menu);
form.start();
} else if (actionCommand.equals("InfoOrder") && AEnv.canAccessInfo("ORDER")) {
org.compiere.apps.search.Info.showOrder(Env.getFrame(c), WindowNo, "");
} else if (actionCommand.equals("InfoInvoice") && AEnv.canAccessInfo("INVOICE")) {
org.compiere.apps.search.Info.showInvoice(Env.getFrame(c), WindowNo, "");
} else if (actionCommand.equals("InfoInOut") && AEnv.canAccessInfo("INOUT")) {
org.compiere.apps.search.Info.showInOut(Env.getFrame(c), WindowNo, "");
} else if (actionCommand.equals("InfoPayment") && AEnv.canAccessInfo("PAYMENT")) {
org.compiere.apps.search.Info.showPayment(Env.getFrame(c), WindowNo, "");
} else if (actionCommand.equals("InfoCashLine") && AEnv.canAccessInfo("CASHJOURNAL")) {
org.compiere.apps.search.Info.showCashLine(Env.getFrame(c), WindowNo, "");
} else if (actionCommand.equals("InfoAssignment") && AEnv.canAccessInfo("RESOURCE")) {
org.compiere.apps.search.Info.showAssignment(Env.getFrame(c), WindowNo, "");
} else // Go Menu ------------------------
if (actionCommand.equals("WorkFlow")) {
startWorkflowProcess(0, 0);
} else if (actionCommand.equals("Home")) {
showWindow(Env.getWindow(0));
} else // Tools Menu ------------------------
if (actionCommand.equals("Calculator")) {
Calculator calc = new org.compiere.grid.ed.Calculator(Env.getFrame(c));
calc.setDisposeOnEqual(false);
AEnv.showCenterScreen(calc);
} else if (actionCommand.equals("Calendar")) {
AEnv.showCenterScreen(new org.compiere.grid.ed.Calendar(Env.getFrame(c)));
} else if (actionCommand.equals("Editor")) {
AEnv.showCenterScreen(new org.compiere.grid.ed.Editor(Env.getFrame(c)));
} else if (actionCommand.equals("Script")) {
new BeanShellEditor(Env.getFrame(c));
} else if (actionCommand.equals("Preference")) {
if (role.isShowPreference()) {
AEnv.showCenterScreen(new Preference(Env.getFrame(c), WindowNo));
}
} else // Help Menu ------------------------
if (actionCommand.equals("Online")) {
Env.startBrowser(org.compiere.Adempiere.getOnlineHelpURL());
} else if (actionCommand.equals("EMailSupport")) {
ADialog.createSupportEMail(Env.getFrame(c), Env.getFrame(c).getTitle(), "\n\n");
} else if (actionCommand.equals("About")) {
AEnv.showCenterScreen(new AboutBox(Env.getFrame(c)));
} else
return false;
//
return true;
}
use of org.compiere.grid.ed.Calculator in project adempiere by adempiere.
the class Info method actionPerformed.
/**************************************************************************
* (Button) Action Listener & Popup Menu
* @param e event
*/
public void actionPerformed(ActionEvent e) {
if (!p_loadedOK)
return;
String cmd = e.getActionCommand();
if (cmd.equals("CausedFocusEvent")) {
return;
}
Object source = null;
if (e.getSource() != null) {
source = e.getSource();
// Keep the focus on the source field if the table updates
m_heldLastFocus = this.getFocusOwner();
// Popup => Calculator
if (source.equals(calcMenu)) {
BigDecimal number = null;
if (m_popupRow >= 0 && m_popupColumn >= 0) {
Object data = p_table.getValueAt(m_popupRow, m_popupColumn);
try {
if (data != null) {
if (data instanceof BigDecimal)
number = (BigDecimal) data;
else
number = new BigDecimal(data.toString());
}
} catch (Exception ex) {
}
Calculator c = new Calculator(null, number);
c.setVisible(true);
}
return;
} else // Popup => zoom
if (e.getSource().equals(zoomMenu)) {
if (m_popupRow >= 0 && m_popupColumn >= 0) {
zoom(p_table.getRowKey(m_popupRow));
}
return;
} else if (cmd.equals(ConfirmPanel.A_OK)) {
// VLookup fields in the criteria
if (hasOutstandingChanges()) {
return;
} else {
// We might close
p_triggerRefresh = false;
}
} else if (source instanceof VComboBox) {
if (((VComboBox) source).getParent() instanceof VLookup) {
source = ((VComboBox) source).getParent();
VLookup vl = ((VLookup) source);
m_heldLastFocus = vl;
// events that don't have changes from the last action.
if (cmd.equals("comboBoxChanged")) {
if (!vl.hasChanged())
return;
else
p_triggerRefresh = true;
} else if (cmd.equals("comboBoxEdited")) {
if (!vl.hasChanged() && !hasOutstandingChanges()) {
vl.requestFocus();
return;
}
p_triggerRefresh = true;
}
}
} else if (source instanceof CTextField) {
CTextField tf = ((CTextField) source);
if (tf.getParent() instanceof VLookup) {
// instead.
return;
} else if (// The change may have come from another field
tf.hasChanged() || hasOutstandingChanges()) {
p_triggerRefresh = true;
} else {
// if the dialog was opened from a menu.
if (p_TabNo == 0)
return;
else
// Save the selection and close;
dispose(true);
}
} else if (e.getSource() instanceof VCheckBox) {
// Check box changes generally always cause a refresh
// Capture changes that don't
p_triggerRefresh = true;
VCheckBox cb = (VCheckBox) e.getSource();
if (cb.getName().equals("AutoQuery")) {
// Only trigger a refresh if the check box is selected
if (!cb.isSelected()) {
return;
}
}
}
// Check if we need to reset the table. The flag is reset when
// the table is reset. The first change triggers the reset.
p_resetColumns = p_resetColumns || columnIsDynamic(source);
}
if (cmd.equals(ConfirmPanel.A_OK)) {
dispose(p_saveResults);
} else if (cmd.equals(ConfirmPanel.A_CANCEL)) {
m_cancel = true;
dispose(false);
} else if (cmd.equals(ConfirmPanel.A_REFRESH)) {
// Refresh always causes a requery in case there are
// changes to the underlying tables - even if the
// criteria haven't changed.
p_resetColumns = true;
p_triggerRefresh = true;
p_refreshNow = true;
} else if (cmd.equals(ConfirmPanel.A_HISTORY))
showHistory(p_table.getLeadRowKey());
else if (cmd.equals(ConfirmPanel.A_CUSTOMIZE))
customize();
else if (cmd.equals(ConfirmPanel.A_ZOOM))
zoom(p_table.getLeadRowKey());
else if (cmd.equals(ConfirmPanel.A_RESET)) {
// Go back to the defaults
// Prevent other actions
p_loadedOK = false;
initInfo();
p_loadedOK = true;
//
p_resetColumns = true;
p_triggerRefresh = true;
} else if (cmd.equals(ConfirmPanel.A_PRINT))
PrintScreenPainter.printScreen(this);
// Refresh if the autoquery feature is selected or the refresh button is clicked.
if (p_triggerRefresh && (p_refreshNow || autoQuery())) {
// Something changed so save the state and prepare for the query
executeQuery();
}
// Reset the flags
p_triggerRefresh = false;
p_refreshNow = false;
}
use of org.compiere.grid.ed.Calculator in project lar_361 by comitsrl.
the class Info method actionPerformed.
// getSelectedSQL;
/**
************************************************************************
* (Button) Action Listener & Popup Menu
* @param e event
*/
public void actionPerformed(ActionEvent e) {
// Popup => Calculator
if (e.getSource().equals(calcMenu)) {
BigDecimal number = null;
Object data = p_table.getSelectedValue();
try {
if (data != null) {
if (data instanceof BigDecimal)
number = (BigDecimal) data;
else
number = new BigDecimal(data.toString());
}
} catch (Exception ex) {
}
Calculator c = new Calculator(null, number);
c.setVisible(true);
return;
}
// popup
// Confirm Panel
String cmd = e.getActionCommand();
if (cmd.equals(ConfirmPanel.A_OK)) {
dispose(true);
} else if (cmd.equals(ConfirmPanel.A_CANCEL)) {
m_cancel = true;
dispose(false);
} else //
if (cmd.equals(ConfirmPanel.A_HISTORY))
showHistory();
else if (cmd.equals(ConfirmPanel.A_CUSTOMIZE))
customize();
else if (cmd.equals(ConfirmPanel.A_ZOOM))
zoom();
else if (cmd.equals(ConfirmPanel.A_RESET))
doReset();
else if (cmd.equals(ConfirmPanel.A_PRINT))
PrintScreenPainter.printScreen(this);
else // @fchiappano Boton seleccionar todo
if (cmd.equals(SELECT_DESELECT_ALL)) {
TableModel model = p_table.getModel();
int rows = model.getRowCount() - 1;
Boolean selectAll = selectDeselectAllAction.isPressed() ? Boolean.FALSE : Boolean.TRUE;
for (int i = 0; i < rows; i++) {
Object linea = model.getValueAt(i, 0);
if (linea != null)
((IDColumn) linea).setSelected(selectAll);
else
rows++;
}
p_table.updateUI();
} else
// Default
executeQuery();
}
Aggregations