Java 类com.google.gwt.user.client.ui.Hidden 实例源码

项目:unitimes    文件:CourseNumbersSuggestBox.java   
private String getConfiguration() {
    String conf = iConfiguration;
    for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) {
        Element element = DOM.getElementById(matcher.getGroup(1));
        String value = "";
        if ("select".equalsIgnoreCase(element.getTagName())) {
            ListBox list = ListBox.wrap(element);
            for (int i = 0; i < list.getItemCount(); i++) {
                if (list.isItemSelected(i))
                    value += (value.isEmpty() ? "" : ",") + list.getValue(i);
            }
        } else if ("input".equalsIgnoreCase(element.getTagName())) {
            TextBox text = TextBox.wrap(element);
            value = text.getText();
        } else {
            Hidden hidden = Hidden.wrap(element);
            value = hidden.getValue();
        }
        conf = conf.replace("${" + matcher.getGroup(1) + "}", value);
    }
    return conf;
}
项目:scheduling-portal    文件:SubmitWindow.java   
private Layout initVariablesActualForm() {
    // actual form used to POST
    variablesActualForm = new FormPanel();
    variablesActualForm.setMethod(FormPanel.METHOD_POST);
    variablesActualForm.setAction(URL_SUBMIT_XML);
    hiddenPane = new VerticalPanel();
    _fields = new Hidden[variables.size()];

    int i = 0;
    for (Entry<String, JobVariable> var : variables.entrySet()) {
        _fields[i] = new Hidden("var_" + var.getKey());
        hiddenPane.add(_fields[i]);
        i++;
    }

    hiddenPane.add(new Hidden("job", job));
    hiddenPane.add(new Hidden(SESSION_ID_PARAMETER_NAME, LoginModel.getInstance().getSessionId()));
    hiddenPane.add(validate);
    variablesActualForm.setWidget(hiddenPane);
    Layout fpanelWra = new Layout();
    fpanelWra.addMember(variablesActualForm);
    return fpanelWra;
}
项目:unitime    文件:CourseNumbersSuggestBox.java   
private String getConfiguration() {
    String conf = iConfiguration;
    for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) {
        Element element = DOM.getElementById(matcher.getGroup(1));
        String value = "";
        if ("select".equalsIgnoreCase(element.getTagName())) {
            ListBox list = ListBox.wrap(element);
            for (int i = 0; i < list.getItemCount(); i++) {
                if (list.isItemSelected(i))
                    value += (value.isEmpty() ? "" : ",") + list.getValue(i);
            }
        } else if ("input".equalsIgnoreCase(element.getTagName())) {
            TextBox text = TextBox.wrap(element);
            value = text.getText();
        } else {
            Hidden hidden = Hidden.wrap(element);
            value = hidden.getValue();
        }
        conf = conf.replace("${" + matcher.getGroup(1) + "}", value);
    }
    return conf;
}
项目:socom    文件:InfluenceAnswerFreeAudioView.java   
@Override
public void submitFile(ChangeType type, SafeUri action, SimpleEntry<String, String>... hiddenParameters) {
    this.answerForm.setAction(action);
    if (this.hiddenParams != null)
    {// remove old params from former upload..
        for(Hidden h: this.hiddenParams)
        {
            this.answerFormHiddenContainer.remove(h);
        }
        this.hiddenParams = null;           
    }
    // add new hidden params if given
    if (hiddenParameters != null)
    {
        this.hiddenParams = new LinkedList<Hidden>();
        for (int i = 0; i< hiddenParameters.length; i++)
        {
            SimpleEntry<String, String> e = hiddenParameters[i];
            Hidden ip = new Hidden(e.getKey(), e.getValue());
            hiddenParams.add(ip);
            this.answerFormHiddenContainer.add(ip);
        }
    }
    this.answerForm.submit();
}
项目:gwt-upload    文件:Upload.java   
/**
 * adds a javascript DOM element to the upload form at the specified position
 */
