How to add text to the form in smartclient? TS2339: Property 'fields' does not exist on type 'JSX.IntrinsicElements' - smartclient

SmartClient Version: v12.1p_2021-05-22/LGPL Deployment (built 2021-05-22)
I have just copied code from documentation:
https://smartclient.com/smartclient-latest/isomorphic/system/reference/?id=class..HeaderItem
<DynamicForm width="300">
<fields>
<field defaultValue="Office Supplies" type="header"/>
<field title="Item" type="text"/>
</fields>
</DynamicForm>
Getting those errors:
src/page/invoicing/tabs/InvoiceAdHocChargesTabLayout.tsx:57:25 - error TS2339: Property 'fields' does not exist on type 'JSX.IntrinsicElements'.
57 <fields>
~~~~~~~~
src/page/invoicing/tabs/InvoiceAdHocChargesTabLayout.tsx:58:29 - error TS2339: Property 'field' does not exist on type 'JSX.IntrinsicElements'.
58 <field defaultValue="Office Supplies" type="header"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/page/invoicing/tabs/InvoiceAdHocChargesTabLayout.tsx:59:29 - error TS2339: Property 'field' does not exist on type 'JSX.IntrinsicElements'.
59 <field title="Item" type="text"/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/page/invoicing/tabs/InvoiceAdHocChargesTabLayout.tsx:60:25 - error TS2339: Property 'fields' does not exist on type 'JSX.IntrinsicElements'.
60 </fields>
~~~~~~~~~
[12:30:00 PM] Found 8 errors. Watching for file changes.
///<reference path="../ds/InvoiceAdHocChargeDataSource.ts"/>
///<reference path="tabs/InvoiceRecordPriceTab.ts"/>
Full file:
namespace page.invoicing.tabs {
import InvoiceAdHocChargeDataSource = page.invoicing.ds.InvoiceAdHocChargeDataSource;
export class InvoiceAdHocChargesTabLayout implements core.Layout<isc.IVLayout> {
readonly sc: isc.IVLayout;
public _listGridRecords: isc.IListGrid<InvoiceAdHocChargeDataSource.Record>
private _dynamicForm: isc.IDynamicForm<InvoiceAdHocChargeDataSource.Record>;
private readonly _newFormFields = ["feeCode", "description", "price", "quantity", "vatCode", "remarks"];
private readonly _events = {
}
get events() {
return utils.Callback.publish(this._events)
}
constructor() {
this.sc =
<VLayout>
<HLayout height={30} membersMargin={5} layoutMargin={0}>
<LayoutSpacer/>
</HLayout>
{this._listGridRecords =
<ListGrid dataSource={InvoiceAdHocChargeDataSource.sc()}
useAllDataSourceFields={false}
autoFetchData={false}
selectionType="single"
// editEvent="doubleClick"
showRecordComponents
showRecordComponentsByCell
// createRecordComponent={(record, colNum) => this._createListGridRecordComponent(record, colNum)}
// canEdit={core.AccessControl.instance.has(InvoiceRecordDataSource.get(), c.system.type.Permission.Update)}
>
<ListGridField name={"feeCode"}/>
<ListGridField name={"description"}/>
<ListGridField name={"quantity"}/>
<ListGridField name={"price"}/>
<ListGridField name={"vat"}/>
</ListGrid>
}
<DynamicForm width="300">
<fields>
<field defaultValue="Office Supplies" type="header"/>
<field title="Item" type="text"/>
</fields>
</DynamicForm>
{
this._dynamicForm =
<DynamicForm dataSource={InvoiceAdHocChargeDataSource.sc()} useAllDataSourceFields={true}>
<FormFieldItem name="feeCode"
required={true}
/>
<FormFieldItem name="description"
required={true}
/>
<FormFieldItem name="price"
required={true}
/>
<FormFieldItem name="quantity"
required={true}
/>
<FormFieldItem name="vatCode"
required={true}
/>
<FormFieldItem name="remarks"/>
</DynamicForm>
}
</VLayout>
}
showNewForm() {
// todo matyt inicializtuot pagal InvoiceDataTabLayout
this._dynamicForm.getFields().forEach((item) => {
if (item.name && this._newFormFields.indexOf(item.name) > -1) {
item.show()
} else {
item.hide()
}
})
}
}
}
What is wrong here that code copied from documentation does not work? What I am missing? Where to look at?
Documentation shows .xml example. My file is .tsx. So probably need to change something in that example.

