object object embedded in square bracket in combobox - flash-builder

Following is my code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.collections.ArrayCollection;
import mx.utils.ArrayUtil;
import mx.utils.ObjectUtil;
[Bindable]
private var zipdataProvdr:ArrayCollection = new ArrayCollection([{name: "test", file: "test"},{name: "elm34001", file: "elm34001"}, {name: "elm34003", file: "elm34003"}, {name: "elm34005", file: "elm34005"}, {name: "elm34009", file: "elm34009"},{name: "elm34011", file: "elm34011"}, {name: "elm34013", file: "elm34013"}]);
]]>
</mx:Script>
<mx:ComboBox
id="cbobxz"
dataProvider="{zipdataProvdr}"
x="10" y="49" width="189" height="23">
</mx:ComboBox>
<mx:Label x="247" y="48" text="ShapeFiles" width="78" height="24"/>
<mx:ComboBox x="350" y="50" id="cbobxs" dataProvider=""></mx:ComboBox>
</mx:Application>
On the browser I should see a dropdown box with all the files by their names, instead I can see a dropdown box with [object object].

You want to change your code to use label instead of name:
private var zipdataProvdr:ArrayCollection = new ArrayCollection([{label: "test", file: "test"},{label: "elm34001", etc.

Related

Create a widget in odoo 10 for pos

I trying to create a custom widget,
*.js
odoo.define('pos_widget',function (require) {
var PosBaseWidget = require('point_of_sale.BaseWidget');
aleert('Alert One');//It alerts
var NewWidget = PosBaseWidget.extend({
template: 'NewWidget',
init: function(parent,options){
alert('Alert Two inside init function'); // It not alerts
var self = this;
},
});
});
But getting an error on console:
Error: Service pos_widget already defined boot.js:119:27
No type for action Object { context: Object } action_manager.js:631:13
error: Some modules could not be started
Failed modules: Array [ "point_of_sale.chrome" ]
Non loaded modules: Array [ "point_of_sale.main" ]
Debug: Object { point_of_sale.main: Object, point_of_sale.chrome: Object }
Note
I have added these lines in chrome.js file (point_of_sale module) directly, and works. But not in custom module.
How can i resolve this?
It seems that the name you have used is conflict 'pos_widget'
Change it to with your something like modulename.pos_custom_widget
Check path of your js file given in your xml file. It should be like this way:
XML file :
<?xml version="1.0" encoding="utf-8"?>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/custom_module/static/src/js/js_file.js"></script>
</xpath>
</template>
After that for js file it should be like this:
JS file:
odoo.define('custom_module.file_name', function (require) {
"use strict";
var PosBaseWidget = require('point_of_sale.BaseWidget');
var TableWidget = PosBaseWidget.extend({
template: 'TableWidget',
init: function(parent, options){
this._super(parent, options);
alert("Custom Widget");
}
});
});
After this add your xml file in manifest like this:
Manifest file:
'data': [
'views/pos_restaurant_views.xml',
],
Also after this you have to create your qweb template in xml file. And add this qweb temlpate in manifest like this:
qweb template in manifest
'qweb': [
'static/src/xml/qweb_file.xml',
],
After this run your POS in front.

Alfresco custom aikau footer

I want to customize Alfresco aikau footer. For the beginning I would like to inject custom html-template in AlfShareFooter. So far I created an extension:
<extension>
<modules>
<module>
<id>MyCmpny widgets</id>
<version>1.0</version>
<auto-deploy>true</auto-deploy>
<configurations>
<config evaluator="string-compare" condition="WebFramework" replace="false">
<web-framework>
<dojo-pages>
<packages>
<package name="mycmpny" location="js/mycmpny"/>
</packages>
</dojo-pages>
</web-framework>
</config>
</configurations>
</module>
</modules>
</extension>
Html template for the footer and now I'm trying to override templateString of the AlfShareFooter object:
define(["dojo/_base/declare",
"alfresco/footer/AlfShareFooter'",
"dojo/text!./templates/ep-footer.html"],
function (declare, AlfShareFooter, template) {
return declare([AlfShareFooter], {
templateString: template
})
});
But it doesn't work. I am not familiar with Dojo and I think the problem is in the syntax...
I've found out how to override template:
define(["dojo/_base/declare",
"dojo/text!./templates/my-footer.html",
"alfresco/footer/AlfShareFooter"],
function (declare, template, AlfShareFooter) {
return declare([AlfShareFooter],{
postMixInProperties: function my_footer_AlfShareFooter__postMixInProperties(){
this.inherited(arguments);
this.templateString = template;
}
});
});
But with g̶r̶e̶a̶t̶ custom footer template comes g̶r̶e̶a̶t̶ custom css and i18n... So I wrote a post about changing Aikau footer in Alfresco.

JavaFX Using alternative FXML structure for Title (Stage is root)

I read answer about putting Title in FXML (JavaFx : Set window title in fxml file), but I don't understand how to call this code.
I can't call it in the classic way:
FXMLLoader loader = new FXMLLoader(getClass().getResource("some.fxml"));
Scene scene = new Scene(loader.load());
Stage stage = new Stage();
stage.initOwner(root.getScene().getWindow());
stage.initModality(Modality.WINDOW_MODAL);
stage.setScene(scene);
stage.show();
some.fxml
<?xml version="1.0" encoding="utf-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.Label?>
<Stage title="Some Stage">
<scene>
<Scene>
<VBox xmlns:fx="http://javafx.com/fxml">
<children>
<Label text="John Doe"/>
</children>
</VBox>
</Scene>
</scene>
</Stage>
Because the fxml is creating a stage, you don't need to create another stage in your Java code, just get a reference to the stage created by FXML and show it directly.
StageLoader.java
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.*;
import java.io.IOException;
public class StageLoader extends Application {
private void showDialog(Stage owner) {
try {
FXMLLoader loader = new FXMLLoader(
getClass().getResource("some.fxml")
);
Stage dialog = loader.load();
dialog.initOwner(owner);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.initStyle(StageStyle.UTILITY);
dialog.show();
} catch (IOException e) {
System.out.println("Unable to load dialog FXML");
e.printStackTrace();
}
}
#Override
public void start(final Stage stage) throws IOException {
Button openDialog = new Button("Open Dialog");
openDialog.setOnAction(event -> showDialog(stage));
stage.setTitle("Main Window");
stage.setScene(
new Scene(
new StackPane(openDialog),
200, 200
)
);
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
I made a couple of minor modifications to the fxml to ensure the resultant stage is large enough to actually see the dialog stage title.
some.fxml
<?xml version="1.0" encoding="utf-8"?>
<?import javafx.scene.layout.VBox?>
<?import javafx.stage.Stage?>
<?import javafx.scene.Scene?>
<?import javafx.scene.control.Label?>
<Stage title="Some Stage" resizable="false" xmlns:fx="http://javafx.com/fxml" >
<scene>
<Scene>
<VBox >
<children>
<Label text="John Doe" prefWidth="150"/>
</children>
</VBox>
</Scene>
</scene>
</Stage>
SceneBuilder who can't open FXML after adding Stage and Scene tags.
You could write the FXML with the stage and scene definitions as an outer shell with an embedded <fx:include..> statement to include an inner FXML document which could be opened edited directly in SceneBuilder. Also, you could create a feature request against SceneBuilder (it is called the "design tool" in the issue tracker), to request direct support for FXML files with stage roots and scenes included in the FXML.

read and writing file using mozilla xul

I've got a problem with reading and writing files in mozilla xul.
At first I want simply to read path to file(to check whether I/O works)
So I wrote this code
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="window" title="title">
<script>
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("Desk", ["temp.xml"]);
alert(file.path);
</script>
</window>
It should show alert window with path to temp.xml(this file exists on desktop). But it shows nothing in mozilla firefox.
what's the problem?
My Firefox shows two problems:
it chokes on alert() with error:
Error: Cannot call openModalWindow on a hidden window =
NS_ERROR_NOT_AVAILABLE Source file:
resource://gre/components/nsPrompter.js Line: 382
Your window has no style, so it's "invisible"
Here is a work around with displaying the path in a textbox instead and in browser console
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="window" title="title">
<textbox id="text" value="N/A"/>
<script type="application/javascript">
Components.utils.import("resource://gre/modules/FileUtils.jsm");
var file = FileUtils.getFile("Desk", ["temp.xml"]);
document.getElementById("text").value = file.path;
console.log(file.path);
//alert(file.path);
</script>
</window>

How to parse a local xml file mentioned below in sencha touch mobile

As i am new to Sencha touch mobile stuck in parsing a normal xml file and pass it to a store object and populate in a panel view. Can any one help me out how to parse a XML file kept locally in the project(as mentioned below data.xml) or as a string. Below is the XML and thanks in advance.
data.XML:-
<dataSrc>
<section>
<elem>
<id>1677</id>
<name>
<![CDATA[ United Kingdom]]>
</name>
</elem>
</section>
<section>
<elem>
<id>1678</id>
<name>
<![CDATA[ United Arab Emirates]]>
</name>
</elem>
</section>
.......
</dataSrc>
Have a model with the xml properties and a store with a xml proxy.
Ext.regModel('elem', {
fields: [
{name: 'id', type: 'string'},
{name: 'name', type: 'string'}
]
});
var myStore = new Ext.data.Store({
model: 'elem',
proxy: {
type: 'xml',
url : '/data.xml',
reader: {
type: 'xml',
root: 'dataSrc',
record: 'elem'
}
},
autoLoad: true
});
Then you have the contents of the xml parsed in the store. Read all about this at http://dev.sencha.com/deploy/touch/docs/?class=Ext.data.Store