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");
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 am building a UI using Java FX scene builder and I want a button in a toolbar to float towards the right side of the toolbar. I have tried changing the node orientation of the parent(toolbar) and also the button but both seem to be ignored.
Add a pane with no content which always grows to fit available space between the left aligned tools in the bar and right aligned ones.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<ToolBar prefHeight="40.0" prefWidth="318.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
<Button text="Apples" />
<Button text="Oranges" />
<Pane HBox.hgrow="ALWAYS" />
<Button text="Help" />
</ToolBar>
(Verified in Scene Builder 11.0.0)
One option: Use two ToolBar containers wrapped with an HBox container. Put the Help button in the right ToolBar. Put the left-aligned buttons in the left toolbar. For the left ToolBar, set the HGrow to ALWAYS. For the Right ToolBar, set HGrow to NEVER. For each ToolBar, set all Sizes to USE_COMPUTED_SIZE.
Here is the relevant fxml:
<HBox VBox.vgrow="NEVER">
<children>
<ToolBar HBox.hgrow="ALWAYS">
<items>
<Button text="Apples" />
<Button text="Oranges" />
</items>
</ToolBar>
<ToolBar HBox.hgrow="NEVER">
<items>
<Button text="Help" />
</items>
</ToolBar>
</children>
</HBox>
This is the hierarchy as displayed in Scene Builder:
This is the display within Scene Builder:
If you could place ur button inside a stack pane then u could make use of Stackpane's alignment property that takes javafx.geometry.Pos - The alignment of the child within the stackpane.For example in ur case:
<StackPane >
<Button translateY="-15" translateX="15" StackPane.alignment="TOP_RIGHT"/>
</StackPane>
BorderPane mainBorderPane = new BorderPane();
BorderPane ToolBorderPane = new BorderPane();
ToolBar tBarLeft=new ToolBar();
ToolBar tBarRight=new ToolBar();
ToolBorderPane.setLeft(tBarLeft);
ToolBorderPane.setRight(tBarRight);
mainBorderPane.setTop(ToolBorderPane);
...
...
for your left aligment items add tBarLeft and
your right aligment items add tBarRight
It can be done with some hack: apply 180 degree rotation around Y-axis for the toolbar and all its buttons.
<ToolBar rotate="-180.0" HBox.hgrow="ALWAYS">
<items>
<Button mnemonicParsing="false" rotate="180.0" text="Button">
<rotationAxis>
<Point3D y="1.0" />
</rotationAxis>
</Button>
</items>
<rotationAxis>
<Point3D y="1.0" />
</rotationAxis>
</ToolBar>
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>
For some additional/custom attributes, like tab indices or tool tip texts, it would be nice to annotate the FXML with custom annotations. I have three proposals for it:
XML-Comment:
<!-- #TabIndex(index=1) -->
<Button fx:id="test_audio" text="Test" />
fx attribute:
<Button fx:id="test_audio" fx:tab_index="1" text="Test" />
Custom XML namespace attribute :
<Button fx:id="test_audio" custom:tab_index="1" text="Test" />
Is there a way to do this and get the attribute values on runtime?
I want to show struts2 menu on my jsp page but it gives me errorr as follows:
javax.servlet.jsp.JspException: The menu repository could not be found.
I search on internet i found that it requires commons.lang jar, commons-logging.jar and i already have this jar in my struts2 project.
How can i show struts2 menu on my jsp page?
My jsp code as follows:
<menu:useMenuDisplayer name="TabbedMenu" config="/templates/tabs.html">
<ul id="primary-nav" >
<li class="pad"> </li>
<menu:displayMenu name="Order"/>
<menu:displayMenu name="Report"/>
<menu:displayMenu name="BatchProcessing"/>
<menu:displayMenu name="Master"/>
</ul>
</menu:useMenuDisplayer>
I have menu-config.xml as follows:
<MenuConfig>
<Displayers>
<Displayer name="TabbedMenu" type="net.sf.navigator.displayer.TabbedMenuDisplayer"/>
</Displayers>
<Menus>
<Menu name="Order" title="Order" />
<Menu name="Report" title="Report" />
<Menu name="BatchProcessing" title="Batch Processing" />
<Menu name="Master" title="Master" />
</Menus>
</MenuConfig>
add commons-logging.jar and commons-lang.jar in your project at WEB-INF/Lib