Two ICEfaces panel positioned interacting - icefaces

How do you constrain the elements of a PanelPositioned so they can only be dragged within the current panel? I have two vertical lists of different data types, one above the other. Both use a PanelPositioned to allow drag & drop reordering, but the elements can be dragged up and down to the other panel, generating an error
<ice:panelPositioned id="dragPanel1" var="dataType1var"
value="#{displayBean.dataType1List}" constraint="vertical">
<ice:panelGroup style="cursor:move;">
</ice:panelGroup>
</ice:panelPositioned>
<ice:panelPositioned id="dragPanel2" var="dataType2var"
value="#{displayBean.dataType2List}" constraint="vertical">
<ice:panelGroup style="cursor:move;">
</ice:panelGroup>
</ice:panelPositioned>

For icefaces 3.0, add a beforeChangeListener to the ice:panelPositioned element. This listener should then call event.cancel() if the event.getType() != to PanelPositionedEvent.TYPE_MOVE and the event.getIndex() and event.getOldIndex() are both greater than 1. If it is a move, then it is within panel. add/delete are moving between panels.
For icefaces 1.8.2 (neve used 2.0), you would need to add a listener to the ice:panelPositioned element. There is no beforeChangeListener. you will need a before list and current list (two copies). Both initialize to same elements when initializing backing bean. The listener, if a move - set before list to current list otherwise set current list to before list. Must be a copy, not a reference.

Related

javafx8 scenebuilder menu shows controls labeled for container object

When I place JavaFX object inside a container, for example some checkboxes inside an hbox:
The scenebuilder controls for each checkbox show the container object in the menu (and different settings are shown here depending on the actual container):
But changing the "margin" value here, for example, clearly affects the individual checkbox and not the HBox. For example, setting only the middle checkbox to have a left margin of 20 yields a change to only the middle checkbox:
So why is that menu area labeled with the container name? I fear I am missing some fundamental design aspect by not understanding this.
They are properties of the control that are specifically available when its parent is an HBox. They correspond to the static methods HBox.setXXX(node, value), e.g. HBox.setHgrow(...).
If you put the check box in an AnchorPane instead, for example, you would see "Anchor Pane Constraints" instead of "HBox Constraints" and you would have options including "TopAnchor", "LeftAnchor" etc., corresponding to the static AnchorPane.setXXX(node, value) methods.

GXT add doesn't seem to work after LayoutContainer.removeAll()

GXT 2.25.
I have a screen with a layout container with a TableLayout with two columns. The left column has a tree grid. The right column is a layout container with table layout, one column.
When I click on various items on the tree grid, I want to display editable fields in the layout container on the right that match to the item clicked on.
When I first start the form and am loading the data from the server, I add text to the layout container and it seems to be fine.
After the text is loaded, I call secondLayout.removeAll() to remove all items. Then I click on an item in the tree. The selection method calls secondLayout.removeAll() and then adds a new text item "Loaded..." for testing.
private LayoutContainer secondaryLayout;
And then...
secondaryLayout.removeAll();
secondaryLayout.add(new Text("Loaded..."));
Ideas?
After making structural changes to a container, be sure to invoke (in GXT 2) the layout method to re-run the layout routines. The alternative is to configure the LayoutContainer to re-run layouts on each modification (using setLayoutOnChange), but that would in this case be at least two re-layouts - one for removeAll, and another for each new object added. Could be needlessly expensive, so better to run once and for all when you are finished making changes.
(Worth pointing out perhaps that GXT 2.2.5 is just over two years old, 2.2.6, 2.3.0 have gone out since then, and it is being superseded by GXT 3. In GXT 3, the method here would be forceLayout.)

how to hide and unhide authoerable tabs depending upon value selected from a drop down in CQ5

i am trying to create a footer component in CQ5, where i have 4 columns & all are autherable.
But we have to make no of columns autherable too i.e based on a value selected form a dropdown we have to open those many tabs for authoring those many columns only.
i have created a dropdown and have a maximum range of 6 columns. i know that i have to configure a listener for this purpose but don't know how . Requirement is like if i select 3 from the drop down then 3 tabs should come to author 3 columns
pls help me , i am middle of something very important.i need the solution very early too as i have to finish the job as soon as possible
I might be late for this by now but in case you still need it:
You need to add a listener node before closing your drop-down element:
<listeners
jcr:primaryType="nt:unstructured"
loadcontent="function(box){ //here you also need to handle the hide/unhide when the panel loads for the first time. Use this.getValue() to retrive the intial value }"
selectionchanged="function(box, value) {
for(var c=1;c<=value;c++){
this.findParentByType('tabpanel').unhideTabStripItem("tab"+c); // You need to handle the opposite with hideTabStripItem("tab"+c);
}
}"/>
Then on both "loadcontent" and "selectionchange" (these are events on your drop-down) grab the current selected value and use it to hide/unhide the tabs. In this case the tabs would be named "tab1", "tab2", etc, make sure you get the names right.
The ExtJS in the events is finding the "tabpanel" container for the whole dialog, and then hiding/unhiding based on name. You could also set to enable/disable using the methods ".enable()" and ".setDisabled(true)". Just make sure you get the reference to the tab first if you want to do this (something like ".getComponent(tabName).enable()").
I didn't test this specific code, I couldn't find my actual example from my code base but this should take you in the right direction.

ui.helper vs ui.item in jQuery UI

I was studying the jQuery UI Sortable widget and it said that all callback functions receive a ui object. Two of its properties are ui.helper nad ui.item. ui.helper is mentioned to be mostly a clone of ui.item, but I can't get the significance of calling it 'helper'. Also, the offset and position properties are defined in terms of the helper and not the item. What's the difference between the two ?
One of the answers mention that the helper fills the void, but the I read in the docs that the helper element is "used for dragging display". What exactly is this helper element and why is it named so?
From what I understand ui.helper is a "clone" of the ui.item. It is cloned so you can edit it with css and make it look like whatever you want it to look like while you are dragging it and it won't effect the original ui.item. So if you had a box and while it was being dragged you wanted it to turn into a blue box with curved edges but only while it was dragging you can by modifying ui.helper.
The helper is the element that fills the void (with visibility: hidden) when the item is dragged.

Loading two template files of same module in two positions

I am working on a new project and I am using Joomla version 1.5.22.
I need to display one horizontal search form in the middle of home page and the same search form in vertical style in all other pages but in left position.
So what I did is, I created two template files one for horizontal search(horizontal.php) and other for vertical search (vertical.php) and in mod_modulename.php I tried to load the respective modules based on a certain condition and changed the position left or middle according to it. The positions are changed in the database to get effected in the admin panel.
if(condition) {
modModulenameHelper::changeToVertical($position);//to change position in database to left
require( JModuleHelper::getLayoutPath( 'mod_modulename', 'vertical'));
}
else {
modModulenameHelper::changeToHorizontal($position);//to change position in database to middle
require( JModuleHelper::getLayoutPath( 'mod_modulename', 'horizontal'));
But I am not getting the correct output. It is loading the respective modules based on the condition. But the position is not assigned at first. And if I press Ctrl+F5 or refreshes, the page will be loaded with the desired output.
Why is this happening? Any Solution??
The problem is that you are changing the position after the fact. By the time you are changing the position, Joomla has already assigned the module to a position. It's an order of operations thing.
Instead, why not just use 2 instances of the module? Rather than going through this trouble, simply add a parameter to the module that allows you to select horizontal or vertical, then assign one to the home page menu item and another to the rest of the pages. This would also allow for putting the module in other positions instead of hard coding it in to the module.