Qooxdoo TreeVirtual ContextMenu - qooxdoo

How can I implement a ContextMenu on a column in TreeeVirtual in Qooxdoo?
I found an example for table:
table.setContextMenuHandler(2, this._contextMenuHandlerNull);
but it does not work in treevirtual case.

You should make sure that you include the Context menu mixin in the table class:
qx.Class.include(qx.ui.table.Table, qx.ui.table.MTableContextMenu);
As the tree virtual extend the table, the context menu will be available after you have included the mixin. Take a look at the following sample to see it running:
http://tinyurl.com/7nxm3uc

Related

Stylizing LWC radio list?

So right now I'm trying to build this radio list for the regions in LWC, the functionality works fine in that when you click on the regions it selects all the states below for that region.
https://i.stack.imgur.com/y2MM8.png
However, I want to stylize it so that it looks more proper. I'm a little confused how to do this using these components that LWC provides. Here's a mockup of what the regions should look like.
https://i.stack.imgur.com/A26PH.png
Here's what the HTML for it looks like.
https://i.stack.imgur.com/1vWcy.png
You can probably achieve this by using the grid system : https://www.lightningdesignsystem.com/utilities/grid/
We can achieve the same style by following a couple of steps:
Pass class to each lightning inputs to scope the styling.
Style radio controls having the passed class name.
save the file as .css and store in static resources.
Load style sheet in component by making use of loadStyle method from platformResourceLoader module.

Is there an easy way to add a copy button to the IndexListing of a non-page model in wagtail?

I have a Snippet model that I'm using ModelAdmin to create, edit, and list in Wagtail. I'd like to create a copy function, and I can see that wagtail supports this out of the box for Page objects:
Before I write custom code to do this, I thought I'd ask if there is any way to easily do this within Wagtail. I didn't find any hooks that would even easily allow adding more buttons, and while I did find modeladmin-list-display-add-buttons, it seems to only allow me to change the placement of the default edit and delete buttons.
It is possible to achieve this. However, it will require custom code, and various overrides and additions in different places. Here are some steps that should help you on your way, with some links to some example code in the wagtailmenus extension, which does this exact thing:
Adding the custom view:
Create a custom CopyView view (subclassing wagtail.contrib.modeladmin.views.EditView will probably be your best starting point). For inspiration, you might want to take a look at one I created for wagtailmenus: https://github.com/rkhleics/wagtailmenus/blob/master/wagtailmenus/views.py#L141
Integrate the view with your ModelAdmin class, by adding a copy_view() method that instantiates your custom view. For example:
https://github.com/rkhleics/wagtailmenus/blob/master/wagtailmenus/modeladmin.py#L78
Override your ModelAdmin class's get_admin_urls_for_registration() method, to make the view accessible via a URL. For example: https://github.com/rkhleics/wagtailmenus/blob/master/wagtailmenus/modeladmin.py#L82
Getting the button to show in the listing:
Create a custom ButtonHelper class by subclassing wagtail.contrib.modeladmin.helpers.ButtonHelper.
Add a copy_button() method to it, that can provide all of the necessary details to create the button. For example: https://github.com/rkhleics/wagtailmenus/blob/master/wagtailmenus/modeladmin.py#L38/
Override the get_buttons_for_obj() method to output the copy button in the listing along with the others, depending on the user's permissions (e.g. https://github.com/rkhleics/wagtailmenus/blob/master/wagtailmenus/modeladmin.py#L49)
Finally, get your ModelAdmin class to use your custom ButtonHelper instead of the default one, by changing the button_helper_class attribute to reference your custom class.
If you'd like to understand more about all of the various classes within wagtail.contrib.modeladmin, I'd suggest reading the modeladmin customisation primer page from the official Wagtail documentation.

Configuring bottom bar in QLPreviewController

