ZK + component jar static resources - zk

I am using the ZK framework and have created a maven project of custom components.
I am trying to include static CSS for the project (for components with no javascript) as per the brief outline on this page:
http://books.zkoss.org/wiki/ZK_Component_Development_Essentials/Packing_as_a_Jar
How does zk know to include the CSS generated when the project is included in a ZK WEB project ? Currently my resources directory of my component project looks like this:
web
foo
bar
css
zk.wcs
macro.css.dsp
other.css.dsp
less
macro.less
other.less
My zk.wcs :
<css language="xul/html">
<stylesheet href="~./foo/bar/css/macro.css.dsp"/>
<stylesheet href="~./foo/bar/css/primitive.css.dsp"/>
</css>
My styles in macro.css.dsp are not applied when using the component project in my web zk project however...

You can include css in lang-addon.xml:
<!-- define a component -->
<component>
<!-- the tag name of this component
required,
must be unique -->
<component-name>codemirror</component-name>
<!-- fully-qualified java class name at server side
required for a new component that not extends another component -->
<component-class>org.sinnlabs.zk.ui.CodeMirror</component-class>
<!-- widget class, 'org.sinnlabs.zk.ui.CodeMirror' also specify the
package of widget class 'org.sinnlabs.zk.ui'
required for a new component that not extends another component -->
<widget-class>org.sinnlabs.zk.ui.CodeMirrorWidget</widget-class>
<!-- mold
required for a new component that not extends another component
or has self widget-class
a mold denotes the files that to render and style this comopnent -->
<mold>
<!-- default mold is required -->
<mold-name>default</mold-name>
<!-- relative path based on widget-class' path
(web/js/org/sinnlabs/zk/ui/)
where codemirrorwidget.js (required) contains a function that
will render the html of the comopnent. -->
<mold-uri>mold/codemirrorwidget.js</mold-uri>
<css-uri>css/codemirror.css</css-uri>
</mold>
</component>
zk.load will load your css style.

Related

How to emit the server path to the current file using Sightly?

I have some components that I've broken into multiple smaller files. The main file includes them using data-sly-include attributes.
I'd like to generate HTML comments containing the current filename in both the main file and the included files, so that when I view the rendered output I can easily tell which file generated the output. Something like:
... some HTML from the template or other components...
<!-- begin /path/to/main/file.html -->
<div>
This is from the main file
<!-- begin /path/to/main/includes/first.html -->
<p>This is fromt the first include</p>
<!-- end /path/to/main/includes/first.html -->
<!-- begin /path/to/main/includes/second.html -->
<p>This is fromt the second include</p>
<!-- end /path/to/main/includes/second.html -->
now we're back in the main file
<!-- end /path/to/main/file.html -->
I can see how to get the path to the current page, but that's the resource that contains my component; I want the paths to the files that make up the components. Any way to do this in Sightly?
the sightly script engine has the current file as a binding variable with sling, so the following should work-
sling.getScript().getScriptResource().getPath()
you will have to put this in a js file and call it from all your sightly scripts.

Missing file name suggestions using views module

I have been working on a Drupal 8 theme using views module. For some reason, the module fails to display the list of file name suggestions.
At first I believed that the problem was sole in displaying the suggestions. However, after creating a new template file, following the pattern (views-view-unformatted--news-article-listings.html.twig), and rebuilding the cache, the file is ignored.
The picture bellow is the output of the twig file with debugging turned on.
Any ideas?
I know this is an old issue, but readers may be interested in this issue
https://www.drupal.org/project/drupal/issues/2923634#comment-12417950
Core Views does not currently supply theme suggestions in Drupal 8
The fix is being worked on, but the patch in #8 worked for me (v 8.5.5), and I can now see views theme suggestions 
I think that theme suggestions from views module are buggy. Now Im doing project, where there is none of them:
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'block' -->
<!-- FILE NAME SUGGESTIONS:
* block--mdb-content.html.twig
* block--system-main-block.html.twig
* block--system.html.twig
x block.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/mdb/templates/block/block.html.twig' -->
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'container' -->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/form/container.html.twig' -->
<div class="views-element-container">
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view' -->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/views/views-view.html.twig' -->
<div class="wrapper js-view-dom-id-8f70d5c8af23f92729c2180de609f1a2df672d7711b56b0a606853692ee787cd">
You can see, that file name suggestions works well on top, but under views_view hook i dont see any. But we can remember how they should look from Drupal 8 documentation:
View, named foobar. Style: unformatted. Row style: Fields. Display: Page.
views-view--foobar--page.html.twig
views-view--page.html.twig
views-view--foobar.html.twig
views-view.html.twig
views-view-unformatted--foobar--page.html.twig
views-view-unformatted--page.html.twig
views-view-unformatted--foobar.html.twig
views-view-unformatted.html.twig
views-view-fields--foobar--page.html.twig
views-view-fields--page.html.twig
views-view-fields--foobar.html.twig
views-view-fields.html.twig
https://api.drupal.org/api/drupal/core%21modules%21views%21views.theme.inc/group/views_templates/8.2.x

