Polymer Dart - Multiple View - dart

I'm trying to create a sample CRUD application using Dart and Polymers.
One think I noticed is almost all dart polymer examples have only one page. I'm trying to look for samples with multiple pages.
i.e.
Screen contains table of Person objects
Then when an Add button is clicked, it goes to the add view of the Person object
On the add page, there is a link to add some other child object.
This is very doable using only one screen, but am looking for a best practice in implementing multiple screens. In GWT it uses the Activities and Places. What is the dart counter part?
I saw on some other post using routes, but seems does not work on my Dart Editor. And I am not sure if this is still current as that posted almost a year now.
Route Example
ShadowRoot.resetStyleInheritance and ShadowRoot.applyAuthorStyles now deprecated in dart:html.
Please remove them from your code.
Uncaught Error: Illegal argument(s): No handler found for /routes_example.html#one
Stack Trace:

I just published a package for routing with Polymer (see https://github.com/bwu-dart/bwu_polymer_routing)
There are two links to simple demos available online.
I have a SDK dependency on 1.6.0 (dev-channel release) because I haven't tested it with Dart 1.5.x. I might remove this restriction with the next release.
Some highlights:
Hierarchical views are automatically created and inserted depending on the current route.
Route parameter values are automatically passed to the view attributes on route or parameter value change.
Parameter values are updated in the view without creating the view again.
The same code runs no matter if usePushState is enabled or disabled.
Mixin with event handlers for simple go-to-route links or buttons.
Mixin for adding DI support to your Polymer elements.
see also https://stackoverflow.com/a/25228357/217408

Related

Angular2 routing views not rendering properly with polymer (on mobile) using back and forward buttons

I am building a basic Angular2 + Polymer seed application (as well as rebuilding personal site), when testing it out on mobile I ran into a few problems. I am using the Router supplied by angular2/router and have inserted a <script src="webcomponents.js_here"></script> to include webcomponents.js after angular 2.0.0-beta.7 (as I write) has been pulled in.
Simplest example I could boil it down to is reproducing the error in the Angular2 Hero tutorial. If you check this plnkr out on a mobile browser you will see that when you navigate from one view, to another and you try to go back to the previous view relying on window.history.back() as the ng2 tutorial does, you will be able to go back to the previous views but at the following costs:
The view is not loaded properly
constructor() gets called but ngInit() never gets called
If you move the service-fetching logic from ngInit() to the constructor (as I did in the plunk) to test to see if the service data is still being fetched properly, the view is still not rendered properly (makes me think there is some polyfill conflict issue stopping the structural directives (*ngFor in this case) from working and manipulating the DOM properly. To get the view to load properly and the structural directives to work again with the service fetched data, you have to navigate to that view in any other way but using the window.history. This makes natural Back/Forward button routing an issue in Angular2 apps that use Polymer. It seems that as of posting this it only happens on mobile browsers.
I am testing on an iPhone 6 plus iOS 9 (9.2) and Chrome version 48.0.2564.104
Could this be some sort of view caching or polyfill problem?

Dart polymer custom element dynamically linking

I'm working with polymer elements in dart. I'm doing a single page web app. I'm wondering if there's a way to dynamically link the element I need for this page instead of linking (loading the source) all in the front. I know there is a deferred class that you can declare but I'm not sure it works with HTML template too. Any wayto dynamically link the element once you need it?
Thanks,
Yi
DeferredLibrary should work for this (might still have some bugs or limitations)
Using code in Dart that wasn't imported at compile time is currently not supported.

How to map shared Content Blocks to Templated in Sitefinity 5.2?

I just Migrated my 3.7 website to 5.2 Website, but I noticed that the Generic Content in 3.7 Project have been converted to Shared Content blocks in 5.2. And most importantly not all (only few are likned to pages, i.e., Used in pages column has "Not used" value).
I searched a lot but couldn't find any way to map these blocks to the pages as they were in 3.7 Project.
However, I was trying to follow tutorial:
http://www.sitefinity.com/documentation/documentationarticles/user-guide/widgets/content-widgets-group/configuring-the-content-block-widget
But I didn't see any option such as "Select from existing shared content button" in Edit Template mode, I get this option in Edit page mode & when I set the Content by selecting the existing Content it's not displayed in View mode, but it's displayed in edit mode.
Any ideas how to do this?
Thanks
With the introduction of Sitefinity v4, shared content is no longer available for templates, just for pages. They removed that ability unfortunately due to architectual reasons and performance issues.
The official comment on how to solve it at the moment, is by using inherited templates, where you drop a normal content block on a 'parent' template and thus its child templates inherit it while keeping a single point of edit.
As a non-recommendation 'hack', you can activate it, as described here. But keep in mind the response from Telerik:
it will lead to performance problems. This is why this feature is
disabled by default, and we do not recommend using it.
But there is also good news when you read the Sitefinity 5.3 roadmap which is scheduled for release end december 2012:
The 5.3 release includes the below improvements:
Shared content is now available to use inside page templates
Hope this helps,
Jochem.

Does Vaadin download all gui widgets to the client?

When I have a Vaadin application does it download all the gui widgets to the client or does it download them on demand. I ask because I have some clients that only use some widgets but not others.
The default loading method is eager (EagerWidgetMapGenerator). You have a few choices for loading the widgets. Here are some of them:
Lazy
You can choose to use the LazyWidgetMapGenerator by adding this to your widgetset (.gwt.xml):
<generate-with class="com.vaadin.terminal.gwt.widgetsetutils.LazyWidgetMapGenerator">
<when-type-is class="com.vaadin.terminal.gwt.client.WidgetMap" />
</generate-with>
This will load the widgets only when requested.
Widget-defined
Same as above, but replace LazyWidgetMapGenerator with WidgetMapGenerator. This will use the widgets' loading preference and I believe most of them are DEFERRED.
Custom #1
Create a custom widget map generator by subclassing CustomWidgetMapGenerator and defining it in your widgetset (same as above but replace LazyWidgetMapGenerator with your class).
Custom #2
Create a custom widget map generator by subclassing WidgetMapGenerator (mostly deferred, defined by widgets) or EagerWidgetMapGenerator (every widget loaded EAGERly), setting only some of the widgets LAZY (or DEFERRED, or EAGER) and defining it in your widgetset.
For more info, check the API doc and this out:
http://dev.vaadin.com/wiki/WidgetSet
You can choose which widgets are loaded on start and which on demand. Default is to load them all on start.
Vaadin 14
This page in the manual seems to say that, if marked as invisible, your component is represented only on the server-side (in Java) and is not included on the client-side, does not appear in the DOM in the web browser. That is true if the component has not yet been rendered.
Once made visible the component is created in the DOM on the client. If turned invisible, the component remains in the DOM.
In all cases, while invisible, traffic ceases for events regarding that component. So while invisible, network usage is efficient.

Using Silverlight.FX Window for MVVM as a Silverlight 3.0 Page?

I'm creating a Silverlight 3.0 MVVM application using Silverlight.FX but my View is actually using the Silverlight navigation system, a Page. Following Nikhil's example, my View should derive from the Silverlight.FX Window class.
What's the best approach to making a Window that also supports the Page functionality or is there something that already does this?
Discovered the Page and PageFrame classes of Silverlight.FX. These classes have the same basic functionality as the Silverlight navigation types but with support for the binding I was looking for.
xmlns:fxnav="clr-namespace:SilverlightFX.UserInterface.Navigation;assembly=SilverlightFX"
...
<fxnav:PageFrame x:Name="_frame"
IsIntegratedWithBrowser="True"
DefaultUri="StartView"
HorizontalContentAlignment="Stretch"/>
I'm having trouble grabbing the parent container from the Pages' code-behind (unlike the Silverlight 3.0 Page) but I shouldn't need it once I remove the Click handler and fully switch to MVVM anyway.
It is worth to mention that PageFrame's default PageLoader component automatically mapping all pages available. There is no way to use new UriMapping component from Silverlight 3 with SilverlightFX's PageFrame. So, if your page is named as MySilverlightPage.xaml (and corresponding page class has the same name), it will be available at "mysilverlight" address.
P.S. I decided to mention it, because it was not clear for me when I tried to use SilverlightFX first time.

Resources