[ 2167775 ] datetime field not readable when readonly

[ 2166709 ] FR: Info BP not managing users
[ 2165569 ] FR: InfoInvoicePanel not managing installments
[ 2165216 ] Product field showing New (BP) with right-click
* InfoPanel: change field visibility from package to protected
This commit is contained in:
Heng Sin Low 2008-10-15 08:16:25 +00:00
parent 402e32717a
commit 0cff991941
13 changed files with 78 additions and 55 deletions

View File

@ -15,6 +15,7 @@ package org.adempiere.webui.component;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Timebox; import org.zkoss.zul.Timebox;
@ -39,9 +40,10 @@ public class DatetimeBox extends Panel {
} }
private void initComponents() { private void initComponents() {
dateBox.setStyle("display: inline"); dateBox.setStyle("display: inline;");
timeBox.setStyle("display: inline"); timeBox.setStyle("display: inline;");
timeBox.setButtonVisible(false); timeBox.setButtonVisible(false);
timeBox.setZclass(dateBox.getZclass());
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block"; String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
style = style + ";white-space:nowrap"; style = style + ";white-space:nowrap";
@ -97,8 +99,8 @@ public class DatetimeBox extends Panel {
* @param readWrite * @param readWrite
*/ */
public void setEnabled(boolean readWrite) { public void setEnabled(boolean readWrite) {
dateBox.setDisabled(!readWrite); dateBox.setReadonly(!readWrite);
timeBox.setDisabled(!readWrite); timeBox.setReadonly(!readWrite);
dateBox.setButtonVisible(readWrite); dateBox.setButtonVisible(readWrite);
} }

View File

@ -147,23 +147,24 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
{ {
columnName = this.getColumnName(); columnName = this.getColumnName();
popupMenu = new WEditorPopupMenu(true, true, true, true);
(getComponent().getTextBox()).setContext(popupMenu.getId());
// getComponent().setContext(popupMenu.getId());
if (columnName.equals("C_BPartner_ID")) if (columnName.equals("C_BPartner_ID"))
{ {
popupMenu = new WEditorPopupMenu(true, true, true, true);
getComponent().setButtonImage("/images/BPartner10.png"); getComponent().setButtonImage("/images/BPartner10.png");
} }
else if (columnName.equals("M_Product_ID")) else if (columnName.equals("M_Product_ID"))
{ {
popupMenu = new WEditorPopupMenu(true, true, true, false);
getComponent().setButtonImage("/images/Product10.png"); getComponent().setButtonImage("/images/Product10.png");
} }
else else
{ {
popupMenu = new WEditorPopupMenu(true, true, true, false);
getComponent().setButtonImage("/images/PickOpen10.png"); getComponent().setButtonImage("/images/PickOpen10.png");
} }
(getComponent().getTextBox()).setContext(popupMenu.getId());
return; return;
} }

View File

@ -233,7 +233,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* @return WHERE clause * @return WHERE clause
*/ */
String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
@ -283,7 +283,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* @throws SQLException * @throws SQLException
*/ */
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
@ -337,7 +337,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* Show History * Show History
*/ */
void showHistory() protected void showHistory()
{ {
log.info( "InfoAsset.showHistory"); log.info( "InfoAsset.showHistory");
} // showHistory } // showHistory
@ -347,7 +347,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* @return true * @return true
*/ */
boolean hasHistory() protected boolean hasHistory()
{ {
return false; return false;
} // hasHistory } // hasHistory
@ -377,7 +377,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* @return true * @return true
*/ */
boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} // hasZoom } // hasZoom
@ -386,7 +386,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* Customize * Customize
*/ */
void customize() protected void customize()
{ {
log.info( "InfoAsset.customize"); log.info( "InfoAsset.customize");
} // customize } // customize
@ -396,7 +396,7 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev
* @return false * @return false
*/ */
boolean hasCustomize() protected boolean hasCustomize()
{ {
return false; // for now return false; // for now
} // hasCustomize } // hasCustomize

View File

@ -256,7 +256,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* @return WHERE clause * @return WHERE clause
*/ */
String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
@ -293,7 +293,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* @throws SQLException * @throws SQLException
*/ */
void setParameters (PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters (PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
} }
@ -302,7 +302,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* To be overwritten by concrete classes * To be overwritten by concrete classes
*/ */
void showHistory() protected void showHistory()
{ {
} }
@ -312,7 +312,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* @return true if it has history (default false) * @return true if it has history (default false)
*/ */
boolean hasHistory() protected boolean hasHistory()
{ {
return false; return false;
} }
@ -322,7 +322,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* To be overwritten by concrete classes * To be overwritten by concrete classes
*/ */
void customize() protected void customize()
{ {
} }
@ -332,7 +332,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* @return true if it has customize (default false) * @return true if it has customize (default false)
*/ */
boolean hasCustomize() protected boolean hasCustomize()
{ {
return false; return false;
} }
@ -365,7 +365,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* @return true if it has zoom (default false) * @return true if it has zoom (default false)
*/ */
boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} }
@ -375,7 +375,7 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val
* To be overwritten by concrete classes * To be overwritten by concrete classes
*/ */
void saveSelectionDetail() protected void saveSelectionDetail()
{ {
} }

View File

@ -480,8 +480,7 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl
int C_BPartner_Location_ID = 0; int C_BPartner_Location_ID = 0;
AD_User_ID = ((KeyNamePair)contentPanel.getValueAt(contentPanel.getSelectedIndex(), 3)).getKey(); AD_User_ID = ((KeyNamePair)contentPanel.getValueAt(row, 3)).getKey();
//AD_User_ID = contentPanel.getSelectedRowKey();
if (m_C_BPartner_Location_ID_index != -1) if (m_C_BPartner_Location_ID_index != -1)
{ {

View File

@ -314,7 +314,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
* @return sql where clause * @return sql where clause
*/ */
String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
@ -382,7 +382,7 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener,
* @throws SQLException * @throws SQLException
*/ */
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
if (fName.getText().length() > 0) if (fName.getText().length() > 0)

View File

@ -391,7 +391,7 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener
} }
@Override @Override
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
} }

View File

@ -277,7 +277,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* @return where clause * @return where clause
*/ */
String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
@ -322,7 +322,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* @throws SQLException * @throws SQLException
*/ */
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
@ -387,7 +387,7 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev
* @return true * @return true
*/ */
boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} // hasZoom } // hasZoom

View File

@ -395,7 +395,7 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
@Override @Override
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
if (txtDocumentNo.getText().length() > 0) if (txtDocumentNo.getText().length() > 0)
@ -541,4 +541,26 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener
} }
} }
@Override
protected void saveSelectionDetail() {
// publish for Callout to read
Integer ID = getSelectedRowKey();
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_Invoice_ID", ID == null ? "0" : ID.toString());
//
int C_InvoicePaySchedule_ID = 0;
int row = contentPanel.getSelectedRow();
if (row >= 0)
{
Object value = contentPanel.getValueAt(row, INDEX_PAYSCHEDULE);
if (value != null && value instanceof KeyNamePair)
C_InvoicePaySchedule_ID = ((KeyNamePair)value).getKey();
}
if (C_InvoicePaySchedule_ID <= 0) // not selected
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", "0");
else
Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID));
}
} }

