Custom Page Type Property with Inheritance - kentico

I'm looking for advice on how I might implement a custom property on a page type that supports inheritance.
The sort of functionality I'm looking for would be similar to how the "Use output cache" radio buttons work on the Properties > General page in portal mode.
So I want to be able to create a property on a page type, see radio buttons like this, and then based on whether I choose yes, no, or inherit it will go back up the content tree to find the value to apply to that property (if inherit is selected of course).
I hope that makes sense.
Thanks
Jay

Not sure if I understand. So you want have a dynamic property for your page based on parent's value at the moment of creation. You can access parent object like so:
{%EditedObject.Parent.FieldName%}
You may try to create field with radio button control to choose a value.
0; No
1; Yes
{%EditedObject.Parent.FieldName%}; Inherit
Hope this gives you some ideas

Related

Xpages - Custom control getting a custom property from another custom control

I've searched google and stack but can't seem to find a definitive answer. What I would like to do, is something like this:
Say I have custom control A, within which, is a radio button, when I click it, I want it to grab a custom property that is set on custom control B, lets say compositeData.Name as an example. Can I do this?
If I give custom control B an ID, lets say ccB, can the radio button in custom control A do something like, getComponent("ccB").getValue().compositeData.Name so I can get the value of the property I passed into custom control B using the custom property 'Name'?
If its a straight no, at least I know to stop playing around with the idea! Thanks
Reaching from one control into the inside of another control would break component isolation. You might want to take a different approach:
Option a - client side:
Your control emits a JavaScript event that bubbles up until it reaches a parent element that contains the control you want to change (presumably the parent Dom element). There you set the property of that element.
Option b - server side:
As Urs suggested: bind both to a bean and handle the updates inside the bean

Is there a way to access the label text in a UIView?

When I add a view in Interface Builder, I often go into the Identity Inspector, scroll down to the "Document" section, and edit the "Label" field. This makes it easier to tell one view from another in the "Objects' browser. But I was wondering: Is there a way to access that text from the controller for my view?
I suppose you cannot.
But if you want to access something about UIView in both code and Interface Builder, you can set TAG value as property of UIView.
This is usefully for me in debugging process.

Reusable edit form in Apache Wicket

I have a simple ContactEditPanel which contains a form and a number of textfields. Up until now I included an AjaxSubmitLink in this panel which, if the form content is valid, saves/updates the Contact instance contained in the Panel model. So far so simple. However now I'd like to remove the link in order that I may, depending on the context in which I use the ContactEditPanel, place the submit link at different levels of my overall component hierarchy. For instance in one context I'd like to use to flip between ContactEditPanel and ContactViewPanel with a bar of actions above the current view (edit | save , cancel). Another context would be to use ContactEditPanel in a standalone way (maybe part of a multi-step process) with just a save link below.
I was contemplating refactoring my ContactEditPanel to extends FormComponentPanel rather than Panel as described here but I'm not sure whether this is the right approach and I'm having trouble wrapping my head around this.
Any help would be most appreciated!
Many Thanks,
A
Your using the panel like a FormComponent so extend FormComponentPanel, it will allow you to keep all the validation you write contained to the component and also allow you to reuse it as you wish.
Just think of it as you've created a new FormComponent, like a TextField or DropDownChoice.

Is it possible to determine the facet content in a custom controls design definition?

I'm putting together the design definition for a custom control and would like to vary how it displays based on whether or not a different custom control has been placed in the one of the facet areas. Is this possibe with the design definition and if so, how?
I know I can reference properties of the custom control by using "this", but I couldn't guess as to how to get to the facet content information.
Any ideas? Thanks
In the design definition you can add a callback node where your facet should appear. This should expose the Editable Area when you add your control to another page.
The format for the callback node would look similar to
<xp:callback id="callbackID" facetName="facetname" />
Dan,
Can you get the Editable Area as a javax.faces.component.UIComponent and then do .getFacets()?
BTW, hope you're well!

User controls as "screens" in a webpart

I'm workin on my first webpart.
I use some number of user controls as screens. And I have a trouble here.
First screen contains a list of dynamically created options (hyperlinks). After user made a decision with click, I want to change the screen and pass to the new screen some parameters.
My dicision is to load all controls I need on webpart creation. Controls I don't need right now I make invisible.
SomeUserControl1 uc1 = (SomeUserControl1)Page.LoadControl("~/_controltemplates/SomeUserControl1.ascx");
SomeUserControl2 uc2 = (SomeUserControl2)Page.LoadControl("~/_controltemplates/SomeUserControl2.ascx");
uc2.Visible = false;
Controls.Add(uc1);
Controls.Add(uc2);
Option in first user control realized as LinkButtons (serverside). OnClik event calls a special method in the webpart class and in this method i change a visibility of my user controls and pass some parameters to usercontrol2.
I don't like this approach. Are there different ways to realize described functionality?
Thanks!
You need use a ASP.NET Wizard Control, it does what you exactly you want.
From a design standpoint what you are doing looks a little bit frightening. You should think about nesting the various user controls into a single user control that you can use as the face of your webpart. Keep the coupling between the various user controls loose and think about implementing the Observer pattern if you need to do things like playing with control visibility.

Resources