* Zoom window missing close button.

* Searchbox should set editor to readonly instead of disable when not enabled.
* Allow user to zoom by clicking on the field label.
* Datebox should be set to readonly instead of disable when not enabled.
This commit is contained in:
Heng Sin Low 2008-07-09 20:47:19 +00:00
parent 1bcf2e650c
commit c4ba906b73
8 changed files with 46 additions and 8 deletions

View File

@ -253,7 +253,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
Tabpanel tabPanel = new Tabpanel();
wnd.createPart(tabPanel);
windowContainer.addWindow(tabPanel, wnd.getTitle(), false);
windowContainer.addWindow(tabPanel, wnd.getTitle(), true);
}
public void showWindow(Window win)

View File

@ -29,6 +29,6 @@ public class Datebox extends org.zkoss.zul.Datebox
public void setEnabled(boolean enabled)
{
this.setDisabled(!enabled);
this.setReadonly(!enabled);
}
}

View File

@ -70,7 +70,7 @@ public class Searchbox extends Panel
public void setEnabled(boolean enabled)
{
txt.setEnabled(enabled);
txt.setReadonly(!enabled);
btn.setEnabled(enabled);
}

View File

@ -0,0 +1,7 @@
package org.adempiere.webui.editor;
public interface IZoomableEditor {
public void actionZoom();
}

View File

@ -75,6 +75,9 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
init();
}
public boolean isZoomEnabled() {
return zoomEnabled;
}
private void init()
{

View File

@ -54,7 +54,7 @@ import org.zkoss.zk.ui.event.Events;
* @author Ashley G Ramdass
*
*/
public class WSearchEditor extends WEditor implements ContextMenuListener, PropertyChangeListener, ValueChangeListener
public class WSearchEditor extends WEditor implements ContextMenuListener, PropertyChangeListener, ValueChangeListener, IZoomableEditor
{
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
private Searchbox searchbox;
@ -235,7 +235,7 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Prope
setValue(value);
}
private void actionZoom()
public void actionZoom()
{
AEnv.actionZoom(lookup, getValue());
}

View File

@ -47,7 +47,7 @@ import org.zkoss.zk.ui.event.Events;
* @version $Revision: 0.10 $
*/
public class WTableDirEditor extends WEditor implements ListDataListener,
ContextMenuListener
ContextMenuListener, IZoomableEditor
{
public final String[] LISTENER_EVENTS = {Events.ON_SELECT};
@ -236,7 +236,10 @@ ContextMenuListener
}
}
private void actionZoom()
/* (non-Javadoc)
* @see org.adempiere.webui.editor.IZoomableEditor#actionZoom()
*/
public void actionZoom()
{
AEnv.actionZoom(lookup, getValue());
}

View File

@ -30,9 +30,11 @@ import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.ToolBar;
import org.adempiere.webui.editor.IZoomableEditor;
import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu;
import org.adempiere.webui.editor.WSearchEditor;
import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.ContextMenuListener;
import org.adempiere.webui.event.ValueChangeEvent;
@ -265,7 +267,8 @@ DataStatusListener, ValueChangeListener
editors.add(comp);
Div div = new Div();
div.setAlign("right");
div.appendChild(comp.getLabel());
Label label = comp.getLabel();
div.appendChild(label);
row.appendChild(div);
row.appendChild(comp.getComponent());
if (field.isLongField()) {
@ -296,6 +299,11 @@ DataStatusListener, ValueChangeListener
{
popupMenu.addMenuListener((ContextMenuListener)comp);
this.appendChild(popupMenu);
if (popupMenu.isZoomEnabled() && comp instanceof IZoomableEditor)
{
label.setStyle("cursor: pointer; text-decoration: underline;");
label.addEventListener(Events.ON_CLICK, new ZoomListener((IZoomableEditor) comp));
}
}
}
}
@ -624,4 +632,21 @@ DataStatusListener, ValueChangeListener
listPanel.activate(gridTab);
}
}
class ZoomListener implements EventListener {
private IZoomableEditor searchEditor;
ZoomListener(IZoomableEditor editor) {
searchEditor = editor;
}
public void onEvent(Event event) throws Exception {
if (Events.ON_CLICK.equals(event.getName())) {
searchEditor.actionZoom();
}
}
}
}