There's no documentation for it https://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-Attributewicket%253Ascope. Does it work only for components?
What does wicket:scope attribute do?
The HtmlHeaderContainer class documents the wicket:scope attribute:
wicket:head tags (components) must only be added once. To allow for a little bit more control, each wicket:head has an associated scope which by default is equal to the java class name directly associated with the markup which contains the wicket:head. It can be modified by means of the scope attribute.
It is further documented in the HeaderPartContainer class simply stating that it is "A kind of namespace."
Does it work only for components?
The wicket:scope attribute is used only for the tag. The tag should only be used in "Panels, Borders and inherited markup (of Panels, Borders and Pages)", as documented in the HtmlHeaderContainer class level javadoc.
In short, the answer to your question is no, the attribute can be used within tags inside of Pages that inherit markup from a parent. The implication here is that a tag only makes sense where you wouldn't just use a tag (meaning in the base page html file).
Related
So I create a radio group using this PdfFormField.createRadioButton() then calling the setFieldName().
However, the PdfAnnotation does not show any keys that stores the field name. I looked at the other dictionaries inside the PdfAnnotation but could not find any.
reader.getAcroFields().getFields().keySet() does list the field names of the form fields but I wish to ask if there is any way via PdfAnnotation?
I tried to put a custom PdfName inside the radio group object but it does not show up in the PdfAnnotation's dictionary.
You are confusing the concept of an annotation (link annotation, file attachment annotation, widget annotation,...) and a form field (text field, choice field, button field, signature field).
In iText 5, annotations are dealt with in a class named PdfAnnotation; form fields are dealt with in a class named PdfFormField. You are trying to do something that is specific for a PdfFormField using the class PdfAnnotation. That's wrong.
I understand the root of the confusion: every visible form field corresponds with at least one widget annotation. Most of the visible form fields correspond with exactly one widget annotation. That's why we made a design choice in iText 5 to have PdfFormField extends PdfAnnotation.
This design choice is in line with the PDF specification where it says that field dictionaries of fields that correspond with a single widget annotation may be merged into a single PDF dictionary.
In practice, you will find PDF dictionaries in a PDF that combine entries typical for a widget annotation dictionary and a field dictionary. (That also explains why there's a getMerged() method in iText: that method gets you the merged dictionary objects.)
I hope this already explains part of your problem. You seem to have another problem too, but I don't understand what you want to do. Please clarify using references to ISO-32000-1 so that people can understand which technical feature you are trying to implement.
I am trying to create an auto-generated GUID property on all cq:PageContent nodes. This will be similar to the jcr:uuid property, but will be persisted with content promotion/replication/package installs (whereas the jcr:uuid for a content item changes between different environments).
I am trying to determine how AEM/JCR generates the jcr:uuid property on node creation. The CND defining the property is:
[mix:referenceable]
mixin
- jcr:uuid (string) mandatory autocreated protected initialize
I've tried defining my GUID property in a similar manor, specifying the autocreated and initialize attributes, but this did not result in auto-generation of the property.
Could anybody point me to the source of the jcr:uuid's generation?
As an aside, I asked a related question on the Adobe Community Forum: http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.5_ciot.html/forum__bnxr-i_am_tryingtocreat.html
You don't mention which version of AEM (so whether you're dealing with Jackrabbit or Oak), but the mechanism turns out to be basically the same.
When assigning a default value, there are a few hard-coded system property names that get special treatment (jcr:uuid being one of them). If the name of the property being assigned a default value doesn't match any of the special cases, it falls back the static list of default values from the property definition (e.g. listed in the CND file).
In summary, it looks like you cannot piggy-back on this mechanism to assign your own dynamic default value for an arbitrary property. You would need to implement your own event listener or something.
Jackrabbit: See the implementation of setDefaultValues and computeSystemGeneratedPropertyValues
Oak: See the implementation of TreeUtil autoCreateProperty
I have a custom widget (OrderItem) in a GWT project. This widget has a TextBox. I set it's id to "Navid". But what if I create multiple instances of OrderItem in a panel? The id would be repeated then. This'd make the html invalid.
How do I assign a unique id to the TextBox?
Well, normally, GWT widgets generate their own IDs that will automatically be unique and you would not typically worry about what the ID is. When you say that you are setting the ID of a TextBox, I'm assuming that you're calling something like myTextBox.getElement().setId("Navid").
There are two simple methods I can think of, depending on your use-case. The HTMLPanel class has a static createUniqueId() method on it that you can use either on its own, or to easily create a unique id. Like myTextBox.getElemement().setId("Navid-" + HTMLPanel.createUniqueId()). The only problem with this is that the ID that is generated is not deterministic.
The other common method would be to generate an ID based on the ID of the parent widget. myTextBox.getElement().setId("Navid-" + myTextBox.getParent().getElement().getId()).
However, I'm going to take a guess here and assume that the reason why you're wanting to assign your own custom ID to this widget is so that you can address it from outside of your GWT code, from Javascript, for example, from JQuery. In this case, I would recommend that instead of assigning an ID to it, which has to be unique to be useful, that you instead assign an html class name to the widget's element. You would then address the widget's element relative to the id, or class of your OrderItem's id or class. You can add an html class name to an element as in the example myTextBox.getElement().addStyleName("navid")
So, assuming that you assign an html class of orderItemWidget to the root HTML element of your OrderItem widget, and an html class of navid to the TextBox, you could refer to the textbox from a JQuery with the selector ".orderItemWidget .navid"
This is why GWT makes it doesn't make it that easy to set an ID on a widget. For styling, it makes it much easier to use CSS class names. Actually, there are very few reasons to use an ID to begin with, and almost none for dynamically generated things (like widgets).
Now, to answer your question, browsers tolerate the case of several elements sharing the same ID, and getElementById is defined to return the first of those elements (in document order)
Are there any recommended structural design patterns for MVVM view models that allow different state and functionality to be added to a base object dynamically, but still maintaining the INotifyPropertyChanged on all the related properties? Something like a decorator pattern but mvvm-ready?
Yes. The WPF binding system will use a custom type descriptor to interact with the properties of your ViewModel at runtime. I've used this before to make keys in a KeyValueCollection<T> appear as properties on the collection.
This has two important benefits. It simplifies binding:
DataContext.SomeCollectionProperty[SomeKey] can be simplified to DataContext.SomeCollectionProperty.SomeKey and, if you make a custom type descriptor for the data context, DataContext.SomeKey which is about as simple as it gets.
And it fixes what I consider a bug--format strings are rendered even when the property is null. Using a CTD, you can skip null (and DBNull) properties, ensuring that format strings won't be rendered if the property doesn't exist:
Imagine you have a double? that you must render as a dollar amount. If you use the following binding: {Binding Price, FormatString='Price: {0:c}'} and the Price is null, you get the following in your UI: Price: $. This is ugly. However, if Price is a PropertyDescriptor-based property on your UI, when the Price is null, you can opt to not to report this property via your CTD. This prevents the format string from being rendered at all.
Here's a pretty good link at MSDN about decorating your types with a CTD.
From my experimentation, you can use the ExpandoObject in .NET 4 to handle what you want. ExpandoObject implements INPC. I've been creating a DynamicViewModel based on the ExpandoObject that does a few other things like calculated Properties that have dependencies on each other and Delegate Command registration.
public interface ReviewPanelStyle extends CssResource {...}
#Source("BlueReviewPanelStyle.css")
ReviewPanelStyle BlueReviewPanelStyle();
#Source("YellowReviewPanelStyle.css")
ReviewPanelStyle YellowReviewPanelStyle();
We would think that this should work, however it does not.
The color of elements styled (regardless of weather associated with the Yellow or Blue css) will be styled based on the order of these two lines.
Resources.INSTANCE.YellowReviewPanelStyle().ensureInjected();
Resources.INSTANCE.BlueReviewPanelStyle().ensureInjected();
As a work around I duplicated ReviewPanelStyle (ReviewPanelStyle2), but I rather not...any ideas?
Scoping of obfuscated class names is
defined by the return type of the
CssResource accessor method
Defining two separate interfaces for each style should do the trick. More information at http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#Scope