How to use GWTQuery-UI - java

I am trying to unserstand how GWTQuery works, for that I am trying out a simple demo with the slider. As per the documentation at Google (the slider tab is on the bottom left), and using the class AbstractSliderDemo from here, which in turn, is implementing the Demo interface defined here, my onModuleLoad simply contains:
Label e = $("#slider").widget();
Query q = new Query();
q.setupDemoElement(e.getElement());
However on page-load, it is throwing a NullPointer exception. Can anybody guide me how to use it. Probably I am missing something here. (I have added both GWTQuery and GWTQuery-UI jar files to the build path, as well as including <inherits name='gwtquery.plugins.Ui' /> in the XML file).
And here is the directory structure of my project:

GwtQuery-Ui is just a wrapper on jquery-ui. That means that you need to inject the jquery and jquery-ui javascript file. Check the getting started guide og GwtQuery-ui

Related

Github Copilot + Angular - Single File approach

I'm trying to build a simple ToDo App with Angular using two approaches:
At first I tried to develop on each file (asking code with short comments in .html, .css, .ts) and receiving as output small code snippets. Everything works as expected until now.
Second approach is trying to put a single long detailed comment in a unique file where I explain all I need in terms of component and interactions as shown in the example below*. Is there a way to obtain this code in a single session.ts file with the path attached before each code snippet so that I can move the code into the related file?
*Insufficient Comment Example to provide a clearer idea of the expected output:
I need two Angular Components: Login and Todo.
The Login Component has a form with two input fields: Username and Password.
The Login Form is implemented using ReactiveForms.
The submit button directly redirects to TodoComponent.
The TodoComponent shows a table with the ToDo List.
The List is empty at first.
The table has the following columns: Id(number), Title(string), Completed(boolean) and Actions.
The TodoComponent has a button to Add a Todo.
Etc.
Thanks in advance!
I tried to put the comment in a session.ts file but it's not working as it previously did with Java, I expected to receive a path /todo.component.ts and the related code, /todo.component.html and the related code and so on with the rest of the generated project.

Override eclipse Plugin in Project explorer

In my project the user sees the red cross icon on the file containing an error and the folders above. When the (modelling nature of the sirius) plugin is added to the project the red cross dissapears on the file (not on the folders).
How can i keep the error icon on the file?
I can get information about the content extension which probably causes the problem
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); ProjectExplorer expl = (ProjectExplorer) page.findView(IPageLayout.ID_PROJECT_EXPLORER);
INavigatorContentService content = expl.getNavigatorContentService();
INavigatorContentExtension siriusext = content.getContentExtensionById("org.eclipse.sirius.ui.resource.content.session");
siriusext.getDescriptor().getAppearsBeforeId();
The problem is probably the sirius INavigatorContentService because it is set to appear before id "org.eclipse.jdt.java.ui.javaContent"
(siriusext.getDescriptor().getAppearsBeforeId())
How can i (have the modelling nature and) keep the error icon on the file?
Any help is appreciated!
I answered your question on the Sirius forum [1].
The problem seems to come from the getImage() implementation in the label provider used by the INavigatorExtension provided by Sirius.
A workaround could be to try to provide your own navigator content with an Override element targeting the Sirius Content Management (org.eclipse.sirius.ui.resource.content.session) as suppressed extension and provide your own label provider (which could extend the Sirius one and specifically handle the file case in getImage, but you might loose the M decorator on files handled by Sirius).
Could you open a bugzilla [2] to track the issue ? Then the team will have the possibility to analyze the issue and try to find a proper solution.
Regards,
Maxime
[1] https://www.eclipse.org/forums/index.php?t=msg&th=877968&goto=1498330&#msg_1498330
[2] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=sirius

Identify classes at run-time

