I need do an excecution.createComponent in ZK in a for each
Then i need create the component in columns of a grid,
My code is:
<zk>
<window title="MVVM window Passing arguments and retur values. This is one.zul"
border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="#id('e') #init('Include1Composer')">
<grid id="grid1">
<columns>
<column forEach="${e.list}" label="${each}" >
<window id="${each}">
<zscript>
Map arg = new HashMap();
arg.put("columnName", ${each});
Executions.createComponents("index_1.zul",${each} , arg);
</zscript>
<textbox value="${each}"/>
</window>
</column>
</columns>
</grid>
</window>
</zk>
I am creating a window in each column and pass the id with ${each} to the excecution createComponents, therefore i create the component in each column, and i need too pass the value of the each to save in my java class, then i need pass the ${each} like arg, then i am trying with this code, but not works, if somebody can help me.
You could use a <include> tag instead of your zscript:
<column forEach="${e.list}" label="${each}" >
<window>
<include src="index_1.zul" columnName="${each}" />
<textbox value="${each}"/>
</window>
</column>
Related
In java awt I want to make a CRUD form for master detail data entry in oracle database. Gatepass master and Gatepass detail tables are joined on gatepass number using pk/fk relation.
This is form for gatepass. one gatepass receives multiple items.Format is like
Gatepass# 1 Receiving Person:Mr.Tariq
Gate pass date:21-mar-2019
Detail
item id item name qty
12 wooden chair 4
13 wooden table 1
Can any one give some sample code.
If you have more than 10 entities and using Hibernate then you can try Desktop Java Forms which I hosted at: https://github.com/smart-flex/Djf
For example here is minimalistic definition from demo-application for two master-detail relationships:
<panel constraint="Center">
<layout clazz="net.miginfocom.swing.MigLayout">
<param type="string" value="" />
<param type="string" value="[0:0, grow 70, fill][0:0, grow 30, fill]" />
<param type="string" value="[c, pref, fill] 15 [c, 150px] 10 [c, pref!]" />
</layout>
<items>
<grid bindPref="st">
<cols>
<int bind="idStreet" title="ID" width="50" enabled="no"
noResize="yes" />
<text bind="streetName" title="Street name" />
</cols>
</grid>
<grid constraint="wrap">
<cols>
<text bind="st.buildings.buildingNumber" title="Number" tips="Building number"/>
</cols>
</grid>
<grid noInfoColumn="true" bindPref="ct">
<cols>
<int bind="carId" title="ID" width="50" enabled="no"
noResize="yes" />
<text bind="carName" title="Car name" enabled="no" />
</cols>
</grid>
<grid noInfoColumn="true" constraint="wrap">
<cols>
<text bind="ct.modelList.modelName" title="Model name" enabled="no" />
</cols>
</grid>
<oper constraint="span 2"/>
</items>
</panel>
I have a request-map in controller as follows:
<request-map uri="processFirstForm">
<event type="java" path="org.ofbiz.learning.learning.LearningEvents"
invoke="processFirstForm" />
<response name="success" type="view" value="OneFormScreen" />
</request-map>
In controller, I defined a handler for java event as follows:
<handler name="java" type="request" class="org.ofbiz.webapp.event.JavaEventHandler"/>
I have a screen form as follows:
<form name="FirstForm" type="single" target="processFirstForm">
<field name="firstName">
<text />
</field>
<field name="lastName">
<text />
</field>
<field name="submit">
<submit />
</field>
</form>
I also have file LearningEvents.class in folder /bin/org/ofbiz/learning/learning
But i still receive a exception when i submit FirstForm form as follows:
ERROR rendering error page [/error/error.jsp], but here is the error
text: org.ofbiz.webapp.event.EventHandlerException: Error invoking
event, the class org.ofbiz.learning.learning.LearningEvents was not
found
Can anyone help me? thank a lot!
Do you have other java services or events in this component that are working fine? I trying to understand whether the problem is in this event or the whole component setup is not complete. Start from comparing your build.xml and ofbiz-component.xml with an existing one.
I have this code in ZK, with a menu to navigate:
<zk apply="org.zkoss.bind.BindComposer"
viewModel="#id('vm') #init('menu')">
<tabbox width="100%" sclass="nav_tabs">
<tabs id="tabs">
<tab label="Admin" onSelect="updateCategory(self.label)"/>
<tab label="User" onSelect="updateCategory(self.label)"/>
</tabs>
<tabpanels>
<tabpanel>
<toolbar hflex="true">
<toolbarbutton label="CreateUser" onClick="#Command('load',label=self.label)" />
<toolbarbutton label="CreateMno" onClick="#Command('load',label=self.label)" />
</toolbar>
</tabpanel>
<tabpanel>
<toolbar hflex="true">
<toolbarbutton label="LoadData" onClick="#Command('load',label=self.label)" />
<toolbarbutton label="DownloadData" onClick="#Command('load',label=self.label)" />
</toolbar>
</tabpanel>
</tabpanels>
</tabbox>
<separator height="30px"></separator>
<zscript><![CDATA[
void updateCategory(String category) {
current_category.setValue(category);
current_subpage.setValue("Index");
}
]]></zscript>
<hlayout>
<label id="current_category" sclass="nav_text nav_category" onClick="#command('submit')">Our Product</label>
<label sclass="nav_text">-</label>
<label id="current_subpage" sclass="nav_text">Index</label>
</hlayout>
</zk>
Then i have two roles Admin, and User, and i need load the pages of each user, and i am trying that when a user click in the toolbarbutton, for example CreateUser, then call a method that load in the space of my toolbar button the page, but i do not how can i do it.
Something like:
http://www.zkoss.org/zkdemo/tabbox/navigation_tabs
but i not need a string in Our product -> Product 1 - > Our Product-Product 1, i need load a page, and i am calling the page with the same name to the label.
And a page from a java class
Somebody can help me?
Please add the following to your tabpanel:
<include id="includeID" mode="instant" src="page.zul" />
Later on, you may load another page by adding the following to a zscript:
includeID.setSrc("another_page.zul");
I am working with liferay and want to store images in my MySQL database.
My service.xml goes like this:
<entity name="DLApp" local-service="true" remote-service="true">
<column name="blobId" type="long" primary="true" />
<column name="desc" type="String" />
<column name="image" type="Blob" />
</entity>
When i build services I get BUILD SUCCESSFUL message but an error in package com.test.blob.upload in the blobuploadModelImpl class.
How should I write function to store image in database and retrieve it?
I had same issue with Blob, so I changed it to String type, it was enought to store images up to 10 MB as string, I have used MySql as database and those column was mapped as LONGTEXT.
Also field should be 'hinted' in model hints as CLOB, See example below.
<entity name="UserExt" local-service="true" remote-service="true">
<column name="photo" type="String" />
</entity>
<model-hints>
<model name="com.project.model.UserExt">
<field name="photo" type="String">
<hint-collection name="CLOB" />
</field>
</model>
</model-hints>
Alternativelly you can store your images to Liferay's image gallery.
Suppose my entity name is SB_Claims so I generally get an error in SB_ClaimsModelImpl.java class
sb_ClaimsModelImpl._ContentBlobModel = null;
sb_ClaimsModelImpl variable is not declared or defined. We just declared this variable after sevice build operation. If you build service again then this code will remove by service builder. Always this code after service build and then do not build the service just deploy your portlet.
This will resolve the issue. In below I just modify that class.
#Override
public void resetOriginalValues()
{
SB_ClaimsModelImpl sb_ClaimsModelImpl=this;
sb_ClaimsModelImpl._ContentBlobModel = null;
}
Hope this will helpful for someone.
IzPack TargetPanel lets one select one target directory. However I need to allow users to choose two (one for apps, one for data). How to do that?
You can create a UserInputPanel and get the path as a variable from the user. Then you can use variable substitution anywhere you want. You'll have to add a userInputSpec.xml file and define your own panels (as many as you want). To get a directory, use <field type="dir" ... >
Example userInputSpec.xml from an application of mine. I include mongoDB with the installer and use this to get some settings.
<userInput>
<panel order="0">
<createForPack name="MongoDB" />
<!-- Other settings like port, ip, username, password-->
<field type="staticText" align="left" txt="Select the catalogue where data will be stored." id="staticText.registry.db.data.text" />
<field type="dir" align="left" variable="mongo.data.dir">
<spec txt="Data directory" size="25" set="$INSTALL_PATH\data" mustExist="false" create="true" />
</field>
</panel>
<panel order="1">
<!-- definition of a second panel -->
</panel>
</userInput>
You also need to include the userInputSpec.xml as a resource in your main installation file and add a UserInputPanel element for each panel that you define in userInputSpec.xml
Like this (in the <installation> element:
<resources>
<!-- other resources -->
<res id="userInputSpec.xml" src="userInputSpec.xml" />
</resources>
<panels>
<panel classname="HelloPanel"/>
<panel classname="InfoPanel"/>
<panel classname="LicencePanel"/>
<panel classname="TargetPanel"/>
<panel classname="TreePacksPanel"/>
<panel classname="UserInputPanel"/>
<panel classname="UserInputPanel"/>
<panel classname="InstallPanel"/>
<panel classname="ShortcutPanel"/>
<panel classname="FinishPanel"/>
</panels>
notice the double occurence of
I have two panels defined in my userInputSpec
Make sure that your UserInputPanels appear before InstallPanel because you have to get the variables from the user before copying your files.
This is just an example from my app. See the official documentation to get the idea of what the elements and attributes I used mean. There are many features connected with user input.