Looking for the opposite of flexglobals.toplevelapplication - custom-component

If I want to refer to a textInput (for example) in the top level application from a custom component. Than I can use FlexGlobals.toplevelapplication but how do I refer to a textInput in a custom component from the top level application. So I need the opposite from FlexGlobals.toplevelapplication.

Related

Hi, If we want to show/hide both tabs and fields in AEM, based on the style selected for a component

Like for my one component there a two styles added , if style one is selected then I have to hide 1 field in cq:dialog and if style 2 is selected then I have to show that field
Is the style mentioned above, is a dropdown within same dialog? If yes, there are numerous examples explaining how to implement Show/Hide of dialog fields. Please check here, here, here, here.
Basically idea is on the dropdown field, add a class cq-dialog-dropdown-showhide and a property cq-dialog-dropdown-showhide-target with a value of class selector unique to component. Then by defining property showhidetargetvalue on the element, selecting the dropdown will show/hide respective properties.
If the style you mentioned is the style system applied using brush icon, it is not OOTB. You ll need to add an authoring clientlib and implement logic to hide specific dialog field based of style system applied.
IMO style system is presentational, only to apply skin to the component. It should not drive business logic of allowing dialog properties. As simplistic, maybe allow authors to enter all allowable fields at dialog and using JS, you may consume / not, the dialog properties.

Very small labels and components in Mapbox

I am trying to create a navigation application using Mapbox GL JS. But the text labels are too small along with the searchbox. Where in the Mapbox GL JS API can we set the tilesize and ppi to fix it?
The best way to adjust the size of the text labels is to create a custom map style using Mapbox Studio, rather than programmatically manipulating the size of the map labels using the GL JS API (unless for some reason you need the text label size to be responsive on the client side).
You can navigate to studio.mapbox.com, select the New style button, choose a template to customize, and then click the Customize button. This will open the map editor interface, where you can navigate to the Layers panel on the lefthand side of the interface and select a layer whose properties you would like to edit.
For example, in the screenshots below I selected the state-label layer and changed the Text size property from 18px to 30px. More details about styling layer properties can be found in the documentation here.
To persist these changes to the map, you can publish your style, as described in the detailed documentation here. The way in which you can then add the custom map style to your application is dependent on the application you are developing for. The linked documentation specifies the appropriate steps for web, Android, iOS, Unity, and several other third party options.

Nested lightning components in Salesforce communities

Salesforce communities provide native lightning components with the capability of allowing a user to drag and drop components into them. Not all components are allowed (i.e. A tab component cannot contain another tab component, but can contain a list view component). I have this very simple component:
<aura:component implements="forceCommunity:availableForAllPageTypes,forceCommunity:layout" access="global" >
<aura:attribute name="detail" type="Aura.Component[]">
<p>default paragraph1</p>
</aura:attribute>
<aura:set attribute="detail"></aura:set>
Default value is:
{!v.detail}
</aura:component>
This component implements forceCommunity:layout, so I can create a page using it as a layout. When I do, components can be dragged in to where the '{!v.detail}' is. When I drag the component into an already-existing layout, I lose that functionality. Is there any way to do this?
You need to edit template settings rather than drag it into the community builder.
If you want to add them programmatically, you'll need to do that inside a lightning component.

JavaFX 2 custom popup pane

The JavaFX 2 colour picker has a button that pops up a colour chooser pane like so:
I'd like to do something similar, in that I'd like a custom pane to pop up when the button is clicked on and disappear when something else is clicked (in my case, a few image thumbnails). What would be the best way of achieving this? Should I use a ContextMenu and add a pane to a MenuItem somehow, or is there something else I should look at?
It's kind of difficult to do well with the current JavaFX 2.2 API.
Here are some options.
Use a MenuButton with a graphic set in it's MenuItem
This is the approach taken in Button with popup showed below's executable sample code.
Use a PopupControl
Take a look at how the ColorPicker does this in it's code.
ColorPicker extends PopupControl. You could do this, but not all of the API required to build your own PopupControl is currently public. So, for JavaFX 2.2, you would have to rely on internal com.sun classes which are deprecated and will be replaced by public javafx.scene.control classes in JDK8.
Use a ContextMenu
So, I think your idea to "use a ContextMenu and add a pane to a MenuItem" is probably the best approach for now. You should be able to do this by using a CustomMenuItem or setting a graphic on a normal MenuItem. The ContextMenu has nice relative positioning logic. A ContextMenu can also be triggered by a MenuButton.
Use a Custom Dialog
To do this, display a transparent stage at a location relative to the node.
There is some sample code to get you started which I have temporarily linked here.
The sample code does relative positioning to the sides of the main window, but you could update it to perform positioning relative to the sides of a given node (like the ContextMenu's show method).
Use a Glass Pane
To do this, create a StackPane as your root of your main window. Place your main content pane as the first node in the StackPane and then create a Group as the second node in the stackpane, so that it will layer over the top of the main content. Normally, the top group contains nothing, but when you want to show your popup, place it in the top group and translate it to a location relative to the appropriate node in your main content.
You could look at how the anchor nodes in this demo are used to see how this might be adaptable to your context.
Is there a relevant update for this for JavaFX8?
There is not much difference of relevance for Java 8, in general the options are as outlined in this post based on Java 2.2 functionality. Java 8 does add Dialog and Alert functionality, but those are more targeted at use of dialogs with borders, titles and buttons rather than the kind of functionality desired in the question. Perhaps you might be able to start from the Dialog class and heavily customize it to get something close to what is needed, but you are probably better off starting from a blank stage or PopupControl instead.

Custom component for Label with Text box and image in GWT

I need to create a custom component which can have Label then Textfield and Image, by clicking the image i should select date, that selected date should be populated in TextField,
Is there way i can develop a custom component.
Thanks in Advance!!!
Absolutely!
You need to create a custom widget, and the way to do that is to extend the Composite class.
From the documentation:
A composite is a specialized widget that can contain another component (typically, a Panel) but behaves as if it were its contained widget. You can easily combine groups of existing widgets into a composite that is itself a reusable widget. Some of the UI components provided in GWT are composites: for example, the TabPanel (a composite of a TabBar and a DeckPanel) and the SuggestBox.
Rather than create complex widgets by subclassing Panel or another Widget type, it's better to create a composite because a composite usually wants to control which methods are publicly accessible without exposing those methods that it would inherit from its Panel superclass.
There is a good example to get you started here:
http://code.google.com/webtoolkit/doc/latest/DevGuideUiCustomWidgets.html
The GWT showcase give an example of somthing similar to what you are looking for along with the source code:
"Date Picker" - GWT Showcase
If you want to develop a custom component, look at #Jon Vaughan's answer!
You may also use third party libraries with widgets, like Ext GWT or SmartGWT. Date picker is one of the base widgets that everyone provides.