public void addElement(Element e, int index) {
  Widget w = null; 
  if (e.getTagName().toLowerCase().equals("input") && e.getAttribute("type").toLowerCase().equals("hidden")) {
    if (! Document.get().getBody().isOrHasChild(e)) {
      Document.get().getBody().appendChild(e);
    }
    w = Hidden.wrap(e);
  } else {
    w = new HTML();
    DOM.appendChild(w.getElement(), e);
  }
  uploader.add(w, index);
}
项目:gwt-upload    文件:SingleUploadSample.java   
public void onModuleLoad() {
  SingleUploader single1 = new SingleUploaderModal();
  single1.addOnFinishUploadHandler(onFinishUploaderHandler);

  // This enables php apc progress mechanism
  single1.add(new Hidden("APC_UPLOAD_PROGRESS", single1.getInputName()), 0);
  single1.avoidEmptyFiles(false);
  RootPanel.get("single1").add(single1);

  SingleUploader single2 = new SingleUploader(FileInputType.LABEL);
  single2.addOnFinishUploadHandler(onFinishUploaderHandler);
  RootPanel.get("single2").add(single2);

  SingleUploader single3 = new SingleUploader(FileInputType.LABEL);
  single3.setAutoSubmit(true);
  single3.setValidExtensions("jpg", "gif", "png");
  single3.addOnFinishUploadHandler(onFinishUploaderHandler);
  single3.getFileInput().getWidget().setStyleName("customButton"); 
  single3.getFileInput().getWidget().setSize("159px", "27px");
  single3.avoidRepeatFiles(true);
  RootPanel.get("single3").add(single3);

  RootPanel.get("thumbnails").add(panelImages);
}
项目:unitimes    文件:InstructorAvailabilityWidget.java   
public void insert(final RootPanel panel) {
    RPC.execute(InstructorAvailabilityRequest.load(null), new AsyncCallback<InstructorAvailabilityModel>() {
        @Override
        public void onFailure(Throwable caught) {
            UniTimeNotifications.error(caught);
        }

        @Override
        public void onSuccess(final InstructorAvailabilityModel model) {
            if (panel.getElement().getFirstChildElement() != null) {
                iPattern = Hidden.wrap(panel.getElement().getFirstChildElement());
                model.setPattern(iPattern.getValue());

                addValueChangeHandler(new ValueChangeHandler<RoomInterface.RoomSharingModel>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<RoomSharingModel> event) {
                        iPattern.setValue(event.getValue().toString());
                    }
                });
                iEditable = true;
            } else {
                String pattern = panel.getElement().getInnerText().trim();
                panel.getElement().setInnerText(null);
                model.setPattern(pattern);
                iEditable = false;
            }

            setModel(model);

            panel.add(InstructorAvailabilityWidget.this);
            panel.setVisible(true);             
        }
    });
}
项目:scheduling-portal    文件:SubmitWindow.java   
private void initSelectWorkflowFromFilePanel() {
    fromFilePanel = new VLayout();
    fromFilePanel.setHeight("30px");

    fileUpload = new FileUpload();
    fileUpload.setName("job");

    VerticalPanel formContent = new VerticalPanel();
    formContent.setHeight("30px");

    Hidden hiddenField = new Hidden();
    hiddenField.setName(SESSION_ID_PARAMETER_NAME);
    hiddenField.setValue(LoginModel.getInstance().getSessionId());
    formContent.add(hiddenField);
    formContent.add(fileUpload);

    final FormPanel importFromFileformPanel = new FormPanel();
    importFromFileformPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
    importFromFileformPanel.setMethod(FormPanel.METHOD_POST);
    importFromFileformPanel.setAction(URL_UPLOAD_FILE);
    importFromFileformPanel.add(formContent);
    importFromFileformPanel.addSubmitCompleteHandler(fileUploadCompleteHandler());
    importFromFileformPanel.setHeight("30px");
    fromFilePanel.addMember(importFromFileformPanel);

    sendFromFileButton = new Button("Upload file");
    sendFromFileButton.addClickHandler(clickHandlerForUploadFromFileButton(importFromFileformPanel));

}
项目:unitime    文件:InstructorAvailabilityWidget.java   
public void insert(final RootPanel panel) {
    RPC.execute(InstructorAvailabilityRequest.load(null), new AsyncCallback<InstructorAvailabilityModel>() {
        @Override
        public void onFailure(Throwable caught) {
            UniTimeNotifications.error(caught);
        }

        @Override
        public void onSuccess(final InstructorAvailabilityModel model) {
            if (panel.getElement().getFirstChildElement() != null) {
                iPattern = Hidden.wrap(panel.getElement().getFirstChildElement());
                model.setPattern(iPattern.getValue());

                addValueChangeHandler(new ValueChangeHandler<RoomInterface.RoomSharingModel>() {
                    @Override
                    public void onValueChange(ValueChangeEvent<RoomSharingModel> event) {
                        iPattern.setValue(event.getValue().toString());
                    }
                });
                iEditable = true;
            } else {
                String pattern = panel.getElement().getInnerText().trim();
                panel.getElement().setInnerText(null);
                model.setPattern(pattern);
                iEditable = false;
            }

            setModel(model);

            panel.add(InstructorAvailabilityWidget.this);
            panel.setVisible(true);             
        }
    });
}
项目:appformer    文件:FileUploadFormEncoder.java   
/**
 * Sets the encoding of the provided form to UTF-8, see
 * https://code.google.com/p/google-web-toolkit/issues/detail?id=4682 for
 * details.
 * @param form
 */
