/* * Smart GWT (GWT for SmartClient) * Copyright 2008 and beyond, Isomorphic Software, Inc. * * Smart GWT is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 * as published by the Free Software Foundation. Smart GWT is also * available under typical commercial license terms - see * http://smartclient.com/license * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import java.util.Map; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.callbacks.LoadProjectCallback; import com.smartgwt.client.rpc.LoadProjectSettings; import com.smartgwt.client.rpc.Project; import com.smartgwt.client.rpc.RPCResponse; import com.smartgwt.client.tools.Reify; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ButtonItem; import com.smartgwt.client.widgets.form.fields.events.ClickEvent; import com.smartgwt.client.widgets.form.fields.events.ClickHandler; import com.smartgwt.sample.showcase.client.data.ItemSupplyXmlDS; import com.smartgwt.sample.showcase.client.data.SupplyCategoryXmlDS; import com.google.gwt.core.client.EntryPoint; public class ExtendingScreensReifySample implements EntryPoint { public void onModuleLoad() { final DataSource supplyCategoryDS = SupplyCategoryXmlDS.getInstance("supplyCategory"); final DataSource supplyItemDS = ItemSupplyXmlDS.getInstance("supplyItem", "supplyCategory"); DataSource.get("supplyItem"); DataSource.get("supplyCategory"); final Canvas container = new Canvas(); container.setWidth(600); container.setHeight(300); LoadProjectSettings settings = new LoadProjectSettings(); settings.setUserName("reifySample"); settings.setPassword("tryReify"); settings.setServerURL("https://create.reify.com"); Reify.loadProject("Simple Form", new LoadProjectCallback() { @Override public void execute(Project project, Project[] projects, RPCResponse rpcResponse) { Canvas screen = project.createScreen((project.getScreenNames()[0])); final DynamicForm saveForm = (DynamicForm)screen.getByLocalId("simpleForm"); ButtonItem saveButton = (ButtonItem)saveForm.getField("saveDataButton"); saveButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Map values = saveForm.getValues(); if (!Boolean.TRUE.equals((Boolean)values.get("inStock")) && values.get("nextShipment") == null) { SC.warn("New stock items which are not already stocked must have a Stock Date"); } } }); container.addChild(screen); } }, settings); container.draw(); } @Override protected boolean isTopIntro() { return true; } }