IDEMPIERE-2902 UX: Implement Radio buttons (#337)

Fix zoom
This commit is contained in:
hengsin 2020-11-01 00:07:11 +08:00 committed by GitHub
parent 904c8131be
commit c02dde975b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 5 deletions

View File

@ -53,6 +53,7 @@ import org.compiere.model.MLanguage;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.model.MQuery;
import org.compiere.model.MReference;
import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
@ -398,12 +399,19 @@ public final class AEnv
{
zoomQuery = new MQuery(); // ColumnName might be changed in MTab.validateQuery
String column = lookup.getColumnName();
// Check if it is a Table Reference
if (lookup instanceof MLookup && DisplayType.List == lookup.getDisplayType())
// Check if it is a List Reference
if (lookup instanceof MLookup)
{
int AD_Reference_ID = ((MLookup)lookup).getAD_Reference_Value_ID();
column = "AD_Ref_List_ID";
value = DB.getSQLValue(null, "SELECT AD_Ref_List_ID FROM AD_Ref_List WHERE AD_Reference_ID=? AND Value=?", AD_Reference_ID, value);
if (AD_Reference_ID > 0)
{
MReference reference = MReference.get(AD_Reference_ID);
if (reference.getValidationType().equals(MReference.VALIDATIONTYPE_ListValidation))
{
column = "AD_Ref_List_ID";
value = DB.getSQLValue(null, "SELECT AD_Ref_List_ID FROM AD_Ref_List WHERE AD_Reference_ID=? AND Value=?", AD_Reference_ID, value);
}
}
}
//strip off table name, fully qualify name doesn't work when zoom into detail tab
if (column.indexOf(".") > 0)

View File

@ -29,7 +29,9 @@ import java.util.Properties;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.ValuePreference;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.event.ContextMenuEvent;
import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent;
@ -448,6 +450,10 @@ public class WRadioGroupEditor extends WEditor implements ContextMenuListener, L
{
WFieldRecordInfo.start(gridField);
}
else if (WEditorPopupMenu.ZOOM_EVENT.equals(evt.getContextEvent()))
{
actionZoom();
}
}
public void propertyChange(PropertyChangeEvent evt)
@ -475,6 +481,9 @@ public class WRadioGroupEditor extends WEditor implements ContextMenuListener, L
this.actionRefresh();
super.dynamicDisplay(ctx);
if (!ClientInfo.isMobile() && getPopupMenu().getParent() != null && getComponent().radioGroup.getContext() == null)
getPopupMenu().addContextElement(getComponent().radioGroup);
}
private static class RadioGroupEditor extends Hlayout {
@ -612,5 +621,13 @@ public class WRadioGroupEditor extends WEditor implements ContextMenuListener, L
@Override
public void contentsChanged(ListDataEvent e) {
refreshList();
}
}
/* (non-Javadoc)
* @see org.adempiere.webui.editor.IZoomableEditor#actionZoom()
*/
public void actionZoom()
{
AEnv.actionZoom(lookup, getValue());
}
}