dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11513
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3298: (GIS) Impl GUI for label font color.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 3298 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-04-06 16:27:22 +0200
message:
(GIS) Impl GUI for label font color.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-04-06 11:44:07 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js 2011-04-06 13:34:20 +0000
@@ -160,18 +160,19 @@
},
labels: {
- getActivatedOpenLayersStyleMap: function(fsize, fweight, fstyle) {
+ getActivatedOpenLayersStyleMap: function(fsize, fweight, fstyle, fcolor) {
return new OpenLayers.StyleMap({
'default' : new OpenLayers.Style(
OpenLayers.Util.applyDefaults({
'fillOpacity': 1,
- 'strokeColor': '#222222',
'strokeWidth': 1,
+ 'strokeColor': '#222222',
'label': '${labelString}',
'fontFamily': 'arial,lucida sans unicode',
'fontSize': fsize ? fsize : 13,
'fontWeight': fweight ? 'bold' : 'normal',
- 'fontStyle': fstyle ? 'italic' : 'normal'
+ 'fontStyle': fstyle ? 'italic' : 'normal',
+ 'fontColor': fcolor ? fcolor : '#000000'
},
OpenLayers.Feature.Vector.style['default'])
),
@@ -199,9 +200,9 @@
})
});
},
- toggleFeatureLabels: function(widget, fsize, fweight, fstyle) {
+ toggleFeatureLabels: function(widget, fsize, fweight, fstyle, fcolor) {
function activateLabels() {
- widget.layer.styleMap = this.getActivatedOpenLayersStyleMap(fsize, fweight, fstyle);
+ widget.layer.styleMap = this.getActivatedOpenLayersStyleMap(fsize, fweight, fstyle, fcolor);
widget.labels = true;
}
function deactivateLabels(scope) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-04-06 12:01:31 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js 2011-04-06 13:34:20 +0000
@@ -2124,106 +2124,129 @@
},
showLabelWindow: function(item) {
- if (item.labelWindow) {
- item.labelWindow.show();
+ var layer = G.vars.map.getLayersByName(item.parentMenu.contextNode.attributes.layer)[0];
+ if (layer.features.length) {
+ if (item.labelWindow) {
+ item.labelWindow.show();
+ }
+ else {
+ item.labelWindow = new Ext.Window({
+ title: '<span id="window-labels-title">Labels</span>',
+ layout: 'fit',
+ closeAction: 'hide',
+ width: G.conf.window_width,
+ height: 200,
+ items: [
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px',
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">Show/hide feature labels</div>'},
+ {
+ xtype: 'numberfield',
+ id: 'labelfontsize_nf',
+ fieldLabel: 'Font size',
+ labelSeparator: G.conf.labelseparator,
+ width: G.conf.combo_number_width_small,
+ enableKeyEvents: true,
+ allowDecimals: false,
+ allowNegative: false,
+ value: 13,
+ emptyText: 13,
+ listeners: {
+ 'keyup': function(nf) {
+ if (layer.widget.labels) {
+ layer.widget.labels = false;
+ G.util.labels.toggleFeatureLabels(layer.widget, nf.getValue(), Ext.getCmp('labelstrong_chb').getValue(),
+ Ext.getCmp('labelitalic_chb').getValue(), Ext.getCmp('labelcolor_cf').getValue());
+ }
+ }
+ }
+ },
+ {
+ xtype: 'checkbox',
+ id: 'labelstrong_chb',
+ fieldLabel: '<b>Bold</b>',
+ labelSeparator: G.conf.labelseparator,
+ listeners: {
+ 'check': function(chb, checked) {
+ if (layer.widget.labels) {
+ layer.widget.labels = false;
+ G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
+ checked, Ext.getCmp('labelitalic_chb').getValue(), Ext.getCmp('labelcolor_cf').getValue());
+ }
+ }
+ }
+ },
+ {
+ xtype: 'checkbox',
+ id: 'labelitalic_chb',
+ fieldLabel: '<i>Italic</i>',
+ labelSeparator: G.conf.labelseparator,
+ listeners: {
+ 'check': function(chb, checked) {
+ if (layer.widget.labels) {
+ layer.widget.labels = false;
+ G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
+ Ext.getCmp('labelstrong_chb').getValue(), checked, Ext.getCmp('labelcolor_cf').getValue());
+ }
+ }
+ }
+ },
+ {
+ xtype: 'colorfield',
+ id: 'labelcolor_cf',
+ fieldLabel: G.i18n.color,
+ labelSeparator: G.conf.labelseparator,
+ allowBlank: false,
+ width: G.conf.combo_width_fieldset,
+ value: "#000000",
+ listeners: {
+ 'select': {
+ scope: this,
+ fn: function(cf) {
+ if (layer.widget.labels) {
+ layer.widget.labels = false;
+ G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
+ Ext.getCmp('labelstrong_chb').getValue(), Ext.getCmp('labelitalic_chb').getValue(), cf.getValue());
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ ],
+ bbar: [
+ '->',
+ {
+ xtype: 'button',
+ id: 'labelshow_b',
+ iconCls: 'icon-assign',
+ hideLabel: true,
+ text: G.i18n.toggle,
+ handler: function() {
+ var layer = G.vars.map.getLayersByName(item.parentMenu.contextNode.attributes.layer)[0];
+ if (layer.features.length) {
+ G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
+ Ext.getCmp('labelstrong_chb').getValue(), Ext.getCmp('labelitalic_chb').getValue(), Ext.getCmp('labelcolor_cf').getValue());
+ }
+ else {
+ Ext.message.msg(false, '<span class="x-msg-hl">' + layer.name + '</span>: No features rendered');
+ }
+ }
+ }
+ ]
+ });
+
+ item.labelWindow.setPagePosition(Ext.getCmp('east').x - (G.conf.window_width + 15 + 5), Ext.getCmp('center').y + 41);
+ item.labelWindow.show();
+ }
}
else {
- var labelWindow = new Ext.Window({
- title: '<span id="window-labels-title">Labels</span>',
- layout: 'fit',
- closeAction: 'hide',
- width: G.conf.window_width,
- height: 170,
- items: [
- {
- xtype: 'form',
- bodyStyle: 'padding:8px',
- labelWidth: G.conf.label_width,
- items: [
- {html: '<div class="window-info">Show/hide feature labels</div>'},
- {
- xtype: 'numberfield',
- id: 'labelfontsize_nf',
- fieldLabel: 'Font size',
- labelSeparator: G.conf.labelseparator,
- width: G.conf.combo_number_width_small,
- enableKeyEvents: true,
- allowDecimals: false,
- allowNegative: false,
- value: 13,
- emptyText: 13,
- listeners: {
- 'keyup': function(nf) {
- var layer = G.vars.map.getLayersByName(item.parentMenu.contextNode.attributes.layer)[0];
- if (layer.widget.labels) {
- layer.widget.labels = false;
- G.util.labels.toggleFeatureLabels(layer.widget, nf.getValue(),
- Ext.getCmp('labelstrong_chb').getValue(), Ext.getCmp('labelitalic_chb').getValue());
- }
- }
- }
- },
- {
- xtype: 'checkbox',
- id: 'labelstrong_chb',
- fieldLabel: '<b>Bold</b>',
- labelSeparator: G.conf.labelseparator,
- listeners: {
- 'check': function(chb, checked) {
- var layer = G.vars.map.getLayersByName(item.parentMenu.contextNode.attributes.layer)[0];
- if (layer.widget.labels) {
- layer.widget.labels = false;
- G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
- checked, Ext.getCmp('labelitalic_chb').getValue());
- }
- }
- }
- },
- {
- xtype: 'checkbox',
- id: 'labelitalic_chb',
- fieldLabel: '<i>Italic</i>',
- labelSeparator: G.conf.labelseparator,
- listeners: {
- 'check': function(chb, checked) {
- var layer = G.vars.map.getLayersByName(item.parentMenu.contextNode.attributes.layer)[0];
- if (layer.widget.labels) {
- layer.widget.labels = false;
- G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
- Ext.getCmp('labelstrong_chb').getValue(), checked);
- }
- }
- }
- }
- ]
- }
- ],
- bbar: [
- '->',
- {
- xtype: 'button',
- id: 'labelshow_b',
- iconCls: 'icon-assign',
- hideLabel: true,
- text: G.i18n.toggle,
- handler: function() {
- var layer = G.vars.map.getLayersByName(item.parentMenu.contextNode.attributes.layer)[0];
- if (layer.features.length) {
- G.util.labels.toggleFeatureLabels(layer.widget, Ext.getCmp('labelfontsize_nf').getValue(),
- Ext.getCmp('labelstrong_chb').getValue(), Ext.getCmp('labelitalic_chb').getValue());
- }
- else {
- Ext.message.msg(false, '<span class="x-msg-hl">' + layer.name + '</span>: No features rendered');
- }
- }
- }
- ]
- });
-
- item.labelWindow = labelWindow;
- item.labelWindow.setPagePosition(Ext.getCmp('east').x - (G.conf.window_width + 15 + 5), Ext.getCmp('center').y + 41);
- item.labelWindow.show();
- }
+ Ext.message.msg(false, '<span class="x-msg-hl">' + layer.name + '</span>: No features rendered');
+ }
},
items: [
{