Found a way to add text:
<HTMLFlow contents={`<span>test</span>`}/>

Related

LoadException when trying to load new window fxml

I have javafx menu, I want to switch to another window. When I was using Java-8 everything worked, but now I switched to javafx-11 and java-11 and I cannot switch.
Switching code
AnchorPane pane = FXMLLoader.load(getClass().getResource("/main/main.fxml"), resources);
I was searching internet and stackoverflow and I tried following
1. In Inteliij idea I added all modules and libraries and applied the changes in Project Structure.
2. I added to src package module-info.java
3. I checked if fxml I am trying to load doesn´t contain any errors or unsed ids.
4. I checked names of controllers and fxmls I am trying to load
Code of the module-info.java
module duno {
requires javafx.fxml;
requires javafx.controls;
requires java.logging;
requires javafx.web;
opens main;
}
Code of the method from Controller which I am calling to get the Settings window
#FXML
void goto_settings(ActionEvent event) {
try {
ResourceBundle resources;
switch(settings.getLanguage().get(settings.getSelectedLanguage())) {
case "Czech":
resources = ResourceBundle.getBundle("/bundles/LangBundle_cz");
break;
default:
resources = ResourceBundle.getBundle("/bundles/LangBundle_en");
}
AnchorPane pane = load(getClass().getResource("/settings/settings.fxml"), resources);
rootpane.getChildren().setAll(pane);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
Settings Controller
package settings;
import duno.Serialization;
import duno.Settings;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.AnchorPane;
import javafx.stage.DirectoryChooser;
import main.Main;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* FXML Controller class
*
* #author Filip
*/
public class SettingsController implements Initializable {
#FXML
private AnchorPane rootpane;
#FXML
private ComboBox<String> adf_combobox;
#FXML
private ComboBox<String> pf_combobox;
#FXML
private CheckBox del_checkbox;
#FXML
private ComboBox<String> language_combobox;
private Settings settings;
/**
* Initializes the controller class.
*/
#Override
public void initialize(URL url, ResourceBundle rb) {
/*
Load old settings or create new if settings file doesnt exist
*/
Serialization ser = new Serialization();
String fileName = ser.getFolder() + "settings" + ser.getExt();
File f = new File(fileName);
if(f.exists() && !f.isDirectory()) {
try {
Settings oldSettings = (Settings) ser.deserialize("settings");
settings = oldSettings;
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
} else {
settings = new Settings();
}
/*
Setup the GUI
*/
adf_combobox.getItems().addAll(settings.getActiveDownloadFolder());
adf_combobox.getSelectionModel().select(settings.getSelectedActiveDownloadFolder());
pf_combobox.getItems().addAll(settings.getPreferredFormat());
pf_combobox.getSelectionModel().select(settings.getSelectedPreferredFormat());
del_checkbox.setSelected(settings.isDownloadEntireList());
language_combobox.getItems().addAll(settings.getLanguage());
language_combobox.getSelectionModel().select(settings.getSelectedLanguage());
}
#FXML
void addNewDownloadFolder(ActionEvent event) {
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory = directoryChooser.showDialog(rootpane.getScene().getWindow());
if(selectedDirectory == null){
// Nothing was selected
} else{
settings.addActiveDownloadFolder(selectedDirectory.getAbsolutePath());
System.out.println(settings.getActiveDownloadFolder().toString());
adf_combobox.getItems().setAll(settings.getActiveDownloadFolder());
}
}
#FXML
void removeSelectedDownloadFolder(ActionEvent event) {
if(adf_combobox.getItems().size() <= 1) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Warning Dialog");
alert.setHeaderText("You can´t remove this download folder");
alert.setContentText("You can´t remove all download folders");
alert.showAndWait();
} else {
int item = adf_combobox.getSelectionModel().getSelectedIndex();
settings.removeActiveDownloadFolder(item);
adf_combobox.getItems().setAll(settings.getActiveDownloadFolder());
adf_combobox.getSelectionModel().selectFirst();
}
}
#FXML
void saveSettings(ActionEvent event) {
settings.setSelectedActiveDownloadFolder(adf_combobox.getSelectionModel().getSelectedIndex());
settings.setSelectedPreferredFormat(pf_combobox.getSelectionModel().getSelectedIndex());
settings.setDownloadEntireList(del_checkbox.isSelected());
settings.setSelectedLanguage(language_combobox.getSelectionModel().getSelectedIndex());
System.out.println(settings.getLanguage().get(settings.getSelectedLanguage()));
Serialization ser = new Serialization();
String fileName = ser.getFolder() + "settings" + ser.getExt();
File f = new File(fileName);
if(f.delete()) {
System.out.println("File deleted");
ser.serialize(settings, "settings");
} else {
System.out.println("Settings file not deleted");
}
}
#FXML
void gotoDownloads(ActionEvent event) {
try {
ResourceBundle resources;
switch(settings.getLanguage().get(settings.getSelectedLanguage())) {
case "Czech":
resources = ResourceBundle.getBundle("bundles/LangBundle_cz");
break;
default:
resources = ResourceBundle.getBundle("bundles/LangBundle_en");
}
AnchorPane pane = FXMLLoader.load(getClass().getResource("/main/main.fxml"), resources);
rootpane.getChildren().setAll(pane);
} catch (IOException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Settings fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<AnchorPane id="AnchorPane" fx:id="rootpane" minHeight="800.0" minWidth="1000.0" prefHeight="800.0" prefWidth="1000.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="settings.SettingsController">
<children>
<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<MenuBar>
<menus>
<Menu mnemonicParsing="false" onAction="#gotoDownloads" text="Download">
<items>
<MenuItem mnemonicParsing="false" onAction="#gotoDownloads" text="Download" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Settings">
<items>
<MenuItem mnemonicParsing="false" text="Settings" />
</items>
</Menu>
</menus>
</MenuBar>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="443.79998779296875" minWidth="10.0" prefWidth="272.8000244140625" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="561.4000396728516" minWidth="10.0" prefWidth="303.1999755859375" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="737.199951171875" minWidth="10.0" prefWidth="289.60002441406255" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="575.4000244140625" minWidth="10.0" prefWidth="121.20002441406245" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
<RowConstraints minHeight="10.0" prefHeight="30.0" />
</rowConstraints>
<children>
<Label text="%active_download_folder_text" />
<ComboBox fx:id="adf_combobox" prefHeight="26.0" prefWidth="294.0" GridPane.columnIndex="1" />
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="2">
<children>
<Button mnemonicParsing="false" onAction="#addNewDownloadFolder" text="%add_new_active_download_folder_button_text" />
<Button mnemonicParsing="false" onAction="#removeSelectedDownloadFolder" text="%remove_selected_active_download_folder_button_text" />
</children>
<padding>
<Insets top="5.0" />
</padding>
</HBox>
<Label text="%preferred_format_text" GridPane.rowIndex="1" />
<ComboBox fx:id="pf_combobox" prefHeight="26.0" prefWidth="114.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="1">
<opaqueInsets>
<Insets top="5.0" />
</opaqueInsets>
<padding>
<Insets top="5.0" />
</padding>
</HBox>
<Label text="%always_download_entire_list_text" GridPane.rowIndex="2" />
<CheckBox fx:id="del_checkbox" mnemonicParsing="false" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<Label text="%language_text" GridPane.rowIndex="3" />
<ComboBox fx:id="language_combobox" prefHeight="26.0" prefWidth="162.0" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<HBox prefHeight="100.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="3">
<padding>
<Insets top="5.0" />
</padding>
</HBox>
<Button mnemonicParsing="false" onAction="#saveSettings" text="%save_button_text" GridPane.columnIndex="3" GridPane.rowIndex="4" />
</children>
<padding>
<Insets left="20.0" top="10.0" />
</padding>
</GridPane>
</children>
</GridPane>
</children>
</AnchorPane>
It should load settings window as it did in java-8 but now I got and error
Run log
"C:\Program Files\Java\jdk-11.0.3\bin\java.exe" --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\lib\idea_rt.jar=50856:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1.1\bin" -Dfile.encoding=UTF-8 -p C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.base.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.graphics.jar;E:\duno\out\production\duno;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx-swt.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.controls.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.fxml.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.media.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.swing.jar;C:\Users\Filip\Documents\javafx-sdk-11.0.2\lib\javafx.web.jar -m duno/main.Main
English
kvě 10, 2019 10:57:10 DOP. main.Controller goto_settings
SEVERE: null
javafx.fxml.LoadException:
/E:/duno/out/production/duno/settings/settings.fxml:17
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:105)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:943)
at javafx.fxml/javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:980)
at javafx.fxml/javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:227)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:752)
at javafx.fxml/javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2722)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2552)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3128)
at duno/main.Controller.goto_settings(Controller.java:184)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:76)
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.base/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:273)
at javafx.fxml/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:83)
at javafx.fxml/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1782)
at javafx.fxml/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1670)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.controls/javafx.scene.control.MenuItem.fire(MenuItem.java:465)
at javafx.controls/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1380)
at javafx.controls/com.sun.javafx.scene.control.ContextMenuContent$MenuItemContainer.lambda$createChildren$12(ContextMenuContent.java:1333)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalAccessException: class javafx.fxml.FXMLLoader$ValueElement (in module javafx.fxml) cannot access class settings.SettingsController (in module duno) because module duno does not export settings to module javafx.fxml
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99)
at java.base/java.lang.Class.newInstance(Class.java:579)
at javafx.fxml/javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:936)
... 66 more
Don´t mind the English in the output it´s just the language used in app
I figured it out on my own.
Here is how I proceeded.
I read the error several times, and then I though it need to export something. So I found that module info have exports something to something. So I added exports settings to javafx.fxml.
Another problem that I could not access settings because rootpane was private and settings were not opened. So I tried open settings; and it works :)
So here is final version
module duno {
requires javafx.fxml;
requires javafx.controls;
requires java.logging;
requires javafx.web;
exports settings to javafx.fxml;
opens main;
opens settings;
}
I hope it helps someone in future with same error