public void addUtf8Charset(final Form form) {
    FormElement.as(form.getElement()).setAcceptCharset("UTF-8");

    final Hidden field = new Hidden();
    field.setName("utf8char");
    field.setValue("\u8482");
    form.add(field);
}
项目:qafe-platform    文件:WindowFactory.java   
public static void clearWidgetFromMainPanel() {


        SimplePanel mainPanel = ClientApplicationContext.getInstance().getMainPanel();
        if (mainPanel!=null){
            Hidden hidden = new Hidden();
            mainPanel.setWidget(hidden);
        }
    }
项目:qafe-platform    文件:HiddenRenderer.java   
public UIObject render(ComponentGVO component, String uuid,String parent, String context) {
    Hidden uiObject = null;
    if (component != null) {
        if (component instanceof HiddenGVO) {
            HiddenGVO gvo = (HiddenGVO) component;
            uiObject = new QHidden();
            uiObject.setValue(gvo.getValue());
            RendererHelper.fillIn(component, uiObject, uuid,parent, context);   
        }
    }

    return uiObject;
}
项目:iambookmaster    文件:FeedbackPanel.java   
private  void submitFeedback() {
    formPanel.add(new Hidden(STORY_RATING,String.valueOf(story.getValue())));
    formPanel.add(new Hidden(COMPLEXITY_RATING,String.valueOf(complexity.getValue())));
    formPanel.add(new Hidden(APPEARENCE_RATING,String.valueOf(view.getValue())));
    formPanel.add(new Hidden(NOTE,note.getText().trim()));
    form.submit();
}
项目:QMAClone    文件:PanelSettingIcon.java   
public PanelSettingIcon() {
  setHorizontalAlignment(ALIGN_CENTER);
  add(new HTML("オリジナルアイコンをアップロードできます</br>" + "ファイルサイズは64KBまで</br>" + "画像形式はブラウザで表示可能なもの</br>"
      + "画像サイズは自動的に正方形に圧縮されて表示されます</br>" + "公序良俗に反する画像の使用はお止めください"));

  image.setPixelSize(96, 96);
  add(image);

  VerticalPanel panelForm = new VerticalPanel();

  Hidden hiddenUserCode = new Hidden();
  hiddenUserCode.setName(Constant.FORM_NAME_USER_CODE);
  hiddenUserCode.setValue(UserData.get().getUserCode() + "");
  panelForm.add(hiddenUserCode);

  fileUpload.setName(Constant.FORM_NAME_ICON);
  panelForm.add(fileUpload);

  form.setAction("icon");
  form.setEncoding(FormPanel.ENCODING_MULTIPART);
  form.setMethod(FormPanel.METHOD_POST);
  form.addSubmitCompleteHandler(this);
  form.setWidget(panelForm);
  add(form);

  add(buttonSubmit);

  htmlMessage.addStyleDependentName("settingMessage");
  add(htmlMessage);

  checkForm();
}
项目:gwt-upload    文件:MultipleUploadSample.java   
public void onModuleLoad() {
  // Attach the image viewer to the document
  RootPanel.get("thumbnails").add(panelImages);

  // Create a new uploader panel and attach it to the document
  MultiUploader defaultUploader = new MultiUploader();
  RootPanel.get("default").add(defaultUploader);


  // Add a finish handler which will load the image once the upload finishes
  defaultUploader.addOnFinishUploadHandler(onFinishUploaderHandler);
  defaultUploader.setMaximumFiles(3);
  defaultUploader.setFileInputPrefix("default");
  // You can add customized parameters to servlet call 
  defaultUploader.setServletPath(defaultUploader.getServletPath() + "?foo=bar");
  defaultUploader.avoidRepeatFiles(true);
  // This enables php apc progress mechanism
  defaultUploader.add(new Hidden("APC_UPLOAD_PROGRESS", defaultUploader.getInputName()));

  MultiUploader incubatorUploader = new MultiUploader(FileInputType.ANCHOR, new IncubatorUploadProgress());
  incubatorUploader.addOnFinishUploadHandler(onFinishUploaderHandler);
  incubatorUploader.setValidExtensions("jpg", "jpeg", "png", "gif");
  RootPanel.get("incubator").add(incubatorUploader);


  MultiUploader chismesUploader = new MultiUploader(FileInputType.BUTTON, new ChismesUploadProgress(false));//, new DecoratedFileInput(new GWTCButton()));
  chismesUploader.addOnFinishUploadHandler(onFinishUploaderHandler);
  RootPanel.get("chismes").add(chismesUploader);

  MUpld m = new MUpld();
  RootPanel.get("uibinder").add(m);
}
项目:gwt-upload    文件:MultiUploader.java   
public void onStatusChanged(IUploader uploader) {
  Uploader u = (Uploader) uploader;
  if (u.getStatus() == Status.CHANGED) {
    u.getFileInput().setVisible(false);
    u.getStatusWidget().setVisible(true);
  } else if (u.getStatus() == Status.SUBMITING) {
    // For security reasons, most browsers don't submit files if fileInput is hidden or has a size of 0,
    // so, before sending the form, it is necessary to show the fileInput, we put it out of the viewable
    // area.
    Widget w = u.getFileInput().getWidget();
    DOM.setStyleAttribute(w.getElement(), "position", "absolute");
    DOM.setStyleAttribute(w.getElement(), "left", "-4000px");
    u.getFileInput().setVisible(true);

    // Add the hidden input fields to the form being to submit 
    for (Widget i : formWidgets) {
      if (! (i instanceof IFileInput)) {
        if (i instanceof Hidden) {
          Hidden h = (Hidden)i;
          if (h.getValue().startsWith(fileInputPrefix)) {
            h.setValue(u.getInputName());
          }
        }
        u.add(i, 0);
      }
    }
  } else if (u.getStatus() == Status.REPEATED) {
    u.getFileInput().setVisible(true);
    u.getStatusWidget().setVisible(false);
  } else if (u.getStatus() == Status.INPROGRESS) {
    u.getFileInput().setVisible(false); 
  } else {
    // We don't need any more all the stuff related with the FormPanel when the upload has finished
    if (u.isFinished() && u.getForm().isAttached()) {
      u.getForm().removeFromParent();
    }
    u.getStatusWidget().setVisible(true);
    newUploaderInstance();
  }
}
项目:gwt-upload    文件:Uploader.java   
public void add(Widget w) {
  if (w instanceof Hidden) {
    formElements.insert(w, 0);     
  } else {
    formElements.add(w);        
  }
}
项目:gwt-upload    文件:SingleUploader.java   
@Override
protected void onFinishUpload() {
  super.onFinishUpload();
  if (getStatus() == Status.REPEATED) {
    getStatusWidget().setError(getI18NConstants().uploaderAlreadyDone());
  }
  getStatusWidget().setStatus(Status.UNINITIALIZED);
  reuse();
  assignNewNameToFileInput();
  for (Widget i : formWidgets) {
    if (i instanceof Hidden) {
      Hidden h = (Hidden)i;
      if (h.getValue().startsWith(fileInputPrefix)) {
        h.setValue(getInputName());
      }
    }
  }

  getFileInput().getWidget().setVisible(true);
  if (button != null) {
    setEnabledButton(true);
    button.removeStyleName("changed");
    if (!autoSubmit) {
      button.setVisible(true);
    } 
  }
  if (autoSubmit) {
    getFileInput().setText(i18nStrs.uploaderBrowse());
  }
}
项目:jcommerce    文件:ColumnPanel.java   
public Object getValue(String widgetName) {
        Widget widget = widgets.get(widgetName);
        if (widget instanceof NumberField) {
            return ((NumberField)widget).getValue();
        } else if (widget instanceof TextField) {
            return ((TextField)widget).getRawValue();
        } else if (widget instanceof TextBoxBase) {
            return ((TextBoxBase)widget).getText();
        } else if (widget instanceof ListBox) {
            return Utils.getSelectedValue((ListBox)widget);
        } else if (widget instanceof CheckBox) {
            return ((CheckBox)widget).isChecked();
        } else if (widget instanceof DateWidget) {
            return ((DateWidget)widget).getValue().getTime();
        } else if (widget instanceof ValueSelector) {
            return ((ValueSelector)widget).getValue();
        } else if (widget instanceof ChoicePanel){
            return ((ChoicePanel)widget).getValue();
        } else if (widget instanceof Hidden){
            return ((Hidden)widget).getValue();            
        } else if (widget instanceof MultiValueSelector) {
            return ((MultiValueSelector)widget).getValue();
        } else if (widget instanceof FileUploader) {
            return ((FileUploader)widget).getValue();
        } else if (widget instanceof RadioButton) {
            return ((RadioButton)widget).getText();
        } else if (widget instanceof RadioPanel) {
            return ((RadioPanel)widget).getValue();
//        } else if(widget instanceof DatePicker){
//          return ((DatePicker)widget).getValue();
        } else if (widget == null) {
            System.out.println("Widget not found: "+widgetName);
        } else {
            throw new RuntimeException("Unknown widget: "+widget.getClass().getName());
        }

        return null;
    }