I have integrated QLPreviewController and UIDocumentInteractionController in my app, and it is working fine.
The only problem is- I want to configure the bottom toolbar, I want to remove the default toolbar items, which appear as shown in image below:
Is there any way to do so, please suggest.
Short Answer: NO, Not in IOS6+
Description:
One thing to note about QLPreviewController is that it's not meant to be customized. There were other libraries allowing you to change the functionality such as:
https://github.com/rob-brown/RBFilePreviewer
Which are not working in iOS 6+ since apple made a big change in QLPreviewController and it's technically running in a separate process. Although it might be possible (not sure) using private apis but your app will be rejected then.
You can find more info about this change here:
http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/
Hope this helps
Subclass UIToolbar
Create UINavigationController using
init(navigationBarClass:toolbarClass:) and supply UIToolbar subsclass created in step 1 for toolbarClass
Create QLPreviewController instance and push onto UINavigationController stack
Inside of UIToolbar subsclass override
setItems(_:animated:). To remove all buttons call super with empty array super.setItems([], animated: false) or potentially you can add only buttons you want to keep.
Present UINavigationController created in step 2
Here is the example PreviewControllerHideBottomButtons
Subclass QLPreviewController.
Search for the Toolbar in the view hierarchy.
Have a UIToolbar property in your class that has the same frame as the original toolbar.
Place your own toolbar above the default one with whatever buttons you want.
If you want it to be hidden as the default behavior of the QLPreviewController you can key value observe the hidden property of the default toolbar and present / hide your own accordingly.

Extjs add grid panel to accordion content

I'm actually not sure if this is possible, but I will ask it anyway. I have a group of accordion controls, and within the content body of each I need to display a grid panel. The grid panel needs to have a click event attached to it. I have tried simply creating the grid panel and setting the html property of the accordion to it, but this produces no content.
Is there somehow I can achieve the above?
You cannot have html content (inserted by the property) along with any other content. If you add any item the html property value will not set/overriden. But for sure you can place anything you want into one accordion panel. Even a grid. But for that case, and based on the last question, I would recommend you to reference the view into the grid. You may do this simply by using a ComponentQuery
The click events can be applied by using the control function of the controller.
For your basic understanding:
In ExtJS you seldom use plain html code. In most scenarios you use any sort of component. All is nested within the items-array or dockedItem-array. Items within these arrays get also processed by the layout system.
Some Query examples applicable to the control function
In the following this refers to the controller itself.
You know the Id of the grid (normally you didn't do this). Id's are marke by a starting #
control({'#yourId': {itemclick: this.onItemclick }});
You know the xtype and that there is only one instance of this type. You can also describe a path by using spaces between the xtypes.
control({'grid': {itemclick: this.onItemclick }});
You have set a custom property to grid (you can refer any property this way). This one is fully compatible the the one above. I recommend this one in your case
control({'grid[customIdent=accordionGrid]': {itemclick: this.onItemclick }});
This are just some ways to use ComponentQueries, there are more. For a more detailed explanation you should refer the sencha API for ComponentQuery
Also note that every component implements the up() and down() methods which also support ComponentQueries.
I forgot to mention: For a control the query strictly need to return just one result (only the first one will be taken) a ComponentQuery on the other hand can return multiple results.
This is perfectly possible but the accordion's body is not the place to put that in. You'll need to add it to the items: [] array of the accodion. The body (or html) only accepts html.
Example:
http://docs.sencha.com/ext-js/4-1/#!/example/layout/accordion.html
this one has a grid within it.

Dynamic menu items in WPF

Is there a way to create a section on a menu for a list of menu items to be populated by something like an ObservableCollection?
I'd like to replicate the Window functionality in Visual Studio, where the open document tabs are listed in a numbered list, limited to the first 10.
See "Merge ContextMenus" from here. You can find more info by searching for CompositeCollection and menu/ContextMenu.
EDIT: Just saw CompositeCollection was already mentioned in a comment, but I'm going to leave this here for reference.
How does your menu get data right now? Is it databound? Check this article for binding your menu with a collection.
Now it is up to you to add logics when to add item to the collection.
For eg: In your scenario, you have to store the open documents in a list. Then you have to filter out the first 10 documents and add it to the children property of the MenuItem class specified in the article.
You can create menu items in code and manually add them to the menu when the form loads. It isn't elegant, but it gets the job done.

Resources