How to access inner controls through styleManager? - flex4

I'd like to know if there is a way to access inner controls of the spark control (lets say Panel) through the styleManager?
I've used the following code to access Panel's CSS properties:
styleManager.getStyleDeclaration("spark.components.Panel")
.setStyle("backgroundColor", "blue");
I'm unable to figure out how to access the inner controls like displayLabel. I know that this is possible using the CSS styling, but I'd like to change their properties at runtime.
How can this be done?

I am not sure if this is still current, but I think what you need to do is to declare the inner classes somehow in your CSS (possibly empty if you don't care). As soon as they exist there, the styleManager can access their values. You can also do something like this:
[Style(name="backgroundColor", type="uint", format="Color")]
In your MXML declaration, and then that style exists.
There are a few related examples here:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf687e7-7ff6.html
[This is related to an issue I have myself with the StyleManager and google led me here, that's the reason for the late answer]

Related

Angular5 pass DOM object to ng-content

I'm newest in web.
I want customize default scroll-bar in ag-grid. I try use ngx-scrollbar for this. In sources ngx-scrollbar I found that ngx-scrollbar using ng-content for wrapping elements(link to github source file). If wrap ag-grid-angular element then scrolling even doesn't shows because content doesn't overflow ag-grid-angular content because oveflow happen in div with class .ag-body-viewport where using stock srolls. In order to achieve needed effect I wish pass DOM element with class .ag-body-viewport to ng-content of ngx-scrollbar. Is it possible?
More info here github issue but I don't use Nice Scroll or Perfect Scrollbar
I want use ngx-scrollbar because it has capability of customization.
UPDATE
I can pass DOM element to ng-content using next sintax(agGridViewport is native element):
<ng-scrollbar>
{{ agGridViewport }}
<ng-scrollbar>
but it pass element like a copy of real DOM object but I want pass this like a refence.
Now I got UI like a stack style:
[rendered real ag-grid-angular]
[rendered ng-scrollbar with his content]
But it isn't that I need. Also I got bad rendering with artifacts and even some components doesn't appear. Now I want to try use Renderer2 for putting ng-scrollbar element between two DOM elements in tree(.ag-body-viewport-wrapper and .ag-body-viewport). But I think it's very bad idea because Renderer2 doesn't have methods for putting elements between DOM elements in tree and my code will be very unlify and complicated :( It's must be like injection.
No, I can not do injection in DOM with Angular tools. It's bad idea do it and it is not possible now. AgGrid doesn't support customization with tools like ngx-scrollbar which using ng-content for wrapping components and other elements. May be better way using other tools which working by another way or using webkit customization which supports not all web browsers.
UPDATE
Also I try to use smooth-scrollbar. I managed to get better result. I bind him to element .ag-body-viewport. It works fine but it scrolling only content of grid without header be careful. smooth-scroll bar doesn't have options for horizontal and vertical scrollbar as a different units. I know how issue can be solve. Vertical scrollbar must be bind to .ag-body-viewport and horizaontal scrollbar must be bind to .ag-root. If your can find scrollbar which let you do it that you can solve this problem. May be I write special component for Angular in near future and then add link to this answer. If you do it faster you can add yourself link or you can add link to already existing packages.

What exactly does aria-controls do for the user? How is it affected by AJAX usage?

I have a set of tabs with proper roles and attributes for accessibility support. The content that tab controls gets loaded in via ajax. But each wrapper for the content loaded in also has proper tab pane roles and attributes.
The problem is, when I run an automated audit using Chrome Accessibility Tools, the test fails stating that the corresponding ID of the tab pane is missing for all of the tabs except the one that's currently active (because that wrapper with ID has been loaded). The exact error states: "ARIA attributes which refer to other elements by ID should refer to elements which exist in the DOM."
Since the ID will exist once the tab with the corresponding aria-controls attribute is active, is this really an error? Or is this just a case of a false positive because it's an automated test and they can only do so much.
In summary, What does aria-controls do and does it really need to refer to an ID that currently exists in the DOM?
aria-controls give your assisting technology a way to move to the controlled element.
If this element is not in the DOM or can't be accessed, then yes it's an error.
The two (the element with aria-controls as well the element with the referenced id) must exist at the same time, whether at page render or via JS injection.
The DOM is parsed by the UA/AT combo before the user even gets to the control or your script fires to make it exist. If you use JS injection then you need to make sure the DOM is re-parsed.
This would apply to aria-owns as well.
I don't know whether the following would work in your architecture, but it would solve the error problem:
Design the tabs so they are all in the page at the time it loads. Format those that should not be shown to be outside the viewport using absolute positioning and something like "left: -99em." Use AJAX to reset the positioning when the time has come to display the tabs. The result is that the ARIA ID dependencies will always be valid because the tabs are always part of the DOM.

Accessing NativeScript ListView itemTemplate contents

I’m using a NativeScript <ListView> and I’m trying to get access to the individual elements in each element’s <ListView.itemTemplate>. To give a concrete example, given this code snippet, how do I access each <GridLayout>?
<ListView>
<ListView.itemTemplate>
<GridLayout>...</GridLayout>
</ListView.itemTemplate>
</ListView>
I know that I can add a loaded event to each <GridLayout>—i.e. <GridLayout loaded="myEventHandler">—however, for my use case I need to change attributes on the <GridLayout> after an unrelated event occurs.
Theoretically I could use the loaded event to build an array of all <GridLayout>s in a <ListView.itemTemplate>, and then use that array to perform actions, but that just seems hacky. It seems like there has to be a better way. Any ideas?
Manipulating the visual tree for a list view item doesn't seem like the most robust approach here. Consider the following scenario:
An item gets rendered to the screen.
Your code kicks in and modifies the visual container's tree.
The user scrolls, or something else happens, and the list view reuses the visual container for another item. Your new item now looks broken.
I'd implement this using bindings and, if things get hairy, an appropriate view model that makes bindings straightforward.
You can use the nativescript-dom plugin. The getElementsByClassName actually has code to traverse the ListView's children. Unfortunately after I discovered the issue and put in the bug report into the NS Common Components repo -- I totally forgot to make the same changes to the getElementsByTagName and getElementById functions in the nativescript-dom plugin.
So using getElementsByClassName if you assign it a class name should work right now. Otherwise; I'll probably do an update to the library later this week that will have the listview children traversal code in it for the other two methods.
Update: I've released a new version of nativescript-dom that allows all three getElement* to work on ListView children.
I think you may be able to give the each gridview and id dynamically using something like id="gridView{{$index}}" then use page.getViewById('gridView1') for example. Can't test it out at the moment, but I think that would work.

Joomla 3 Article alternative layout

I've created an alternative layout for one of my articles which can be applied successfully, but as has been highlighted in various forums: if you view the article using the Single Article menu type the alternative layout doesn't get applied because of an XML override.
I have a Joomla site that is setup for Sales and Support where the article info such as date, hits etc is useful but on the marketing side none of that is needed, hence an alternative layout would work well.
I want to know how to enable my alternative layout using the Single Article menu type - I've already got the layout how I want it (testing it by having it overwrite default.php) but want to set it up as marketing.php instead and only have it applied to what is needed.
You're probably not going to like this answer because you have already written you're alternate view. If you were rewriting it to begin with, why would you not write in a way that the side bar parameters (date, hits, ect) are within a container that is only loaded conditionally. This way you would only have one view to worry about and a lot less headaches.

WP7 Changing 1 layout element based on another

Having no luck here trying to find a solution to this.
I've set up a looping selector based on this guide. (I also used the ListLoopingDataSource class in Part 2 in order to have strings in my looping list).
What I want to be able to do is then change another element (an image box/placeholder) on my layout, based on what is currently selected in the looping selector.
No real idea how to do this, the onSelectionChanged event is kind of abstracted and not really useful? I'm not sure how to programmatically change images either, it doesn't look like I can access a resource from the code base, only from the xaml.
Any help/suggestions would be greatly appreciated.
I found that I could do this by using binding.

Resources