How to get values from odoo context in qweb templating in odoo 9?

I'm working in odoo 9. I have opened a wizard from JS and in that I have passed context, I want to use this context in my wizard. How can I do this?
Please see my code.
myfunc: function(e) {
var mycontext = {};
var is_checked = this.field_manager.get_field_value('Default')
if (is_checked)
{
var model_obj = new Model('olims.ar_priority');
var domain = [['Default', '=', true]];
model_obj.call('search_read',[domain]).then(function(result){
mycontext['current_priority'] = result[0]['Priority'];
})
alert()
this.do_action({
name: ("Pop Up"),
res_model: 'olims.ar.priority.wizard',
type: 'ir.actions.act_window',
view_type: 'form',
view_mode: 'form',
views: [
[false,'form']
],
target: 'new',
context : mycontext,
});
}
and this is xml
<record model="ir.ui.view" id="olims_ar_priority_confirm_wizard">
<field name="name">Set Default Priority Wizard</field>
<field name="model">olims.ar.priority.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form>
<group>
<templates>
<t t-set="priority" t-value="request.env.context['current_priority']"/>
<span><t t-esc="priority"/> is set as default</span>
</templates>
</group>
<footer>
<button string="Cancel" special="cancel" class="oe_highlight"/>
<button name="agent_exceed_limit" string="Request Manager to Approve Sale" type="object" class="oe_highlight" />
</footer>
</form>
</field>
</record>

How to upload images in tree view and display it in the tree or list view in Openerp 7 or Odoo

I have used the below code and on clicking on save. It saves the file but on clicking on the saved file. It is downloading it with a bin file format.
I have 2 doubts:
How do I download it using the same filename and extension that was uploaded.
How can I view all the images in the tree view from where it was uploaded. Using widget="image" does not work.
The openerp.py file:
{
'name' : 'Vyas File Upload Demo',
'version' : '0.1',
'category' : 'Demo',
'description' :
"""
Module to test the working of File upload and download in Openerp 7
""",
'author' : 'Vyas Senthil',
'license' : 'AGPL-3',
'depends' : [],
'init_xml' : [],
'demo_xml' : [],
'update_xml' : ['file_upload_demo_view.xml'],
'active': False,
'installable': True,
}
file upload demo.py [Python file]:
from osv import osv,fields
from datetime import date,datetime
from openerp import netsvc
from openerp import SUPERUSER_ID
from openerp.tools.translate import _
from operator import itemgetter
import base64
import time
import re
import psycopg2 as psy
import sys
import pprint # To print python objects in a readable format , use "pprint.pprint(obj or dictionary)".
import pdb # To debug python files. Use pdb.set_trace()
class manage_inspection(osv.osv):
''' Inspection module'''
_name = 'manage.inspection'
_columns = {
'name': fields.char('Inspection Number',required=True), # Inspection Number
'file_upload_demo_grid': fields.one2many('file.upload.demo','manage_inspection_id', 'File upload Grid'),
}
class file_upload_demo(osv.osv):
#class to maintain plant type
_name = 'file.upload.demo'
def _get_contract_file_name(self, cr, uid, ids, field_name, arg, context=None):
''' To set the name_filename field'''
result = {}
for product_data in self.browse(cr, uid, ids, context=context):
result[product_data.id] = product_data['file_path']
return result
return result
_columns = {
'image_upload': fields.binary(string='Image Upload new'),
'file_path': fields.char('File Name and Extension', size=128),
'name_filename':fields.function(_get_contract_file_name, type="char", size=255, method=True, string="File Name"),
'manage_inspection_id': fields.many2one('manage.inspection','Manage Inspection Id'), # Connection to Parent form.
}
file_upload_demo()
file_upload_demo_view.xml [XML file]:
<?xml version="1.0" ?>
<openerp>
<data>
<!-- Top Menu -->
<menuitem name="Vyas File Upload Demo"
id="file_upload_demo_top_menu"
sequence="32"/>
<!-- Side Menu Heading -->
<menuitem name="File Upload Demo"
id="file_upload_demo_side_heading"
parent="file_upload_demo_top_menu"
sequence="1"/>
<!-- inspection form view -->
<record model="ir.ui.view" id="view_file_upload_demo_form">
<field name="name">manage.inspection.form</field>
<field name="model">manage.inspection</field>
<field name="arch" type="xml">
<form string="Manage Inspection" version="7.0">
<!-- File Upload method -->
<field name="name" placeholder="Inspection Number" style="width:30%%" />
<!-- Grid - Upload Photos -->
<field name="file_upload_demo_grid" />
</form>
</field>
</record>
<!-- file_upload_demo tree view -->
<record model="ir.ui.view" id="view_file_upload_demo_tree">
<field name="name">file.upload.demo.tree</field>
<field name="model">file.upload.demo</field>
<field name="arch" type="xml">
<tree string="file upload demo" editable="top">
<!-- File Upload method -->
<field name="file_path" />
<field name="image_upload" filename="file_path" />
</tree>
</field>
</record>
<!-- action menu -->
<record model="ir.actions.act_window" id="action_upload_files_demo">
<field name="name">Inspection </field> <!-- view label -->
<field name="res_model">manage.inspection</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Side menu to open Manage Sales Invoice -->
<menuitem
name="Upload Files Demo"
id="upload_file_demo"
parent="file_upload_demo_side_heading"
sequence="3"
action="action_upload_files_demo"/>
</data>
</openerp>
look for Document button in project module this is allow you to attach multiple attachment and view them it tree , view the most beautiful thing that is preserve your attachment name and extension (try to do like it )
Note:
this attachment can be image or any type of attachment

Struts 1.3 not able to validate using xml ValidatorForm

I am making simple login page and trying to validate it using struts ValidatorForm but its not working. But same code worked for DynaValidatorForm. Not able to understand what's problem.
It is not showing any error when I click login button.
Here is my code.
login.jsp
<body>
<div style="color:red">
<html:errors />
</div>
<html:form action="/Login" >
User Name : <html:text name="LoginForm" property="username" /> <br>
Password : <html:password name="LoginForm" property="password" /> <br>
<html:submit value="Login" />
</html:form>
</body>
LoginAction.java
public class LoginAction extends Action
{ public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LoginForm loginForm=(LoginForm) form;
String userName = loginForm.getUsername();
String password = loginForm.getPassword();
if(userName.equals("sumeet") )
{
return mapping.findForward("success");
}
else
{
return mapping.findForward("failure");
}
struts.config
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<form-beans>
<form-bean name="LoginForm" type="com.ibm.Forms.LoginForm" >
</form-bean>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
<action name="LoginForm" path="/Login" scope="session" input="/login.jsp" type="com.ibm.Action.LoginAction" cancellable="true" validate="true">
<forward name="success" path="/success.jsp"/>
</action>
</action-mappings>
<message-resources parameter="test2.resources.ApplicationResources"/>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
valdiation.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE form-validation PUBLIC "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN" "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd" >
<form-validation>
<formset>
<form name="LoginForm">
<field property="username" depends="required">
</field>
<field property="password" depends="required,minlength">
<arg1 key="${var:minlength}" name="minlength" resource="false"/>
<var>
<var-name>minlength</var-name>
<var-value>6</var-value>
</var>
</field>
</form>
</formset>
</form-validation>
Thank you.
You are missing the .do in the action attribute of the html form. You don't need the name attribute in both inputs.
<html:form action="/Login.do" >
User Name : <html:text property="username" /> <br>
Password : <html:password property="password" /> <br>
<html:submit value="Login" />
</html:form>

Edit Title in Silverlight 4

We are developing an out-of-browser Silverlight 4 application and want to change the title after the application loads.
Example:
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainPage_Loaded);
}
public string UserName { get; set; }
public string VersionNumber { get; set; }
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
string title = string.Format("MyApplication {0} {1} ", this.VersionNumber, this.UserName);
HtmlPage.Window.Eval(string.Format("document.title='{0}'", title));
}
}
Three things I have tried:
The above example does not work and throws an InvalidOperationException "The DOM/scripting bridge is disabled." All the references I found, example, said the HTML bridge is disabled in OOB mode.
Create a custom OOB Window, example, but I would prefer a more elegant solution.
Adjust the OutOfBrowserSettings.xml file, but it doesn't appear that I can get access to it after Load.
Any ideas on how to adjust the title after the application has loaded?
Unfortunately, the only way to do this is to create a custom OOB Window:
Look here and here for examples.
Try setting:
<param name="windowless" value="true"/>
<object id="SilverlightControlApp" data="data:application/x-silverlight-2," type="application/x-silverlight-2"
width="100%" height="100%">
<param name="source" value="ClientBin/MyTestApp.Client.xap" />
<param name="onError" value="onSilverlightError" />
<param name="background" value="white" />
<param name="minRuntimeVersion" value="4.0.50826.0" />
<param name="windowless" value="true"/>
<%-- <param name="minRuntimeVersion" value="3.0.40818.0" />--%>
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration: none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
style="border-style: none" />
<%-- <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration: none">
<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"
style="border-style: none" />--%>
</a>
</object>