Can I add Dart Web UI bindings to DOM elements created in code? - dart

In the Dart Web UI package, it is possible to create bindings using the {{}} or bind-value syntax. Is this also possible, when DOM elements are created in code?
Something like
new Element.html('<div>Value: {{str}}</div>');
and
new Element.html('<input type="text" bind-value="str">');
binding an event to str, without manually piecing the strings together?
Note: this question was asked earlier today, but was deleted before it was answered, but I wanted to know the answer, so I'm reposting it.

Quick answer, no.
The bindings need to be processed by the dwc transformer, which converts Web Components and MDV code into "vanilla" Dart and HTML (suitable for compilation to "vanilla" JavaScript).
Generally, you should use <template> tags to instantiate new elements.
An alternative is to wrap these bits of text inside a custom element, which you can transform with dwc and instantiate manually.

Related

Graph libraries with dart and polymer

I was wondering if anyone is familiar with putting polymer dart and graphs together. I'm looking into using Google graph APIs, however I wanted to put some feelers out there if anyone was handling them different.
I think SVG + Polymer makes for a great foundation for charting libraries!
I experimented with SVG and data-binding a while back and was very happy with the results. My repository of experiments is here: https://github.com/justinfagnani/svg-binding
Custom elements would be a really nice way to allow for chart configuration. You could offer a default bar chart with a tag like <chrt-bar-chart data="{{ myData }}">, but allow incremental customization by supplying more attributes or child elements:
<chrt-chart>
<chrt-x-axis start="10" end="100"></chrt-x-axis>
<chrt-grid spacing="100"></chrt-grid>
<chrt-bars>
<chrt-series name="Series One" data="{{ myData }}"></chrt-series>
<chrt-series name="Series Two" data="{{ myOtherData }}"></chrt-series>
</chrt-bars>
</chrt-chart>
For a rough example.
Of course, you probably don't want to write your own configurable charting library, so if you check the bar chart example in my repo you can see how much work it is to roll you own chart from scratch. Being able to write SVG with data-bindings made it simple enough that you might consider doing it without a library.

ZF2 BBCode Parser

Hiho,
I use the ckeditor on my website for special textareas like forum
or signatures.
But I have a problem with the output. I use ZF2 and would like to
use ZendMarkup to render the output bbcode back in html.
But at every time I call
$bbcode->render(...)
I got the error
There is no Zend_Markup_Root markup.
The ZendMarkup is an extension inspired by the Zend_Markup from ZF1.
But I can't find any thing on API or other guides.
Does someone has any idea what as the problem is?
The ZendMarkup library is very old (last update is 10 months ago!) so I wouldn't use such library. If you would like, I think I traced the error down.
On this line there is a reference to Zend_Markup_Root while that should be ZendMarkup\Renderer\Markup\Html\Root. Try to change that line and see what happens.
Another way is to replace the ZendMarkup library with another library which does work and is updated regularly. An example is Decoda. If you load mjohnson/decoda in your composer.json, you can use Decoda in your Zend Framework 2 application:
<?php
use Decoda\Decoda;
$parser = new Decoda($bbcode);
$html = $parser->parse();
With tools like composer, there is no need to use solely Zend* components when there are better alternatives.

GXT 3.x Custom PropertyEditor / ValueBaseInputCell

I'm trying to write a custom field editor that will translate between Long and String. IE: String representation on screen but field type is a Long.
I've implemented the PropertyEditor (HrMinPropertyEditor) but don't know how to wire it in. My HrMinField is quite clunky as I needed to use a TriggerFieldCell because the generic types inside TextInputCell etc. prevented me from using them.
Do I need to do a subclass of ValueBaseInputCell? That seems strange since my PropertyEditor has all the Long / String conversions. It also looks difficult.
If so, is there a simple example or some documentation I can read?
BTW, my learning project is Maven based and should be easy to fire up if necessary:
svn checkout http://subversion.assembla.com/svn/freshcode_public/learn/gwt/ learn-gwt
cd learn-gwt
mvn gwt:run
Navigate to GXT | Forms | Time Edit
Thanks in advance,
Pete
PS: I've asked this on the Sencha forum too.
You should use method setPropertyEditor from Field class to specify your custom property editor:
HrMinField f = new HrMinField();
f.setPropertyEditor( new HrMinPropertyEditor() );
I managed to come up with a solution using a Converter and a Validator.
The more complete answer is on the Sencha thread.

Can I use url parameters in LESS css?

Intro:
I'm trying out LESS in an asp.net mvc environment.
I use dotless for server side processing (and I wouldn't want to use client side processing especially afer publishing the complete project).
I have to apply a design where there are different color schemes depending on different things (e.g. time of the day).
Less felt very powerful in this case as designing a parameterized css and only changing like 10 variables at the beginning of the file for every theme was really uplifting.
Problem:
But I would need to somehow change the color themes from an outside parameter.
Ideas:
First I thought that an URL parameter like style.less?theme=fuschia would be good, but I found no way to parse something like this.
Then I thought that making a very short blue.less, green.less, orange.less consisting only declared color variables, and including the main.less in every one of them would be a solid solution.
I had no chance to try out the second solution, but I thought this would be a good time to ask for advice on the most robust way of doing this.
The problem again is: I want to control some things in my less file from the outside.
Yes you can (because I implemented that feature for exactly that reason).
Dotless supports parameters from the outside via the querystring parameter.
<link rel="stylesheet" href="style.less?foo=bar" />
Will let you use the following less:
#foo = bar;
The parameter injection code is very simple. it just prepends the variable declarations to your normal less file, so anything that comes as a querystring parameter will follow the above syntax.
The code in question is very simple: https://github.com/dotless/dotless/blob/master/src/dotless.Core/Engine/ParameterDecorator.cs
AFAIK, you cannot pass parameters for dotnetless to use to do the compile.
As a suggestion, why not just call different less files? This would be fairly easy to do by using a Viewbag property.
To make the different less ones, You first create a less file with each set of colors in them. Then you import your base css file. dotnetless will merge the color definations in the parent file with the usages in the base file. So you have something like -
#baseGray: #ddd;
#baseGrayDark: darken(#baseGray, 15%);
#baseGrayLight: lighten(#baseGray, 10%);
#import "baseCss.less";
I just tested this on and MVC3 project and it works.

How I can add some items to the code completion combobox of the Delphi IDE

I'm working in a Delphi IDE expert and I wonder if it's possible add new items to the code completion combobox displayed by the Delphi IDE when the user press CtrlSpace
UPDATE:
What I need is add items to the code completion list based in a specified type.
example suppose which I have a type called TMytype, what I want to do is add addional items to the code completion list when the user type a variable of the type TMytype
check this image
I found your question somewhat confusing but if you are in search of credible source on "Custom Live Templates" and the like on Delphi, head to the blog of Cary Jensen here.
Edit:
Looking forward to further improvement of the scope of the question, I suggest here another direction to explore:
Source code manipulation using IOTAEditor, IOTASourceEditor, IOTAEditReader and the like
Some Parsing for sanity check prior to apply any modification.
Adoption of Client DataSet as a format to store data (It's serializable) to simplify the coding of IDE editors.
Perhaps I haven't fully grasped the extent of what you are asking here, but you can add templates simply by going to 'View|Templates' from the Delphi IDE. This then opens a template viewer. Press the '+' icon. It opens a template1.xml document which you can then edit so create your new item.
If you wish to do this programatically, just add an xml file (of the same format) to the ..\RAD Studio\code_templates folder.

Resources