コード例 #1
0
 public void encodeEnd(IPanelPopup panelPopup, IResponseWriter writer) throws IOException {
   boolean clientSide = panelPopup.isClientSide();
   String clientId = panelPopup.getClientId();
   if (clientSide) {
     writer.startElement(INPUT_ELEM, panelPopup);
     writer.writeAttribute(TYPE_ATTR, "hidden");
     writer.writeAttribute(ID_ATTR, clientId + "_hidden");
     writer.writeAttribute(
         VALUE_ATTR, panelPopup.isClientSide() ? "false" : String.valueOf(panelPopup.isVisible()));
     writer.writeAttribute(NAME_ATTR, clientId + "_hidden");
     writer.endElement(INPUT_ELEM);
   }
   writer.endElement(DIV_ELEM);
   writer.endElement(DIV_ELEM);
   encodeScript(panelPopup, writer);
   writer.endElement(DIV_ELEM);
 }
コード例 #2
0
 public void encodeScript(IPanelPopup panelPopup, IResponseWriter writer) throws IOException {
   String clientId = panelPopup.getClientId();
   writer.startElement(DIV_ELEM, panelPopup);
   writer.writeAttribute(ID_ATTR, clientId + "_scrDiv");
   writer.writeAttribute(CLASS_ATTR, "mobi-hidden");
   writer.startElement(SPAN_ELEM, panelPopup);
   writer.writeAttribute(ID_ATTR, clientId + "_scrSpan");
   writer.startElement("script", null);
   writer.writeAttribute("type", "text/javascript");
   StringBuilder builder = new StringBuilder(255);
   boolean disabled = panelPopup.isDisabled();
   if (disabled && !panelPopup.isClientSide()) {
     panelPopup.setVisible(false);
   }
   builder
       .append("ice.mobi.panelPopup.init('")
       .append(clientId)
       .append("', {visible: ")
       .append(panelPopup.isVisible())
       .append(", autocenter: ")
       .append(panelPopup.isAutoCenter())
       .append(", client: ")
       .append(panelPopup.isClientSide())
       .append(", id: '")
       .append(panelPopup.getId())
       .append("'");
   if (panelPopup.getWidth() != Integer.MIN_VALUE) {
     builder.append(", width: ").append(panelPopup.getWidth());
   }
   if (panelPopup.getHeight() != Integer.MIN_VALUE) {
     builder.append(", height: ").append(panelPopup.getHeight());
   }
   if (null != panelPopup.getStyleClass()) {
     builder.append(", sclass: '").append(panelPopup.getStyleClass()).append("'");
   }
   if (panelPopup.getStyle() != null) {
     builder.append(", style: '").append(panelPopup.getStyle()).append("'");
   }
   if (disabled) {
     builder.append(", disabled: ").append(panelPopup.isDisabled());
   }
   builder.append("});");
   writer.write(builder.toString());
   writer.endElement("script");
   writer.endElement(SPAN_ELEM);
   writer.endElement(DIV_ELEM);
 }
コード例 #3
0
 public void encodeBegin(IPanelPopup component, IResponseWriter writer) throws IOException {
   IPanelPopup panelPopup = (IPanelPopup) component;
   boolean visible = panelPopup.isVisible();
   String clientId = panelPopup.getClientId();
   writer.startElement(DIV_ELEM, component);
   writer.writeAttribute(ID_ATTR, clientId);
   StringBuilder popupBaseClass = new StringBuilder(IPanelPopup.HIDDEN_CONTAINER_CLASS);
   StringBuilder popupBGClass = new StringBuilder(IPanelPopup.BLACKOUT_PNL_HIDDEN_CLASS);
   // leave user class appending here, but it's actually done in js
   if (visible) {
     popupBaseClass = new StringBuilder(IPanelPopup.CONTAINER_CLASS);
     popupBGClass = new StringBuilder(IPanelPopup.BLACKOUT_PNL_CLASS);
   }
   String userClass = panelPopup.getStyleClass();
   if (null != userClass) {
     //  popupBGClass.append(String.valueOf(userClass));
     popupBaseClass.append(userClass);
   }
   writer.startElement(DIV_ELEM, component);
   writer.writeAttribute(ID_ATTR, clientId + "_wrp");
   // div that is use to hide/show the popup screen black out--will manipulate using js
   writer.startElement(DIV_ELEM, component);
   writer.writeAttribute(ID_ATTR, clientId + "_bg");
   writer.writeAttribute(CLASS_ATTR, popupBGClass.toString());
   writer.endElement(DIV_ELEM);
   // panel
   writer.startElement(DIV_ELEM, component);
   writer.writeAttribute(ID_ATTR, clientId + "_popup");
   writer.writeAttribute("class", popupBaseClass.toString());
   if (null != panelPopup.getStyle()) {
     writer.writeAttribute(STYLE_ATTR, panelPopup.getStyle());
   }
 }