Java Code Examples for com.google.gwt.user.client.ui.Hidden

The following are top voted examples for showing how to use com.google.gwt.user.client.ui.Hidden. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: unitimes   File: CourseNumbersSuggestBox.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 2
Project: scheduling-portal   File: SubmitWindow.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 3
Project: unitime   File: CourseNumbersSuggestBox.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 4
Project: socom   File: InfluenceAnswerFreeAudioView.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 5
Project: gwt-upload   File: Upload.java   Source Code and License 6 votes vote down vote up
/**
 * 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);
}
 
Example 6
Project: gwt-upload   File: SingleUploadSample.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 7
Project: unitimes   File: InstructorAvailabilityWidget.java   Source Code and License 5 votes vote down vote up
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);				
		}
	});
}
 
Example 8
Project: scheduling-portal   File: SubmitWindow.java   Source Code and License 5 votes vote down vote up
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));

}
 
Example 9
Project: unitime   File: InstructorAvailabilityWidget.java   Source Code and License 5 votes vote down vote up
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);				
		}
	});
}
 
Example 10
Project: appformer   File: FileUploadFormEncoder.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
}
 
Example 11
Project: qafe-platform   File: WindowFactory.java   Source Code and License 5 votes vote down vote up
public static void clearWidgetFromMainPanel() {


		SimplePanel mainPanel = ClientApplicationContext.getInstance().getMainPanel();
		if (mainPanel!=null){
			Hidden hidden = new Hidden();
			mainPanel.setWidget(hidden);
		}
	}
 
Example 12
Project: qafe-platform   File: HiddenRenderer.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 13
Project: iambookmaster   File: FeedbackPanel.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 14
Project: QMAClone   File: PanelSettingIcon.java   Source Code and License 5 votes vote down vote up
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();
}
 
Example 15
Project: gwt-upload   File: MultipleUploadSample.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 16
Project: gwt-upload   File: MultiUploader.java   Source Code and License 5 votes vote down vote up
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();
  }
}
 
Example 17
Project: gwt-upload   File: Uploader.java   Source Code and License 5 votes vote down vote up
public void add(Widget w) {
  if (w instanceof Hidden) {
    formElements.insert(w, 0);     
  } else {
    formElements.add(w);        
  }
}
 
Example 18
Project: gwt-upload   File: SingleUploader.java   Source Code and License 5 votes vote down vote up
@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());
  }
}
 
Example 19
Project: jcommerce   File: ColumnPanel.java   Source Code and License 5 votes vote down vote up
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;
    }
 
Example 20
Project: iambookmaster   File: RemotePanel.java   Source Code and License 4 votes vote down vote up
private void addParameter(String name, String value) {
	Hidden hidden = new Hidden(name);
	hidden.setValue(value);
	formElements.add(hidden);
	
}
 
Example 21
Project: socom   File: InfluenceAnswerFreeImageView.java   Source Code and License 4 votes vote down vote up
@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;
	}
}
 
Example 22
Project: jcommerce   File: ColumnPanel.java   Source Code and License 4 votes vote down vote up
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());
        }
    }
 
Example 23
Project: ephesoft   File: ImportBatchClassView.java   Source Code and License 2 votes vote down vote up
/**
 * To get Import Existing.
 * 
 * @return Hidden
 */
public Hidden getImportExisting() {
	return importExisting;
}
 
Example 24
Project: ephesoft   File: ImportBatchClassView.java   Source Code and License 1 votes vote down vote up
/**
 * To set Import Existing.
 * 
 * @param importExisting Hidden
 */
public void setImportExisting(Hidden importExisting) {
	this.importExisting = importExisting;
}