Java Examples for org.zkoss.zul.Html

The following java examples will help you to understand the usage of org.zkoss.zul.Html. These source code samples are taken from different open source projects.

Example 1
Project: org.opensixen.server.zkwebui-master  File: ProcessDialog.java View source code
//	ProcessDialog
private void initComponents() {
    this.setStyle("position: absolute; width: 100%; height: 100%");
    Borderlayout layout = new Borderlayout();
    layout.setStyle("position: absolute; width: 100%; height: 100%; border: none;");
    messageDiv = new Div();
    message = new Html();
    messageDiv.appendChild(message);
    messageDiv.setStyle(MESSAGE_DIV_STYLE);
    north = new North();
    north.appendChild(messageDiv);
    layout.appendChild(north);
    north.setAutoscroll(true);
    north.setStyle("border: none;");
    centerPanel = new Panel();
    center = new Center();
    layout.appendChild(center);
    center.appendChild(centerPanel);
    center.setFlex(true);
    center.setAutoscroll(true);
    center.setStyle("border: none");
    Div div = new Div();
    div.setAlign("center");
    Hbox hbox = new Hbox();
    String label = Msg.getMsg(Env.getCtx(), "Start");
    bOK = new Button(label.replaceAll("&", ""));
    bOK.setImage("/images/Ok16.png");
    bOK.setId("Ok");
    bOK.addEventListener(Events.ON_CLICK, this);
    bOK.setSclass("action-button");
    hbox.appendChild(bOK);
    label = Msg.getMsg(Env.getCtx(), "Cancel");
    Button btn = new Button(label.replaceAll("&", ""));
    btn.setImage("/images/Cancel16.png");
    btn.setId("Cancel");
    btn.addEventListener(Events.ON_CLICK, this);
    btn.setSclass("action-button");
    hbox.appendChild(btn);
    div.appendChild(hbox);
    div.setStyle("padding: 10px");
    South south = new South();
    layout.appendChild(south);
    south.appendChild(div);
    this.appendChild(layout);
}
Example 2
Project: dbvim-master  File: HtmlRules.java View source code
/* (non-Javadoc)
	 * @see org.sinnlabs.dbvim.rules.engine.IRulable#getSpecialProperty(org.zkoss.zk.ui.Component, java.lang.String, org.sinnlabs.dbvim.zk.model.IDeveloperStudio)
	 */
@Override
public Component getSpecialProperty(Component cmp, String name, IDeveloperStudio developer) {
    if (name.equals("content")) {
        final IDeveloperStudio dev = developer;
        final Html html = (Html) cmp;
        // Create content property UI
        final Hlayout layout = new Hlayout();
        final Textbox txtContent = new Textbox();
        final Button btnExtend = new Button();
        txtContent.setMaxlength(0);
        txtContent.setRawValue(html.getContent());
        txtContent.setHflex("1");
        txtContent.setMultiline(true);
        txtContent.setRows(3);
        btnExtend.setLabel("...");
        layout.appendChild(txtContent);
        layout.appendChild(btnExtend);
        layout.setVflex("1");
        // Create event listeners
        EventListener<Event> txtEvent = new EventListener<Event>() {

            private Html cmp = html;

            @Override
            public void onEvent(Event arg0) throws Exception {
                cmp.setContent(txtContent.getText());
            }
        };
        txtContent.addEventListener(Events.ON_CHANGE, txtEvent);
        txtContent.addEventListener(Events.ON_OK, txtEvent);
        EventListener<Event> btnClick = new EventListener<Event>() {

            @Override
            public void onEvent(Event arg0) throws Exception {
                ExpandWindow expandBox = new ExpandWindow();
                CloseExpandBoxEventListener listener = new CloseExpandBoxEventListener(html, txtContent);
                expandBox.setTitle("Content");
                expandBox.setMode(CodeMirror.TEXT_HTML);
                expandBox.setText(txtContent.getText());
                expandBox.addEventListener(Events.ON_CLOSE, listener);
                expandBox.setPosition("center");
                dev.getDesigner().appendChild(expandBox);
                expandBox.doOverlapped();
            }
        };
        btnExtend.addEventListener(Events.ON_CLICK, btnClick);
        return layout;
    }
    return null;
}
Example 3
Project: opensearchserver-master  File: ResultDocumentController.java View source code
@Command
public void explainScore(@BindingParam("document") Document document) throws SearchLibException, InterruptedException, IOException, ParseException, SyntaxError {
    Client client = getClient();
    if (client == null)
        return;
    ResultDocumentsInterface<?> result = getResultDocuments();
    if (result == null)
        return;
    int docId = document.getDocId();
    String explanation = client.explain(result.getRequest(), docId, true);
    Window win = (Window) Executions.createComponents("/WEB-INF/zul/query/result/explanation.zul", null, null);
    Html html = (Html) win.getFellow("htmlExplain", true);
    html.setContent(explanation);
    win.doModal();
}
Example 4
Project: carewebframework-core-master  File: ZKUtil.java View source code
/**
     * Returns a component of a type suitable for displaying the specified text. For text that is a
     * URL, returns an anchor. For text that begins with <html>, returns an HTML component.
     * All other text returns a label.
     * 
     * @param text Text to be displayed.
     * @return Component of the appropriate type.
     */
public static XulElement getTextComponent(String text) {
    String frag = text == null ? "" : StringUtils.substring(text, 0, 20).toLowerCase();
    if (frag.contains("<html>")) {
        return new Html(text);
    }
    if (frag.matches("^https?:\\/\\/.+$")) {
        A anchor = new A(text);
        anchor.setHref(text);
        anchor.setTarget("_blank");
        return anchor;
    }
    return new Label(text);
}
Example 5
Project: java_learn-master  File: InitApplicationCtrl.java View source code
/**
	 * Add a new row to the grid.<br>
	 * 
	 * @param rowParent
	 * @param tableName
	 * @param value
	 */
private void addNewRow(Rows rowParent, String tableName, Object value) {
    Row row = new Row();
    Html html_TableName = new Html(tableName);
    html_TableName.setStyle("padding-left: 5px;");
    Div divKey = new Div();
    divKey.setAlign("left");
    divKey.appendChild(html_TableName);
    Html html_RecordCount = null;
    if (value instanceof BigDecimal) {
        BigDecimal myDec = (BigDecimal) value;
        myDec = myDec.setScale(2, BigDecimal.ROUND_HALF_UP);
        // Format the value to money
        NumberFormat formatter = new DecimalFormat("#,##0.00");
        String money = formatter.format(myDec);
        html_RecordCount = new Html(money);
    } else if (value instanceof Integer) {
        // Format the value
        NumberFormat formatter = new DecimalFormat("###,###.###");
        String formattedInteger = formatter.format(value);
        html_RecordCount = new Html(String.valueOf(value));
    } else
        html_RecordCount = new Html(String.valueOf(value));
    html_RecordCount.setStyle("padding-right: 5px;");
    Div divValue = new Div();
    divValue.setAlign("right");
    divValue.appendChild(html_RecordCount);
    row.appendChild(divKey);
    row.appendChild(divValue);
    row.setParent(rowParent);
}