POST
|
Jennifer, Thanks for the kind words. I have a "headless" widget (invisible, starts automatically) called Acme. In this widget, I overwrite the AGOL WebMap popup template with my own custom template. I don't have enough documentation yet to post the Acme Widget, but I have posted a sample "headless" widget here, and you can download my entire app here, and work your way through the Acme Widget and its config file. I suggest you start at line 1405 of the Widget.js in the Acme Widget. Larry
... View more
05-22-2015
11:11 AM
|
1
|
3
|
4807
|
POST
|
David, I've been offline for a couple of days. It looks like Robert has answered your question. His answers are usually better than mine. I wish we had several of him. Are you set now? Larry
... View more
05-22-2015
10:59 AM
|
0
|
2
|
916
|
DOC
|
2/18/2017 --- updated download link This widget is a sample of how to create a "headless" widget for the Wed AppBuilder (WAB). By "headless," I mean it is invisible and it is loaded at startup. It can add new functionality to the WAB such as map tips on feature layers, modify the appearance/behavior of other widgets using Dojo's Aspect Oriented Programming techniques (aspect.before, aspect.after, aspect.around). The only limit is your imagination. There is no live sample for this widget, as it is invisible. I called it Anvil because the original "headless" widget I wrote is called Acme, and I wanted to stay with the Roadrunner theme. This widget does nothing except show a message when it loads, and also if you double-click the map while holding down the Control and Alt keys. (The double-click while holding down the Control and Alt keys feature obviously won't work on devices without Control and Alt keys.) If you want to drop this widget into the WAB and configure it in an app, you will need to copy its folder into the client\stemapp\widgets folder and then add it to the client\stemapp\predefined-apps\default\config.json file. If you want to add this widget to an app you have already built with the WAB, then add it to the main config.json file like this: "widgetOnScreen": {
"widgets": [
{
"uri": "widgets/Anvil/Widget",
"position": {
"left": -1000,
"bottom": -1000
},
"version": "1.1",
"id": "widgets/Anvil/Widget_101",
"positionRelativeTo": "map",
"name": "Anvil",
"label": "Anvil"
},
. . .
. . .
],
"panel": {
"uri": "jimu/PreloadWidgetIconPanel",
"positionRelativeTo": "map"
}
},
. . .
. . .
Anvil-1.1-2015-5-21.zip https://community.esri.com/docs/DOC-9622-anvil-11-2015-5-21zip Larrys Custom WAB Widgets and More
... View more
05-21-2015
03:13 PM
|
0
|
1
|
10071
|
POST
|
Now that you ask, I think I'll write a very simple example and post it. I'll let you know, but it shouldn't take but a few hours, and I think it might be useful for lots of folks. Larry
... View more
05-21-2015
10:26 AM
|
1
|
6
|
1757
|
POST
|
Stan, Sorry, I didn't make the connection. Since I implemented my Flex autocomplete with a table upstream of the geocoder, I don't have to worry about the geocoder's scoring. If the user selects an autocomplete candidate, I send the whole ID to the geocoder, and the match score is usually 100%. Esri's auto complete runs off of what is returned by the geocoder, so I can just change the scoring in all 26 of my geocoders. I think I may implement my Flex workflow into the WAB. I like it better. Thanks for helping me see the light. I never made the connection. Larry
... View more
05-21-2015
09:54 AM
|
1
|
0
|
179
|
POST
|
Brandon, The trickiest part of map tips is where to put the code. I have a "headless" widget that does the map tips and lots of other things. It does so many things that I'm having trouble finding the time to document it so I can post it. In it's config file, I have something like this: "featureLayerMapTips": { "layers": { "Address Points (E911)": { "mapTip": "Address Point (E911): <b>{FULL_ADDR}</b><br><i>Click for more info</i>" } } }, If map tips are configured, we need to create a popup: // Create the MapTip dialog this.mapTip = new TooltipDialog({ id: "mapTipDialog", style: "position:absolute; max-width:300px; z-index:100;", "class": 'mapTipDialog' }); this.mapTip.startup(); Then, I have this code (looping through all of the feature layers to see if map tips are configured): var mapTipTemplate = lang.getObject(layerLabel + '.mapTip', false, this.config.featureLayerMapTips); if (mapTipTemplate) { on(layer, 'mouse-out', lang.hitch(this, function() { if (this.savedSettings.showMapTips) { clearTimeout(this.mapTipDelay); clearTimeout(this.mapTipLife); this._hideMapTip(); } })); on(layer, 'mouse-over', lang.hitch(this, function(evt) { if (this.savedSettings.showMapTips) { clearTimeout(this.mapTipDelay); clearTimeout(this.mapTipLife); this.mapTipDelay = setTimeout( lang.hitch(this, '_showMaptip', mapTipTemplate, evt), this.mapTipTimes.delay ); } })); } Finally, the functions to show and hide the map tips: _showMaptip: function(mapTipTemplate, evt) { // If the user is drawing, don't show the mapTip if (this.drawToolActive) { return; } // If there is an info window showing don't show a MapTip. if (this.map.infoWindow.isShowing) { return; } var content = lang.replace(mapTipTemplate, evt.graphic.attributes); if (this.nullValue && this.nullValueReplacement) { content = content.replace(this.nullValue, this.nullValueReplacement); } this.mapTip.setContent(content); popup.open({ popup: this.mapTip, x: evt.pageX + 10, y: evt.pageY + 10 }); // Fade in the MapTip baseFx.animateProperty({ node: this.mapTip.domNode, duration: this.mapTipTimes.fadeIn, properties: { opacity: 0.85 }, onEnd: lang.hitch(this, function() { this.mapTipLife = setTimeout(lang.hitch(this, '_hideMapTip'), this.mapTipTimes.life); }) }).play(); }, _hideMapTip: function() { // Fade out the MapTip baseFx.animateProperty({ node: this.mapTip.domNode, duration: this.mapTipTimes.fadeOut, properties: { opacity: 0 }, onEnd: lang.hitch(this, function() { popup.close(this.mapTip); }) }).play(); }, Keep in mind that map tips can be very annoying. I give my users a way to turn them off completely, and I have a system where other widgets can publish a topic to turn them on and off (e.g. the Draw Widget). The hide automatically a few seconds after the cursor leaves the map tip. The don't show at all if an infoWindow is open. Larry
... View more
05-21-2015
09:49 AM
|
1
|
10
|
1757
|
POST
|
Stan, I understand, but I wish they would let us change the scoring. My users would kill me if I replaced an app that suggests the address in 5 keystrokes with one that takes 20 keystrokes. In my Flex auto complete, the query is simple. When you type 12345, it builds a SQL query select * from table where id like '12345*'. I have a Python script that updates the table every morning in the wee hours. It has about a million records, but is indexed. Larry
... View more
05-21-2015
09:18 AM
|
1
|
2
|
1320
|
DOC
|
Tom, I didn't try that, but the concept should work. You'll have to do some geometry and offset both x and y coordinates. Let me know if you need some help on this. Larry
... View more
05-20-2015
02:06 PM
|
0
|
0
|
3657
|
DOC
|
Rickey (et al), Text is tricky and text in SVG (which is what the JavaScript API produces) is even trickier. I tested with Esri's Print Widget and with my Print Plus Widget. Same problem in both widgets. The problem is using an offset on the text symbols to achieve the spacing. This method maintains a constant vertical spacing (in pixels) between lines of text for all zoom scales. The Esri Print Dijit doesn't honor this because there is no support for multi-line text in SVG. The solution is to calculate a distance between the lines of text in map units and adjust the geometry of the text graphics. This produces SVG text that the Esri Print Dijit can process, but has one disadvantage. The font size is constant, but the location of the text is in map units, so as you zoom out the lines of text get closer together, and as you zoom in the lines of text get farther apart (in pixels). Both print widgets will increase the line spacing of the text if you force the print scale to a larger scale than the browser scale. For example, if you draw a circle at a map scale of 1:1200 and then force the print scale to 1:300, the vertical spacing of the text will increase (in pixels). Still, I think this is better than it is now. Here's how I modified your code for polygon dimensions. There are probably other parts of the code that will need similar modifications. From the end of the _addPolygonMeasure() function: var text = area + "" + length; var unitsPerPixel = this.map.extent.getWidth() / this.map.width; //lcs new lineSpacing = this.textSymChooser.textFontSize.value * unitsPerPixel; //lcs new var textSymbol = new TextSymbol(area, symbolFont, fontColor); // textSymbol.setOffset(0, this.textSymChooser.textFontSize.value); //lcs deleted var areaGraphic = new Graphic(center.offset(0, lineSpacing), textSymbol, null, null); //lcs edited this.drawBox.addGraphic(areaGraphic); var textLSymbol = new TextSymbol(length, symbolFont, fontColor); // textLSymbol.setOffset(0, this.textSymChooser.textFontSize.value * -1); //lcs deleted var lengthGraphic = new Graphic(center.offset(0, -lineSpacing), textLSymbol, null, null); //lcs edited this.drawBox.addGraphic(lengthGraphic); Hope this helps.
... View more
05-19-2015
02:39 PM
|
0
|
0
|
3657
|
POST
|
Stan, It's on my to do list for JavaScript, but I wrote my own auto complete for the Flex Viewer. I'm using a composite geocoder with over 20 feature classes. I think my auto complete is way better than Esri's. For my address, (9850 Highland Springs Dr N), my auto complete offers it after I type in 5 characters (the minimum). Esri's auto complete using the same geocoder requires 20 characters before my address is offered. Here's a link: Hamilton County Flex Viewer I'm writing this up for the JS API team. Larry
... View more
05-19-2015
12:50 PM
|
1
|
4
|
1320
|
DOC
|
Stan, There is no problem with Print Plus and the Esri Draw Widget. I've downloaded Tom Sellsted's Measure Widget and will do some testing. Larry
... View more
05-18-2015
08:03 PM
|
0
|
0
|
3657
|
DOC
|
I wonder if the problem is that your machine can’t see the Web Map Print Task service? Larry
... View more
05-18-2015
02:55 PM
|
0
|
0
|
4368
|
DOC
|
Stan, I have posted a new version of the Print Plus Widget. I fixed several things, and hope it solves your problems. It prints graphics now and leaves than out of the legend. If you see any other problems or have ideas to make it better, please let me know. Larry
... View more
05-16-2015
08:20 PM
|
0
|
0
|
4368
|
Title | Kudos | Posted |
---|---|---|
1 | 05-22-2015 11:01 AM | |
1 | 07-15-2015 09:38 AM | |
1 | 02-27-2015 07:00 AM | |
1 | 07-15-2015 10:23 AM | |
1 | 08-03-2015 07:45 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|