Skip to content
Snippets Groups Projects
Commit 5c00606d authored by srosse's avatar srosse
Browse files

OO-3938: open new window with standard link

parent bdfd7eb9
No related branches found
No related tags found
No related merge requests found
......@@ -142,6 +142,9 @@ public class FormLinkImpl extends FormItemImpl implements FormLink {
@Override
public void setNewWindow(boolean openInNewWindow) {
newWindow = openInNewWindow;
if(component != null) {
component.setNewWindow(openInNewWindow);
}
}
@Override
......@@ -219,6 +222,8 @@ public class FormLinkImpl extends FormItemImpl implements FormLink {
component.setElementCssClass(getElementCssClass());
component.setTitle(title);
component.setForceFlexiDirtyFormWarning(ownDirtyFormWarning);
component.setPopup(popup);
component.setNewWindow(newWindow);
if(textReasonForDisabling != null) {
component.setTextReasonForDisabling(textReasonForDisabling);
}
......
......@@ -109,6 +109,7 @@ public class Link extends AbstractComponent {
private boolean forceFlexiDirtyFormWarning = false;
private Badge badge;
private boolean newWindow;
private LinkPopupSettings popup;
/**
......@@ -263,6 +264,14 @@ public class Link extends AbstractComponent {
this.popup = popup;
}
public boolean isNewWindow() {
return newWindow;
}
public void setNewWindow(boolean newWindow) {
this.newWindow = newWindow;
}
public Badge getBadge() {
return badge;
}
......
......@@ -198,6 +198,13 @@ public class LinkRenderer extends DefaultComponentRenderer {
} catch(IOException e) {
log.error("", e);
}
} else if(link.isNewWindow()) {
try(StringOutput href = new StringOutput()) {
ubu.buildURI(href, new String[] { VelocityContainer.COMMAND_ID }, new String[] { command }, null, AJAXFlags.MODE_NORMAL);
sb.append("href=\"javascript:;\" onclick=\"o_openTab('").append(href).append("'); return false;\" ");
} catch(IOException e) {
log.error("", e);
}
} else {
// a link may force a non ajax-mode and a custom targ
boolean iframePostEnabled = flags.isIframePostEnabled() && link.isAjaxEnabled() && link.getTarget() == null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment