IDEMPIERE-2077 Go to the HTML tab of WTextEditorDialog when a field IsHtml is checked in the window / based on patch from Nicolas Micoud (nmicoud)

This commit is contained in:
Carlos Ruiz 2014-07-23 10:05:25 -05:00
parent 33120387c2
commit afb8d58ef6
2 changed files with 20 additions and 5 deletions

View File

@ -233,8 +233,16 @@ public class WStringEditor extends WEditor implements ContextMenuListener
else if (WEditorPopupMenu.EDITOR_EVENT.equals(evt.getContextEvent())) else if (WEditorPopupMenu.EDITOR_EVENT.equals(evt.getContextEvent()))
{ {
adwindowContent = findADWindowContent(); adwindowContent = findADWindowContent();
boolean isHtml = false;
if (( gridField.getDisplayType() == DisplayType.Text
|| gridField.getDisplayType() == DisplayType.TextLong
|| gridField.getDisplayType() == DisplayType.Memo)
&& adwindowContent != null
&& adwindowContent.getActiveGridTab() != null) {
isHtml = adwindowContent.getActiveGridTab().getValueAsBoolean("IsHtml");
}
final WTextEditorDialog dialog = new WTextEditorDialog(gridField.getVO().Header, getDisplay(), final WTextEditorDialog dialog = new WTextEditorDialog(gridField.getVO().Header, getDisplay(),
isReadWrite(), gridField.getFieldLength()); isReadWrite(), gridField.getFieldLength(), isHtml);
dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() { dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener<Event>() {
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {

View File

@ -38,11 +38,11 @@ import org.zkoss.zul.Vlayout;
* *
*/ */
public class WTextEditorDialog extends Window implements EventListener<Event>{ public class WTextEditorDialog extends Window implements EventListener<Event>{
/** /**
* *
*/ */
private static final long serialVersionUID = -3852236029054284848L; private static final long serialVersionUID = 1188165765430615546L;
private boolean editable; private boolean editable;
private int maxSize; private int maxSize;
private String text; private String text;
@ -59,8 +59,9 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
* @param text * @param text
* @param editable * @param editable
* @param maxSize * @param maxSize
* @param isHtml - select the html tab at start
*/ */
public WTextEditorDialog(String title, String text, boolean editable, int maxSize) { public WTextEditorDialog(String title, String text, boolean editable, int maxSize, boolean IsHtml) {
super(); super();
setTitle(title); setTitle(title);
this.editable = editable; this.editable = editable;
@ -68,6 +69,12 @@ public class WTextEditorDialog extends Window implements EventListener<Event>{
this.text = text; this.text = text;
init(); init();
if (IsHtml)
tabbox.setSelectedTab(htmlTab);
}
public WTextEditorDialog(String title, String text, boolean editable, int maxSize) {
this(title, text, editable, maxSize, false);
} }
private void init() { private void init() {