0

Center a window with ckeditor

asked 2012-05-24 14:55:16 +0800

Neus gravatar image Neus
1415 14

Hi,
I'm trying to center a window with a ckeditor but it doesn't work.
The window doesn't have a height specified. Is the ckeditor that have it. I can't set a height to window because ckeditor height is changed by code and window must fit its content.
Here an example

ZKFiddle-Link

Test.java
package j1ckl78d$v1;

import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;

public class Test extends GenericForwardComposer{
public Window ventana;
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
ventana.setPosition("center");

}

public void onClick$btn(Event e) throws InterruptedException{
ventana.setPosition("center");
}
}


test.zul
<zk>
<window id="ventana" border="normal" sizable="true" closable="true" width="850px" position="center" title="hello" apply="j1ckl78d$v1.Test">

<ckeditor id="ck" height="320px"/>
<button id="btn" label="click"/>
</window>
</zk>

TestComposer.java
package j1ckl78d$v1;

import org.zkoss.zk.ui.*;
import org.zkoss.zk.ui.event.*;
import org.zkoss.zk.ui.util.*;
import org.zkoss.zk.ui.ext.*;
import org.zkoss.zk.au.*;
import org.zkoss.zk.au.out.*;
import org.zkoss.zul.*;

public class TestComposer extends GenericForwardComposer{

public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);

}

public void onClick$btn(Event e) throws InterruptedException{
Window ventana;
ventana = (Window)Executions.createComponents("test.zul",null,null);
ventana.doModal();
}
}


index.zul
<zk>
<window border="normal" title="hello" apply="j1ckl78d$v1.TestComposer">

<button id="btn" label="Click Me To Open Centered Window" />
</window>
</zk>

Any idea? What can I do?
I tried to center the window on doAfterCompose() and on window onCreate() but with no good result.

Thank you!

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-05-24 14:56:35 +0800

Neus gravatar image Neus
1415 14

Oops, fiddle doesn't look well...
Here the link: http://zkfiddle.org/sample/1ckl78d/2-Centered-window-with-ckeditor

link publish delete flag offensive edit

answered 2012-05-28 08:07:13 +0800

vincentjian gravatar image vincentjian
2245 6

Hi Neus,

It is timing issue.
You can specify height to window and using vflex in ckez component.

<zk>
  <window id="ventana" border="normal" sizable="true" closable="true" width="850px" height="350px" position="center" title="hello" apply="forum.Test">

    <ckeditor id="ck" vflex="1"/>
    <button id="btn" label="click to center"/>
  </window>
</zk>

link publish delete flag offensive edit

answered 2012-05-29 07:00:11 +0800

Neus gravatar image Neus
1415 14

If I specify vflex in ckeditor It says: Method setVflex not found for class org.zkforge.ckez.CKeditor

link publish delete flag offensive edit

answered 2012-05-29 09:20:37 +0800

vincentjian gravatar image vincentjian
2245 6

Hi Neus,

Please try using latest version of CKeditor in your local machine, it has some problem on ZK fiddle.

link publish delete flag offensive edit

answered 2012-05-30 10:57:18 +0800

Neus gravatar image Neus
1415 14

Thank you it works!

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-05-24 14:55:16 +0800

Seen: 171 times

Last updated: May 30 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More