项目:iambookmaster    文件:RemotePanel.java   
private void addParameter(String name, String value) {
    Hidden hidden = new Hidden(name);
    hidden.setValue(value);
    formElements.add(hidden);

}
项目:socom    文件:InfluenceAnswerFreeImageView.java   
@Override
public void submitFile(ChangeType type, SafeUri action, SimpleEntry<String, String>... hiddenParameters) {
    switch(type)
    {
    case file: 
        this.answerForm.setAction(action);
        // add new hidden params if given
        if (hiddenParameters != null)
        {
            for (int i = 0; i < hiddenParameters.length; i++)
            {
                SimpleEntry<String, String> e = hiddenParameters[i];
                Hidden ip = new Hidden(e.getKey(), e.getValue());
                this.answerFormHiddenContainer.add(ip);
            }
        }
        this.answerForm.submit();
        break;
    case file_drop: 
        uploader.setUploadURL(action.asString());
        JSONObject postParams = new JSONObject();
        for(SimpleEntry<String, String> se : hiddenParameters)
        {
            postParams.put(se.getKey(), new JSONString(se.getValue()));
        }
        uploader.setPostParams(postParams);
        uploader.startUpload();
        uploader.setUploadSuccessHandler(new UploadSuccessHandler() {

            @Override
            public boolean onUploadSuccess(UploadSuccessEvent uploadSuccessEvent) {
                fireEvent(new FormSubmitCompleteEvent(InfluenceAnswerFreeImageView.this, uploadSuccessEvent.getServerData()));
                return true;
            }
        });

        uploader.setUploadErrorHandler(new UploadErrorHandler() {
            @Override
            public boolean onUploadError(UploadErrorEvent uploadErrorEvent) {
                fireEvent(new FormSubmitCompleteEvent(InfluenceAnswerFreeImageView.this, uploadErrorEvent.getMessage()));
                return true;
            }
        });
        break;
    default:
        break;
    }
}
项目:jcommerce    文件:ColumnPanel.java   
public void setValue(String widgetName, Object value) {
        Widget widget = widgets.get(widgetName);        
        if (widget instanceof TextBoxBase) {
            ((TextBoxBase)widget).setText(value == null ? "" : value+"");
        } else if (widget instanceof ListBox) {
            Utils.setSelectedValue((ListBox)widget, value+"");
        } else if (widget instanceof TextField) {
            ((TextField)widget).setValue(value == null ? "" : value+"");
        } else if (widget instanceof RadioButton) {
            ((RadioButton)widget).setText(value == null ? "" : value+"");
        } else if (widget instanceof CheckBox) {
            ((CheckBox)widget).setChecked(value == null ? Boolean.FALSE : (Boolean)value);
        } else if (widget instanceof DateWidget) {          
            ((DateWidget)widget).setValue(value == null ? new java.util.Date():new java.util.Date((Long)value));
        } else if (widget instanceof ValueSelector) {
            ((ValueSelector)widget).setValue(value == null ? new Long(0) : (Long)value);
        } else if (widget instanceof ChoicePanel){
            ((ChoicePanel)widget).setSelectValue(String.valueOf(value));  
        } else if (widget instanceof Hidden){
            ((Hidden)widget).setValue(value==null?"":value+"");            
        } else if (widget instanceof MultiValueSelector) {
            ((MultiValueSelector)widget).setValue(value == null ? "" : value+"");
        } else if (widget instanceof FileUploader) {
            ((FileUploader)widget).setValue(value+"");
        } else if (widget instanceof Label){
            ((Label)widget).setText(String.valueOf(value));
        }else if(widget instanceof TextArea){
            ((TextArea)widget).setValue(value == null ? "" : value+"");
        }else if(widget instanceof RadioPanel){
            if (value != null) {
                ((RadioPanel)widget).setValue((Integer)value);
            }
//        }else if(widget instanceof DatePicker){
//          ((DatePicker)widget).setValue(value == null ? "" : value+"");
//        } else if (widget instanceof DecoratedTabPanel) {
        }else if (widget == null) {
            System.out.println("Widget not found: "+widgetName);
        } else {
            throw new RuntimeException("Unknown widget: "+widget.getClass().getName());
        }
    }
项目:ephesoft    文件:ImportBatchClassView.java   
/**
 * To get Import Existing.
 * 
 * @return Hidden
 */
public Hidden getImportExisting() {
    return importExisting;
}
项目:ephesoft    文件:ImportBatchClassView.java   
/**
 * To set Import Existing.
 * 
 * @param importExisting Hidden
 */
public void setImportExisting(Hidden importExisting) {
    this.importExisting = importExisting;
}