use of org.zkoss.zk.ui.Component in project spatial-portal by AtlasOfLivingAustralia.
the class ActiveLayersLegendEventListener method onEvent.
@Override
public void onEvent(Event event) throws Exception {
MapComposer mapComposer = getMapComposer(event);
if (mapComposer != null && mapComposer.safeToPerformMapAction()) {
// get reference to the label/image the user clicked on
Component target = event.getTarget();
Listitem listItem = (Listitem) target.getParent().getParent();
listItem.setSelected(true);
} else {
LOGGER.debug("MapController reports unsafe to perform action");
}
}
use of org.zkoss.zk.ui.Component in project spatial-portal by AtlasOfLivingAustralia.
the class ActiveLayerDNDEventListener method onEvent.
@Override
public void onEvent(Event event) throws Exception {
LOGGER.debug("active layers item drop received");
MapComposer mapComposer = getMapComposer(event);
if (mapComposer != null && mapComposer.safeToPerformMapAction()) {
LOGGER.debug("inside ActiveLayerDNDEventListener.onEvent()");
if (event instanceof DropEvent) {
DropEvent dragEvent = (DropEvent) event;
// we support the treechildren and other list items...
Component eventType = dragEvent.getDragged();
if (eventType instanceof Listitem) {
reorderList(mapComposer, dragEvent);
} else {
LOGGER.debug("unsupported dnd event " + eventType.getClass().getName());
}
} else {
LOGGER.debug("event is not a DropEvent instance: " + event.getClass().getName());
}
}
}
use of org.zkoss.zk.ui.Component in project spatial-portal by AtlasOfLivingAustralia.
the class ActiveLayersInfoEventListener method onEvent.
@Override
public void onEvent(Event event) throws Exception {
MapComposer mapComposer = getMapComposer(event);
if (mapComposer != null && mapComposer.safeToPerformMapAction()) {
// get reference to the label/image the user clicked on
Component target = event.getTarget();
Listitem listItem = (Listitem) target.getParent().getParent();
MapLayer activeLayer = listItem.getValue();
if (activeLayer != null) {
if (activeLayer.getSpeciesQuery() != null) {
Query q = activeLayer.getSpeciesQuery();
Events.echoEvent(StringConstants.OPEN_HTML, mapComposer, q.getMetadataHtml());
} else if (activeLayer.getMapLayerMetadata().getMoreInfo() != null && activeLayer.getMapLayerMetadata().getMoreInfo().startsWith("http://")) {
String infourl = activeLayer.getMapLayerMetadata().getMoreInfo().replace("__", ".");
if (activeLayer.getSubType() == LayerUtilitiesImpl.SCATTERPLOT) {
ScatterplotDataDTO data = activeLayer.getScatterplotDataDTO();
infourl += "?dparam=X-Layer:" + data.getLayer1Name();
infourl += "&dparam=Y-Layer:" + data.getLayer2Name();
}
// send the user to the BIE page for the species
LOGGER.debug("opening the following url " + infourl);
Events.echoEvent(StringConstants.OPEN_URL, mapComposer, activeLayer.getMapLayerMetadata().getMoreInfo().replace("__", "."));
} else if (activeLayer.getMapLayerMetadata().getMoreInfo() != null && activeLayer.getMapLayerMetadata().getMoreInfo().length() > 0) {
LOGGER.debug("performing a MapComposer.showMessage for following content " + activeLayer.getMapLayerMetadata().getMoreInfo());
String metadata = activeLayer.getMapLayerMetadata().getMoreInfo();
Events.echoEvent(StringConstants.OPEN_HTML, mapComposer, metadata);
} else if (activeLayer.getType() == LayerUtilitiesImpl.MAP) {
String metaurl = "http://www.google.com/intl/en_au/help/terms_maps.html";
if ("outline".equalsIgnoreCase(mapComposer.getPortalSession().getBaseLayer())) {
metaurl = "openstreetmap_metadata.html";
} else if ("minimal".equalsIgnoreCase(mapComposer.getPortalSession().getBaseLayer())) {
metaurl = "http://www.naturalearthdata.com/about/terms-of-use";
}
LOGGER.debug("opening base map metadata for: " + mapComposer.getPortalSession().getBaseLayer() + ", url:" + metaurl);
Events.echoEvent(StringConstants.OPEN_URL, mapComposer, metaurl);
} else {
LOGGER.debug("no metadata is available for current layer");
mapComposer.showMessage("Metadata currently unavailable");
}
}
} else {
LOGGER.debug("MapController reports unsafe to perform action");
}
}
use of org.zkoss.zk.ui.Component in project adempiere by adempiere.
the class DynamicDashBoard method createRows.
/**
*
* @return Rows <BR>
*
*
* This method creates the Rows
*/
public Rows createRows() {
Vbox msgbox = new Vbox();
Label rowItem = null;
Rows rows = new Rows();
ResultSet rs = null;
if (rows.getChildren() != null) {
List<Component> childs = rows.getChildren();
for (Component cmp : childs) {
rows.removeChild(cmp);
}
}
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement(sqlQuery.toString(), null);
try {
rs = pstmt.executeQuery();
try {
if (rs.next()) {
grid.setVisible(true);
msgbox.setVisible(false);
prepareRow(rs, lable, rows);
while (rs.next()) {
prepareRow(rs, lable, rows);
}
} else {
vbox.removeChild(msgbox);
grid.setVisible(false);
msgbox.setVisible(true);
if (msgbox != null && msgbox.getChildren().size() > 0) {
msgbox.removeChild(rowItem);
}
grid.setVisible(false);
msgbox.setVisible(true);
String msg = Msg.getMsg(Env.getCtx(), "NO_DATA");
rowItem = new Label(msg);
rowItem.setParent(msgbox);
msgbox.setParent(vbox);
}
} catch (SQLException e) {
logger.log(Level.SEVERE, "SQL faile");
}
} catch (Exception e) {
logger.log(Level.SEVERE, e.toString() + " Check for configured Zoom Tab having Primary key of Table:" + table.getTableName());
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
logger.log(Level.SEVERE, "Unable to close Resultset:" + e);
}
}
}
return rows;
}
use of org.zkoss.zk.ui.Component in project adempiere by adempiere.
the class DynamicDashBoard method onEvent.
public void onEvent(Event event) throws Exception {
Component comp = event.getTarget();
Row row = (Row) comp;
int recordId = new Integer(row.getId());
MQuery query = new MQuery();
query.setZoomValue(recordId);
query.setZoomTableName(zoomTableName);
query.setZoomColumnName(zoomTableColumnName);
query.setRecordCount(1);
query.addRestriction(zoomTableColumnName, MQuery.EQUAL, new Integer(recordId));
AEnv.zoom(zoomWindowId, query);
}
Aggregations