CQ5 column control generated html

We are working on a project where we need a decent level of control in CSS to implement the design but have been told by the dev team that the generated html is:
<div class="parsys_column cq-colctrl-lt1"> <!-- "cq-colctrl-lt1" defines width of child divs (33%) -->
<div class="parsys_column cq-colctrl-lt1-c0"><!--another components go here --></div>
<div class="parsys_column cq-colctrl-lt1-c1"><!--another components go here --></div>
<div class="parsys_column cq-colctrl-lt1-c2"><!--another components go here --></div>
</div>
<div style="clear:both"></div>
Looking into column controls I see you can change the cq-colctrl- class but I can't find answers to the following:
1, Can the clear both div (generated by CQ) be removed or only shown in author mode?
2, Can the column control be added within a component?
3, Can the column class be set per component or is it a global setting?
4, Can you control the styles of the column classes and override the generated CQ5 CSS (eg for a responsive site?)?
If you want embed column component in your component:
go crxdelite in the /apps/geometrixx-outdoors/components/colctrl
just create package via site admin and specify the above path and download package then you can see, how column component is created.
http://jenikya.com/blog/2013/01/editing-column-widths-in-cq5.html
but it's better look at that path is more clear.

gwt Button Error

Unable to remove this error, nothing is working although the same code is working fine on other systems.
"com.pariter.client.Button can not be found in source packages. Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly."
Adding Button Class from Comment.
package com.pariter.client;
class Button extends com.google.gwt.user.client.ui.Button {
public Button(String s) {
super(s);
this.setPixelSize(100, 25);
this.addStyleName("button");
}
}
Adding Entry Point and Source Path Sections for .gwt.xml from comment
...
<!-- Specify the app entry point class. -->
<entry-point class='com.pariter.client.LoginPage'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
</module>
If I recall correctly, this error would occur if the com.pariter.client.Button is not in a package (or subpackage) defined in your .gwt.xml.
Check your .gwt.xml. i.e.
...
<entry-point class='com.pariter.AppEntryPoint'/>
<source path="client"/>
...
</module>
[Update]
You will either need to move your com.pariter.client.LoginPage Entry Point to com.pariter.LoginPage (and therefore update your .gwt.xml) or move your Button class to the package com.pariter.client.client

How do I update an Eclipse template variable on the fly?

I've added the following new Eclipse template via extension point. It simply adds a template for a sample testTag tag.
<!-- Add code template -->
<extension point="org.eclipse.ui.editors.templates">
<template autoinsert="true"
contextTypeId="html_tag"
description="[Description] Template populated by Snippet values ***"
id="org.eclipse.jst.jsf.ui.newHtmltag"
name="testTag">
<pattern>
<![CDATA[
<testTag style="background: ${color}"></testTag>
]]>
</pattern>
</template>
<resolver
contextTypeId="html_tag"
type="src"
class="TestTagTemplateVariableResolver">
</resolver>
</extension>
What I'd cannot figure out is how to change the value of the $(color) variable at runtime. More specifically, when the user presses Ctrl + Space (or the equivalent for content-assist) and types in "testTag" and presses Enter -- instead of the "color" placeholder text, I'd like it replaced by some other text value I have in another class. How do I do this?
This email chain from 2004 says it might not be possible:
the Java editor chooses not to respect resolvers contributed to its two context types ('java' and 'javadoc'), but only recognizes the built-in resolvers.
The html editor you are working with may have a similar restriction.