View File

@ -43,7 +43,6 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.zkoss.zk.ui.WrongValueException; import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
@ -356,7 +355,7 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener
} }
@Override @Override
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
if (txtDocumentNo.getText().length() > 0) if (txtDocumentNo.getText().length() > 0)

View File

@ -680,7 +680,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
* Get Table name Synonym * Get Table name Synonym
* @return table name * @return table name
*/ */
String getTableName() protected String getTableName()
{ {
return p_tableName; return p_tableName;
} // getTableName } // getTableName
@ -689,7 +689,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
* Get Key Column Name * Get Key Column Name
* @return column name * @return column name
*/ */
String getKeyColumn() protected String getKeyColumn()
{ {
return p_keyColumn; return p_keyColumn;
} // getKeyColumn } // getKeyColumn
@ -705,7 +705,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
* To be overwritten by concrete classes * To be overwritten by concrete classes
* @return WHERE clause * @return WHERE clause
*/ */
abstract String getSQLWhere(); protected abstract String getSQLWhere();
/** /**
* Set Parameters for Query * Set Parameters for Query
@ -714,7 +714,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
abstract void setParameters (PreparedStatement pstmt, boolean forCount) protected abstract void setParameters (PreparedStatement pstmt, boolean forCount)
throws SQLException; throws SQLException;
/** /**
* notify to search editor of a value change in the selection info * notify to search editor of a value change in the selection info
@ -722,35 +722,35 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
* *
*/ */
void showHistory() {} protected void showHistory() {}
/** /**
* Has History (false) * Has History (false)
* To be overwritten by concrete classes * To be overwritten by concrete classes
* @return true if it has history (default false) * @return true if it has history (default false)
*/ */
boolean hasHistory() {return false;} protected boolean hasHistory() {return false;}
/** /**
* Customize dialog * Customize dialog
* To be overwritten by concrete classes * To be overwritten by concrete classes
*/ */
void customize() {} protected void customize() {}
/** /**
* Has Customize (false) * Has Customize (false)
* To be overwritten by concrete classes * To be overwritten by concrete classes
* @return true if it has customize (default false) * @return true if it has customize (default false)
*/ */
boolean hasCustomize() {return false;} protected boolean hasCustomize() {return false;}
/** /**
* Has Zoom (false) * Has Zoom (false)
* To be overwritten by concrete classes * To be overwritten by concrete classes
* @return true if it has zoom (default false) * @return true if it has zoom (default false)
*/ */
boolean hasZoom() {return false;} protected boolean hasZoom() {return false;}
/** /**
* Save Selection Details * Save Selection Details
* To be overwritten by concrete classes * To be overwritten by concrete classes
*/ */
void saveSelectionDetail() {} protected void saveSelectionDetail() {}
/** /**
* Get Zoom Window * Get Zoom Window

View File

@ -294,7 +294,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* @return sql where clause * @return sql where clause
*/ */
String getSQLWhere() protected String getSQLWhere()
{ {
StringBuffer sql = new StringBuffer(); StringBuffer sql = new StringBuffer();
@ -347,7 +347,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* @throws SQLException * @throws SQLException
*/ */
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
@ -442,7 +442,7 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener,
* @return true * @return true
*/ */
boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} // hasZoom } // hasZoom

View File

@ -543,7 +543,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
* @param forCount for counting records * @param forCount for counting records
* @throws SQLException * @throws SQLException
*/ */
void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException
{ {
int index = 1; int index = 1;
@ -651,7 +651,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
/** /**
* Show History * Show History
*/ */
void showHistory() protected void showHistory()
{ {
/*log.info(""); /*log.info("");
Integer M_Product_ID = getSelectedRowKey(); Integer M_Product_ID = getSelectedRowKey();
@ -674,7 +674,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
* *
* @return true (has history) * @return true (has history)
*/ */
boolean hasHistory() protected boolean hasHistory()
{ {
return true; return true;
} // hasHistory } // hasHistory
@ -683,7 +683,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
* Has Zoom * Has Zoom
* @return (has zoom) * @return (has zoom)
*/ */
boolean hasZoom() protected boolean hasZoom()
{ {
return true; return true;
} // hasZoom } // hasZoom
@ -691,7 +691,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
/** /**
* Customize * Customize
*/ */
void customize() protected void customize()
{ {
log.info(""); log.info("");
} // customize } // customize
@ -700,7 +700,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
* Has Customize * Has Customize
* @return false (no customize) * @return false (no customize)
*/ */
boolean hasCustomize() protected boolean hasCustomize()
{ {
return false; // for now return false; // for now
} // hasCustomize } // hasCustomize
@ -708,7 +708,7 @@ public final class InfoProductPanel extends InfoPanel implements EventListener
/** /**
* Save Selection Settings for PriceList * Save Selection Settings for PriceList
*/ */
void saveSelectionDetail() protected void saveSelectionDetail()
{ {
// publish for Callout to read // publish for Callout to read
Integer ID = getSelectedRowKey(); Integer ID = getSelectedRowKey();