[ 2020194 ] Select BP from BP info with double-click

Make info window maximizable
This commit is contained in:
Heng Sin Low 2009-03-10 16:53:40 +00:00
parent 9d6d3dce67
commit 01f9ebc3c6
2 changed files with 45 additions and 2 deletions

View File

@ -66,6 +66,10 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
/** Array of {@link ListHeader}s for the list head. */ /** Array of {@link ListHeader}s for the list head. */
private ArrayList<ListHeader> m_headers = new ArrayList<ListHeader>(); private ArrayList<ListHeader> m_headers = new ArrayList<ListHeader>();
private Listbox listBox;
private EventListener cellListener;
/** /**
* Default constructor. * Default constructor.
* *
@ -148,10 +152,20 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
throw new IllegalArgumentException("A model element was not a list"); throw new IllegalArgumentException("A model element was not a list");
} }
if (listBox == null || listBox != item.getListbox())
{
listBox = item.getListbox();
}
if (cellListener == null)
{
cellListener = new CellListener();
}
for (Object field : (List<?>)data) for (Object field : (List<?>)data)
{ {
listcell = getCellComponent(table, field, rowIndex, colIndex); listcell = getCellComponent(table, field, rowIndex, colIndex);
listcell.setParent(item); listcell.setParent(item);
listcell.addEventListener(Events.ON_DOUBLE_CLICK, cellListener);
colIndex++; colIndex++;
} }
@ -768,6 +782,19 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
} }
} }
class CellListener implements EventListener {
public CellListener() {
}
public void onEvent(Event event) throws Exception {
if (listBox != null && Events.ON_DOUBLE_CLICK.equals(event.getName())) {
Event evt = new Event(Events.ON_DOUBLE_CLICK, listBox);
Events.sendEvent(listBox, evt);
}
}
}
} }

View File

@ -23,6 +23,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import java.util.logging.Level; import java.util.logging.Level;
@ -64,6 +65,10 @@ import org.zkoss.zul.event.ZulEvents;
public abstract class InfoPanel extends Window implements EventListener, WTableModelListener public abstract class InfoPanel extends Window implements EventListener, WTableModelListener
{ {
/**
* default serial version id
*/
private static final long serialVersionUID = 1L;
private final static int PAGE_SIZE = 100; private final static int PAGE_SIZE = 100;
public static InfoPanel create (int WindowNo, public static InfoPanel create (int WindowNo,
@ -264,7 +269,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom()); confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom());
// //
this.setSizable(true); this.setSizable(true);
this.setMaximizable(true);
this.addEventListener(Events.ON_OK, this); this.addEventListener(Events.ON_OK, this);
} // init } // init
@ -404,7 +410,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
for (int col = 0; col < p_layout.length; col++) for (int col = 0; col < p_layout.length; col++)
{ {
Object value = null; Object value = null;
Class c = p_layout[col].getColClass(); Class<?> c = p_layout[col].getColClass();
int colIndex = col + colOffset; int colIndex = col + colOffset;
if (c == IDColumn.class) if (c == IDColumn.class)
{ {
@ -506,10 +512,20 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false); setStatusLine(Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
setStatusDB(Integer.toString(no)); setStatusDB(Integer.toString(no));
addDoubleClickListener();
//workaround for scrollbar position problem //workaround for scrollbar position problem
contentPanel.renderAll(); contentPanel.renderAll();
} }
private void addDoubleClickListener() {
Iterator<?> i = contentPanel.getListenerIterator(Events.ON_DOUBLE_CLICK);
while (i.hasNext()) {
if (i.next() == this)
return;
}
contentPanel.addEventListener(Events.ON_DOUBLE_CLICK, this);
}
protected void insertPagingComponent() { protected void insertPagingComponent() {
contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling()); contentPanel.getParent().insertBefore(paging, contentPanel.getNextSibling());
} }