Updated Replace By Expression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@100116 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b73de5a16e
commit
056dab337f
|
@ -327,8 +327,6 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
parent.applyReplaceColumnByExpression(cConditionExpression,
|
parent.applyReplaceColumnByExpression(cConditionExpression,
|
||||||
value);
|
value);
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Error replace value",
|
|
||||||
"Insert a valid replace value!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,6 +348,7 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
ok = true;
|
ok = true;
|
||||||
break;
|
break;
|
||||||
case Geometry:
|
case Geometry:
|
||||||
|
try {
|
||||||
RegExp regExp = RegExp.compile(GEOMETRY_REGEXPR);
|
RegExp regExp = RegExp.compile(GEOMETRY_REGEXPR);
|
||||||
MatchResult matcher = regExp.exec(value);
|
MatchResult matcher = regExp.exec(value);
|
||||||
boolean matchFound = matcher != null;
|
boolean matchFound = matcher != null;
|
||||||
|
@ -358,12 +357,35 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
} else {
|
} else {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
UtilsGXT3.alert("Error replace value",
|
||||||
|
"Insert a valid replace value for Geometry type! ");
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Integer:
|
case Integer:
|
||||||
|
try {
|
||||||
Integer.parseInt(value);
|
Integer.parseInt(value);
|
||||||
|
} catch(Throwable e){
|
||||||
|
e.printStackTrace();
|
||||||
|
UtilsGXT3.alert("Error replace value",
|
||||||
|
"Insert a valid replace value for Integer type! ");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ok=true;
|
||||||
break;
|
break;
|
||||||
case Numeric:
|
case Numeric:
|
||||||
|
try {
|
||||||
Double.parseDouble(value);
|
Double.parseDouble(value);
|
||||||
|
} catch(Throwable e){
|
||||||
|
e.printStackTrace();
|
||||||
|
UtilsGXT3.alert("Error replace value",
|
||||||
|
"Insert a valid replace value for Numeric type! ");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ok=true;
|
||||||
break;
|
break;
|
||||||
case Text:
|
case Text:
|
||||||
ok = true;
|
ok = true;
|
||||||
|
@ -374,6 +396,10 @@ public class ReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
return ok;
|
return ok;
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
UtilsGXT3.alert("Error replace value",
|
||||||
|
"Insert a valid replace value! "+e.getLocalizedMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,5 +70,7 @@ public class DefaultAppearance implements IconButtonAppearance {
|
||||||
|
|
||||||
public void render(SafeHtmlBuilder sb) {
|
public void render(SafeHtmlBuilder sb) {
|
||||||
sb.append(template.template(style));
|
sb.append(template.template(style));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,43 @@
|
||||||
|
<!-- file: ./HelpReplaceByExp.html -->
|
||||||
|
<div>
|
||||||
|
<div class='HelpReplaceRegexClear'>
|
||||||
|
<h2>Replace Column By Expression</h2>
|
||||||
|
</div>
|
||||||
|
<div class='HelpReplaceRegexClear'>
|
||||||
|
<h3>Basic Example 1</h3>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<div class="{style.dataStyle}"></div>
|
||||||
|
<!-- <img class='HelpReplaceRegexImg' src='Data.png' width="200" height="155" alt=""> -->
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleConcat.png" width="705" height="484" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleConcatResultData.png" width="203" height="158" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleReplaceMatchingRegex.png" width="707" height="480" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleReplaceMatchingRegexResultData.png" width="204" height="155" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleSubstringByIndex.png" width="709" height="484" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleSubstringByIndexResultData.png" width="206" height="155" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="Simple2Concat.png" width="712" height="484" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="Simple2ConcatResultData.png" width="236" height="159" alt="">
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class='HelpReplaceRegexClear'>
|
||||||
|
<h3>Regular Expression</h3>
|
||||||
|
<p>
|
||||||
|
<a href="http://www.postgresql.org/docs/9.1/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP">POSIX Regular Expressions Reference</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,10 @@
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
.HelpReplaceRegexImg {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.HelpReplaceRegexClear {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.help;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Element;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.CssResource;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
import com.sencha.gxt.core.client.XTemplates;
|
||||||
|
import com.sencha.gxt.core.client.dom.XDOM;
|
||||||
|
import com.sencha.gxt.core.client.dom.XElement;
|
||||||
|
|
||||||
|
public class HelpReplaceColumnByExpression {
|
||||||
|
public interface HelpReplaceByExpTemplate extends XTemplates {
|
||||||
|
@XTemplate(source = "HelpReplaceByExp.html")
|
||||||
|
SafeHtml render(HelpReplaceByExpStyle style);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HelpReplaceByExpStyle extends CssResource {
|
||||||
|
@ClassName("HelpReplaceRegexImg")
|
||||||
|
public String getHelpReplaceRegexImg();
|
||||||
|
|
||||||
|
@ClassName("HelpReplaceRegexClear")
|
||||||
|
public String getHelpReplaceRegexClear();
|
||||||
|
|
||||||
|
|
||||||
|
@ClassName("DataStyle")
|
||||||
|
public String getDataStyle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private final HelpReplaceByExpStyle style;
|
||||||
|
private final HelpReplaceByExpTemplate template;
|
||||||
|
|
||||||
|
public interface HelpReplaceByExpResources extends ClientBundle {
|
||||||
|
public static final HelpReplaceByExpResources INSTANCE = GWT
|
||||||
|
.create(HelpReplaceByExpResources.class);
|
||||||
|
|
||||||
|
@Source("HelpReplaceByExpStyle.css")
|
||||||
|
HelpReplaceByExpStyle style();
|
||||||
|
|
||||||
|
@Source("Data.png")
|
||||||
|
ImageResource data();
|
||||||
|
|
||||||
|
|
||||||
|
@Source("SimpleConcat.png")
|
||||||
|
ImageResource simpleConcat();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public HelpReplaceColumnByExpression() {
|
||||||
|
this.style = HelpReplaceByExpResources.INSTANCE.style();
|
||||||
|
this.style.ensureInjected();
|
||||||
|
|
||||||
|
this.template = GWT.create(HelpReplaceByExpTemplate.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(SafeHtmlBuilder sb) {
|
||||||
|
sb.append(template.render(style));
|
||||||
|
XElement parent=XDOM.create(sb.toSafeHtml());
|
||||||
|
XElement element = parent.selectNode("." + style.getDataStyle());
|
||||||
|
Image image = new Image(HelpReplaceByExpResources.INSTANCE.data());
|
||||||
|
Element img = image.getElement();
|
||||||
|
element.appendChild(img);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderImg() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -14,8 +14,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class HelpReplaceColumnByExpressionDialog extends Window {
|
public class HelpReplaceColumnByExpressionDialog extends Window {
|
||||||
protected static final String WIDTH = "800px";
|
protected static final String WIDTH = "742px";
|
||||||
protected static final String HEIGHT = "600px";
|
protected static final String HEIGHT = "520px";
|
||||||
|
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
protected HelpReplaceColumnByExpressionPanel helpReplaceColumnByExpressionPanel;
|
protected HelpReplaceColumnByExpressionPanel helpReplaceColumnByExpressionPanel;
|
||||||
|
|
|
@ -3,6 +3,8 @@ package org.gcube.portlets.user.td.expressionwidget.client.help;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
|
@ -12,6 +14,7 @@ import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
@ -26,15 +29,17 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
*/
|
*/
|
||||||
public class HelpReplaceColumnByExpressionPanel extends FramedPanel {
|
public class HelpReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
protected static final String WIDTH = "698px";
|
protected static final String WIDTH = "700px";
|
||||||
protected static final String HEIGHT = "454px";
|
protected static final String HEIGHT = "404px";
|
||||||
|
protected static final String HELP_CONTENT_WIDTH = "700px";
|
||||||
|
protected static final String HELP_CONTENT_HEIGHT = "404px";
|
||||||
protected EventBus eventBus;
|
protected EventBus eventBus;
|
||||||
|
|
||||||
protected HelpReplaceColumnByExpressionDialog parent;
|
protected HelpReplaceColumnByExpressionDialog parent;
|
||||||
|
|
||||||
private TextButton btnClose;
|
private TextButton btnClose;
|
||||||
|
|
||||||
|
|
||||||
public HelpReplaceColumnByExpressionPanel(
|
public HelpReplaceColumnByExpressionPanel(
|
||||||
HelpReplaceColumnByExpressionDialog parent, EventBus eventBus) {
|
HelpReplaceColumnByExpressionDialog parent, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
|
@ -59,12 +64,25 @@ public class HelpReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
basicLayout.setAdjustForScroll(true);
|
basicLayout.setAdjustForScroll(true);
|
||||||
basicLayout.setScrollMode(ScrollMode.AUTO);
|
basicLayout.setScrollMode(ScrollMode.AUTO);
|
||||||
|
|
||||||
|
//
|
||||||
|
SimpleContainer helpContent=new SimpleContainer();
|
||||||
|
helpContent.setWidth(HELP_CONTENT_WIDTH);
|
||||||
|
helpContent.setHeight(HELP_CONTENT_HEIGHT);
|
||||||
|
|
||||||
|
VerticalLayoutContainer helpContentLayout=new VerticalLayoutContainer();
|
||||||
|
helpContent.add(helpContentLayout);
|
||||||
|
SafeHtmlBuilder safeHelp=new SafeHtmlBuilder();
|
||||||
|
HelpReplaceColumnByExpression helpR=new HelpReplaceColumnByExpression();
|
||||||
|
helpR.render(safeHelp);
|
||||||
|
HTML htmlHelp=new HTML();
|
||||||
|
htmlHelp.setHTML(safeHelp.toSafeHtml());
|
||||||
|
helpContentLayout.add(htmlHelp);
|
||||||
|
|
||||||
|
//
|
||||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
//
|
|
||||||
|
|
||||||
btnClose = new TextButton("Close");
|
btnClose = new TextButton("Close");
|
||||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||||
|
@ -80,8 +98,8 @@ public class HelpReplaceColumnByExpressionPanel extends FramedPanel {
|
||||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
// Add to basic layout
|
// Add to basic layout
|
||||||
//basicLayout.add(properties, new VerticalLayoutData(-1, -1, new Margins(
|
basicLayout.add(helpContent, new VerticalLayoutData(-1, -1, new Margins(
|
||||||
// 1)));
|
1)));
|
||||||
|
|
||||||
basicLayout.add(flowButton, new VerticalLayoutData(-1, 36, new Margins(
|
basicLayout.add(flowButton, new VerticalLayoutData(-1, 36, new Margins(
|
||||||
5, 2, 5, 2)));
|
5, 2, 5, 2)));
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.client.help;
|
|
||||||
|
|
||||||
|
|
||||||
public class HelpTemplate {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,42 @@
|
||||||
|
<!-- file: ./HelpReplaceByExp.html -->
|
||||||
|
<div>
|
||||||
|
<div class='HelpReplaceRegexClear'>
|
||||||
|
<h2>Replace Column By Expression</h2>
|
||||||
|
</div>
|
||||||
|
<div class='HelpReplaceRegexClear'>
|
||||||
|
<h3>Basic Example 1</h3>
|
||||||
|
<p>
|
||||||
|
<img class='HelpReplaceRegexImg' src='Data.png' width="200" height="155" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleConcat.png" width="705" height="484" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleConcatResultData.png" width="203" height="158" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleReplaceMatchingRegex.png" width="707" height="480" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleReplaceMatchingRegexResultData.png" width="204" height="155" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleSubstringByIndex.png" width="709" height="484" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="SimpleSubstringByIndexResultData.png" width="206" height="155" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="Simple2Concat.png" width="712" height="484" alt="">
|
||||||
|
</p>
|
||||||
|
<p class='HelpReplaceRegexClear'>
|
||||||
|
<img class='HelpReplaceRegexImg' src="Simple2ConcatResultData.png" width="236" height="159" alt="">
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class='HelpReplaceRegexClear'>
|
||||||
|
<h3>Regular Expression</h3>
|
||||||
|
<p>
|
||||||
|
<a href="http://www.postgresql.org/docs/9.1/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP">POSIX Regular Expressions Reference</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,10 @@
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
.HelpReplaceRegexImg {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.HelpReplaceRegexClear {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue