Skip to content

Commit

Permalink
issue planetfederal#216 - various UX fixes and form initializations
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Feb 18, 2014
1 parent 6f30308 commit 66d03b3
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 75 deletions.
24 changes: 12 additions & 12 deletions src/script/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,15 @@ GeoExt.Lang.add("en", {
},

"gxp.PointSymbolizer.prototype": {
graphicCircleText: "circle",
graphicSquareText: "square",
graphicTriangleText: "triangle",
graphicStarText: "star",
graphicCrossText: "cross",
graphicXText: "x",
graphicExternalText: "external",
graphicCircleText: "Circle",
graphicSquareText: "Square",
graphicTriangleText: "Triangle",
graphicStarText: "Star",
graphicCrossText: "Cross",
graphicXText: "X",
graphicExternalText: "External",
urlText: "URL",
opacityText: "opacity",
opacityText: "Opacity",
symbolText: "Symbol",
sizeText: "Size",
rotationText: "Rotation"
Expand Down Expand Up @@ -289,13 +289,13 @@ GeoExt.Lang.add("en", {
},

"gxp.StrokeSymbolizer.prototype": {
solidStrokeName: "solid",
dashStrokeName: "dash",
dotStrokeName: "dot",
solidStrokeName: "Solid",
dashStrokeName: "Dash",
dotStrokeName: "Dot",
titleText: "Stroke",
styleText: "Style",
colorText: "Color",
widthText: "Width",
widthText: "Width (px)",
opacityText: "Opacity"
},

Expand Down
8 changes: 7 additions & 1 deletion src/script/plugins/VectorStyleWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,13 @@ gxp.plugins.VectorStyleWriter = Ext.extend(gxp.plugins.StyleWriter, {
if (feature.style) {
delete feature.style;
}
feature.style = newStyle.createSymbolizer(feature);
if (feature.featureType == 'text') {
// nasty fix for OL-Editor Labels (DrawText control)
feature.style = layer.styleMap.styles.defaultLabel.createSymbolizer(feature);

} else {
feature.style = newStyle.createSymbolizer(feature);
}
}
layer.drawFeature(feature);
} else {
Expand Down
60 changes: 34 additions & 26 deletions src/script/widgets/PointSymbolizer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* Copyright (c) 2008-2011 The Open Planning Project
*
*
* Published under the GPL license.
* See https://github.com/opengeo/gxp/raw/master/license.txt for the full text
* of the license.
*/

/**
/**
* @include widgets/FillSymbolizer.js
* @include widgets/StrokeSymbolizer.js
*/
Expand All @@ -20,7 +20,7 @@ Ext.namespace("gxp");

/** api: constructor
* .. class:: PointSymbolizer(config)
*
*
* Form for configuring a point symbolizer.
*/
gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
Expand All @@ -32,21 +32,21 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
* you do not want your symbolizer modified.
*/
symbolizer: null,

/** i18n */
graphicCircleText: "circle",
graphicSquareText: "square",
graphicTriangleText: "triangle",
graphicStarText: "star",
graphicCrossText: "cross",
graphicXText: "x",
graphicExternalText: "external",
graphicCircleText: "Circle",
graphicSquareText: "Square",
graphicTriangleText: "Triangle",
graphicStarText: "Star",
graphicCrossText: "Cross",
graphicXText: "X",
graphicExternalText: "External",
urlText: "URL",
opacityText: "opacity",
symbolText: "Symbol",
sizeText: "Size",
rotationText: "Rotation",

/** api: config[pointGraphics]
* ``Array``
* A list of objects to be used as the root of the data for a
Expand All @@ -67,31 +67,39 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
* ``false``, the value will be assumed to be a url for an external graphic.
*/
pointGraphics: null,

/** api: config[colorManager]
* ``Function``
* Optional color manager constructor to be used as a plugin for the color
* field.
*/
colorManager: null,

/** private: property[external]
* ``Boolean``
* Currently using an external graphic.
*/
external: null,

/** private: config[layout]
* ``String``
*/
layout: "form",

initComponent: function() {

if(!this.symbolizer) {
this.symbolizer = {};
}

}

// JvdB Use defaults when not set, otherwise fields in form are empty
if (!this.symbolizer["graphicName"]) {
this.symbolizer["graphicName"] = 'circle';
}
if (!this.symbolizer["rotation"]) {
this.symbolizer["rotation"] = 0;
}

if (!this.pointGraphics) {
this.pointGraphics = [
{display: this.graphicCircleText, value: "circle", mark: true},
Expand All @@ -103,7 +111,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
{display: this.graphicExternalText}
];
}

this.external = !!this.symbolizer["externalGraphic"];

this.markPanel = new Ext.Panel({
Expand Down Expand Up @@ -136,7 +144,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
}
}]
});

this.urlField = new Ext.form.TextField({
name: "url",
fieldLabel: this.urlText,
Expand All @@ -151,7 +159,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
},
width: 100 // TODO: push this to css
});

this.graphicPanel = new Ext.Panel({
border: false,
collapsed: !this.external,
Expand All @@ -176,7 +184,7 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
}
})
],
width: 100 // TODO: push this to css
width: 100 // TODO: push this to css
}]
});

Expand Down Expand Up @@ -277,12 +285,12 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
* updated.
*/
"change"
);
);

gxp.PointSymbolizer.superclass.initComponent.call(this);

},

updateGraphicDisplay: function() {
if(this.external) {
this.markPanel.collapse();
Expand All @@ -293,8 +301,8 @@ gxp.PointSymbolizer = Ext.extend(Ext.Panel, {
}
// TODO: window shadow fails to sync
}


});

/** api: xtype = gxp_pointsymbolizer */
Expand Down
Loading

0 comments on commit 66d03b3

Please sign in to comment.