I'm working in a project for Android using libGDX framework in which I show some examples of the use of three graphic libraries. Once started, the app must show a menu with a link for each sample, its title and a little description. For the time being, I'm creating all manually, declaring a new link for each sample, but as I will have a lot of samples and I'll add new ones in each app version, I would like to identify them and generate a new entry automatically.
The samples part is composed of an abstract class called Sample and a class for each sample that extends from Sample. How could I accomplish this? The requisites will be to have the possibility to identify all samples at run-time and get information about them (name, description, etc.) without the need of create an instance previously.
My actual options are use Annotations (don't know if it is possible or if I need an external library to search for this annotations at run-time) or use something like a JSON file. What do you think is the best way (I'm open to other solutions of course) to solve this problem?
I would recomend using XML and take the class you want to create as Tag so something like this:
<root>
<sampleimplement1 name ="sampleimplement1" descript="sample1 description" ..... more attributes here... />
<sampleimplement2 name ="sampleimplement2" descript="sample2 description" ..... more attributes here... />
<sampleimplement3 name ="sampleimplement3" descript="sample3 description" ..... more attributes here... />
</root>
This can now be parsed with the XmlReader of libgdx to a Element. So the element is not the root.
Last but not least you can iterate over the childs of the root and check what the name of the Tag is. Depending on the name you create a different implementation of your Sample.
XmlReader r = new XmlReader();
Element e = r.parse(xml);//<--- the XML as string also possible as file
for (int i = 0; i < e.getChildCount(); i++)
{
Element child = e.getChild(i);
switch(child.getName()){
case "sampleimplement1":
//create sample1
break;
....
....
}

Playing SCORM on Android devices

I've got few questions about Android and SCORM. In both areas I'm pretty new and I only spent one evening digging the web in search of some answers.
Topics I found were about synchronizing SCORM package with LMS but I do not need that. I'm just wondering how to PLAY (and just play, no need for any syncing or tracking) SCORM package on android device (Lenovo tablet with Android 4+ OS). If I try to make my own application which allows to browse local SCORM packages, will I be able to launch SCORM by using WebView component?
I found this tutorial:
http://support.scorm.com/entries/21826060-RSOfflinePlayer-Developer-Tutorial
which has section:
Playing Content and Syncing Results
where I found some interesting source code about configuring this WebView component in order to play SCORM content, but I'm not really sure if I need RSOfflinePlayer.jar for this.
I've also heard, that if device supports Flash, I will be able to launch SCORMs with Browser - is it true?
Maybe you know some application which can do that? Or library which could help?
Is there anyone with experience in:
1) Java SCORM API:
would paste URL, but I need more reputation
2) Celine
https://code.google.com/p/celine-scorm/
Any help will be appreacieted, not only by me but also by children with different kinds of diseases (we are just students trying to help them).
Javier is almost right. I will nonetheless try to explain this again. Maybe you will gather more information from this.
Every SCO is basically a zipped webpage. You have to unzip it and look for imsmanifest.xml, find the initial file in there (index.html, player.html, something like this). It will NOT be located under resources. You first have to look at Organizations > Organization > Item > Identifierref, which will give you an ID. Then you have to look at Resources > Resource with the above ID > href value. This is the file you're looking for.
Example (index.html is the file you need):
<organizations default="someorg">
<organization identifier="someorg">
<title>Some Title</title>
<item identifier="CourseItem01" identifierref="SCO_Resource_01" isvisible="true">
<title>SCO Title Here</title>
</item>
</organization>
</organizations>
...
...
<resources>
<resource identifier="SCO_Resource_01" type="webcontent" adlcp:scormtype="sco" href="index.html">
<file href="index.html"/>
<file href="SCORM_API_wrapper.js"/>
...
Once you found it, just open it in WebView and it'll try to connect to SCORM API in the parent window. You'll have to provide some dummy functions to fool it into thinking that it did connect to LMS and carry on as usual. Otherwise it will either fail or throw alerts at you.
I don't have any Android experience, but I have some experience working with SCORM.
To play a SCORM object, you need to open the right file inside the right environment, the right file is stated in the imsmanifest.xml file, that will be always in the top level of the zip package, you have to look for something like this:
<resources>
<resource identifier="546468" type="webcontent" href="index.htm" adlcp:scormtype="sco">
<file href="index.htm" />
</resource>
</resources>
This means that you have to open index.htm in the top level, in general you have to look for the first resource with adlcp:scormtype="sco" (if you need more details, read the SCORM spec).
When this page loads, it will look for the API object, it must be in the parent window, or parent frame, you will need a dummy SCORM API, something like:
function ScormAPIClass()
{
this.GetLastError = function (){return 0};
this.GetErrorString = function (param){return ""};
this.GetDiagnostic = function (param){return ""};
this.SetValue = function (element, value){
//you need something else here
return true};
this.GetValue = this.SetValue = function (element){
//you need something else here
return true};
this.Initialize = function (param){return true};;
this.Terminate = function (param){return true};
this.Commit = function (param){return true};;
this.version = "1.0";
}
window.API_1484_11 = new ScormAPIClass();
The SCORM objects will assume that you API works, so, if the set and get functions are not real this can generates errores depending on the object logic.
Also, I did not tested the code, is only to give you an idea of what you need.
I hope this help you.
First you have to understand structure of Scorm.
You can see Scorm package is a zip file containing several folders right and a manifest file.
First you have to unzip that zip package of Scorm and then you have to parse that imsmanifest.xml file and maintain two lists one containing titles and other addresses of html files corresponding to that title.
I have used sax2r2 parser to parse that manifest file and got that two array lists one containing title and other addresses of html files.
Later you just have to fill up you IOS list with titles array, and when user click on any title of that list get the position of list and retrieve the address of html files corresponding to that title from addresses array list.
finally you can open html file in webview of your IOS, make sure have enabled parameters required for open scorm html5 file.
In android I have enabled and set these values this is java code but it may help you.
WebViewClient webViewClient = new WebViewClient();
webView.setWebViewClient(webViewClient);
webView.clearCache(true);
webView.getSettings().setUseWideViewPort(true);
webView.setInitialScale(1);
webView.getSettings().setBuiltInZoomControls(true);
webView.clearHistory();
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.loadUrl("file://" + open_scorm.scorm_path
+ open_scorm.scorm_name + "/" + open_scorm.href.get(0));
webView is used to open html/html5 files in android and i have enabled above settings in android, these settings are by default in android, may be in ios you just have to load that html file and dnt have to enable all these values.
In above you can see I am retrieving href.get(0) which is first html5 file of scorm.
In simple words you just have to unzip scorm , parse imsmanifest.xml file and get data of it and use it to open/parse scorm.

