org.zkoss.zkmax.zul.render.Menu2Default Maven / Gradle / Ivy
/* Menu2Default.java
{{IS_NOTE
Purpose:
Description:
History:
May 28, 2008 11:23:10 AM , Created by jumperchen
}}IS_NOTE
Copyright (C) 2008 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 3.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zkmax.zul.render;
import java.io.IOException;
import java.io.Writer;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.render.ComponentRenderer;
import org.zkoss.zk.ui.render.Out;
import org.zkoss.zk.ui.render.SmartWriter;
import org.zkoss.zul.Menu;
/**
* {@link Menu}'s default mold.
* @author jumperchen
* @since 3.5.0
*
*/
public class Menu2Default implements ComponentRenderer {
public void render(Component comp, Writer out) throws IOException {
final SmartWriter wh = new SmartWriter(out);
final Menu self = (Menu)comp;
final String uuid = self.getUuid();
final String zcls = self.getZclass();
final Execution exec = Executions.getCurrent();
if (self.isTopmost()) {
wh.write("");
wh.write(" 0)
wh.write("-text");
wh.write("-img");
}
wh.write("\" style=\"width: auto;\"> ");
wh.write("").write(self.getMenupopup()).write("
");
} else {
wh.write("\n")
.write(self.getImgTag());
new Out(self.getLabel()).render(out);
wh.write("")
.write(self.getMenupopup())
.writeln(" ");
}
}
}