How to add navigation to a custom Magnolia CMS template?

I've managed to create a custom page template for Magnolia CMS pretty easily following this tutorial:
http://documentation.magnolia-cms.com/templates/introduction.html
However, I'm at the point where I'd like to insert the navigation into my template but I can't find a simple way to do so. It looks like other's have had this problem with no clear way to fix it. Does anyone know how to easily include the navigation? Thanks
If you're using Magnolia CE (Community Edition) 4.5.x, you need to know that basically every page template extends the one defined in /modules/standard-templating-kit/config/site/templates/prototype. There you have a node, /navigation. You can copy that node to your new custom template, and after that you can start playing with it's properties.
But before that, don't forget to include the navigation menu(s) somewhere in your main template file (.ftl) and make your template to use stk model class info.magnolia.module.templatingkit.templates.pages.STKPageModel (add an attribute to your template named modelClass, look at stkArticle (or stkSection), it's a good place to start)
Horizontal navigation:
[#if def.navigation.top]
[#include def.navigation.horizontal.template]
[/#if]
Vertical nav:
[#if def.navigation.top]
[#include def.navigation.vertical.template]
[/#if]
If you want to include your menu in another template included with a [#cms.area ...] tag,
you can use this code:
[#if model.root.def.navigation.top]
[#include model.root.def.navigation.vertical.template]
[/#if]

Categories