当前位置: 首页>>代码示例>>Java>>正文


Java RichTextArea类代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.RichTextArea的典型用法代码示例。如果您正苦于以下问题:Java RichTextArea类的具体用法?Java RichTextArea怎么用?Java RichTextArea使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RichTextArea类属于com.google.gwt.user.client.ui包,在下文中一共展示了RichTextArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onInitialize

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
/**
 * Initialize this example.
 */
@ShowcaseSource
@Override
public Widget onInitialize() {
  // Create the text area and toolbar
  RichTextArea area = new RichTextArea();
  area.ensureDebugId("cwRichText-area");
  area.setSize("100%", "14em");
  RichTextToolbar toolbar = new RichTextToolbar(area);
  toolbar.ensureDebugId("cwRichText-toolbar");
  toolbar.setWidth("100%");

  // Add the components to a panel
  Grid grid = new Grid(2, 1);
  grid.setStyleName("cw-RichText");
  grid.setWidget(0, 0, toolbar);
  grid.setWidget(1, 0, area);
  return grid;
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:22,代码来源:CwRichText.java

示例2: onRender

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
protected void onRender(Element parent, int index) {
        super.onRender(parent, index);
        
        final RichTextArea area = new RichTextArea();
        area.setSize("1000", "600");
        new OrderService().getOrderTemplate(new OrderService.Listener() {
            public void onSuccess(String content) {
                area.setHTML(content);
            }
        });
        RichTextToolbar toolbar = new RichTextToolbar(area);
//        toolbar.setWidth("100%");

        // Add the components to a panel
        Grid grid = new Grid(2, 1);
        grid.setStyleName("cw-RichText");
        grid.setWidget(0, 0, toolbar);
        grid.setWidget(1, 0, area);
//        grid.setSize("100%", "100%");
        add(grid);
        
        Button button = new Button("Save");
        add(button);
    }
 
开发者ID:jbosschina,项目名称:jcommerce,代码行数:25,代码来源:PrintTemplatePanel.java

示例3: setFont

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
public void setFont(final String fontName, final RichTextArea.FontSize fontSize) {
   Scheduler.get().scheduleFixedDelay(new Scheduler.RepeatingCommand() { // Need a delay for Firefox browser
      @Override
      public boolean execute() {
         rta.getFormatter().setFontName(fontName);

         if (fontSize != null) {
            rta.getFormatter().setFontSize(fontSize);
         }

         return false;
      }
   }, 100);
}
 
开发者ID:vkazhdan,项目名称:vaadin-crichtextarea,代码行数:15,代码来源:CVRichTextArea.java

示例4: addTextArea

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public HasHTML addTextArea(final RichTextElementDTO richTextElement, final FoldPanel sectionPanel, final boolean draftMode) {

	if (draftMode) {

		final RichTextArea textArea = new RichTextArea();

		textArea.setHTML(richTextElement.getText());
		textArea.addFocusHandler(new FocusHandler() {

			@Override
			public void onFocus(FocusEvent event) {
				globalFormatterArray[0] = textArea.getFormatter();
			}
		});

		sectionPanel.add(textArea);
		return textArea;

	} else {

		final HTML html = new HTML();
		final String value = richTextElement.getText();

		if (ClientUtils.isBlank(value)) {
			html.setText(I18N.CONSTANTS.reportEmptySection());
			html.addStyleName(STYLE_PROJECT_REPORT_FIELD_EMPTY);

		} else {
			html.setHTML(value);
			html.addStyleName(STYLE_PROJECT_REPORT_FIELD);
		}

		sectionPanel.add(html);
		return null;
	}
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:41,代码来源:ReportsView.java

示例5: addKeyQuestion

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public HasHTML addKeyQuestion(final KeyQuestionDTO keyQuestion, final FoldPanel sectionPanel, final boolean draftMode) {

	keyQuestionState.increaseCount();

	keyQuestion.setNumber(keyQuestionState.getCount());

	// Rich text field.
	final RichTextArea textArea = new RichTextArea();
	final RichTextElementDTO richTextElementDTO = keyQuestion.getRichTextElementDTO();

	if (richTextElementDTO != null) {
		textArea.setHTML(richTextElementDTO.getText());
	}

	// Compas icon.
	final ImageResource icon;
	if (ClientUtils.isBlank(textArea.getText())) {
		icon = ToolbarImages.IMAGES.compasRed();

	} else {
		icon = ToolbarImages.IMAGES.compasGreen();
		keyQuestionState.increaseValids();
	}

	sectionPanel.addToolButton(icon, new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			KeyQuestionDialog.getDialog(keyQuestion, textArea, sectionPanel, sectionPanel.getToolButtonCount(), keyQuestionState, draftMode).show();
		}
	});

	return textArea;
}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:39,代码来源:ReportsView.java

示例6: getDialog

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
private static Dialog getDialog() {

		if (keyQuestionDialog == null) {
			final Dialog dialog = new Dialog();
			dialog.setButtons(Dialog.OKCANCEL);
			dialog.setModal(true);

			dialog.setWidth("640px");
			dialog.setResizable(false);

			dialog.setLayout(new RowLayout(Orientation.VERTICAL));

			// Question label
			final Label questionLabel = new Label("key-question");
			questionLabel.addStyleName("project-report-key-question-label");
			dialog.add(questionLabel);

			// Text area
			final RichTextArea textArea = new RichTextArea();
			textArea.setStyleName("project-report-key-question");
			dialog.add(textArea);

			// Toolbar
			final ToolBar toolBar = new ToolBar();
			ReportsView.createRichTextToolbar(toolBar, new RichTextArea.Formatter[] {textArea.getFormatter()});
			dialog.setTopComponent(toolBar);

			// Cancel button
			dialog.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {

				@Override
				public void componentSelected(ButtonEvent ce) {
					dialog.hide();
				}
			});

			keyQuestionDialog = dialog;
		}
		return keyQuestionDialog;
	}
 
开发者ID:sigmah-dev,项目名称:sigmah,代码行数:41,代码来源:KeyQuestionDialog.java

示例7: initToolBar

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
public void initToolBar(RichTextArea richtext) {
	if(!initiated) {
		initiated = true;
		//Save the reference to the RichText area we refer to and get the interfaces to the stylings

		styleText = richtext;
		styleTextFormatter = styleText.getFormatter();


		//Add KeyUp and Click-Handler to the RichText, so that we can actualize the toolbar if neccessary
		styleText.addKeyUpHandler(evHandler);
		styleText.addClickHandler(evHandler);
	}
}
 
开发者ID:fhcampuswien,项目名称:atom,代码行数:15,代码来源:RichTextToolbar.java

示例8: TextAreaExample

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
public TextAreaExample() {
  super("Text Area");

  TextArea text = new TextArea();
  text.setCharacterWidth(30);
  text.setVisibleLines(5);
  add(text);

  RichTextArea rich = new RichTextArea();
  rich.setHTML("Rich <i>text</i> <b>area</b>");
  add(rich);
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:13,代码来源:TextAreaExample.java

示例9: refresh

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
public void refresh() {
	    BeanObject article = getCurState().getArticle();
		if (article != null && article.getString(IArticleCatagory.ID) != null) {
			contentPanelGeneral.updateValues(article.getProperties());
			RichTextArea wid = (RichTextArea)grid.getWidget(1, 0);
			wid.setText(article.getString("content"));
//			this.article = null;
		} else {
			contentPanelGeneral.clearValues();
			
			getCurState().setEditting(false);
		}
	}
 
开发者ID:jbosschina,项目名称:jcommerce,代码行数:14,代码来源:NewArticle.java

示例10: CubaRichTextToolbarWidget

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
public CubaRichTextToolbarWidget(RichTextArea richText) {
    super(richText);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:4,代码来源:CubaRichTextToolbarWidget.java

示例11: createRichTextToolbar

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
@Override
protected void createRichTextToolbar(RichTextArea rta) {
    formatter = new CubaRichTextToolbarWidget(rta);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:CubaRichTextAreaWidget.java

示例12: RichTextToolbar

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
/**
 * Creates a new toolbar that drives the given rich text area.
 * 
 * @param richText the rich text area to be controlled
 */
public RichTextToolbar(RichTextArea richText) {
  this.richText = richText;
  this.basic = richText.getBasicFormatter();
  this.extended = richText.getExtendedFormatter();

  outer.add(topPanel);
  outer.add(bottomPanel);
  topPanel.setWidth("100%");
  bottomPanel.setWidth("100%");

  initWidget(outer);
  setStyleName("gwt-RichTextToolbar");
  richText.addStyleName("hasRichTextToolbar");

  if (basic != null) {
    topPanel.add(bold = createToggleButton(images.bold(), strings.bold()));
    topPanel.add(italic = createToggleButton(images.italic(), strings.italic()));
    topPanel.add(underline = createToggleButton(images.underline(),
        strings.underline()));
    topPanel.add(subscript = createToggleButton(images.subscript(),
        strings.subscript()));
    topPanel.add(superscript = createToggleButton(images.superscript(),
        strings.superscript()));
    topPanel.add(justifyLeft = createPushButton(images.justifyLeft(),
        strings.justifyLeft()));
    topPanel.add(justifyCenter = createPushButton(images.justifyCenter(),
        strings.justifyCenter()));
    topPanel.add(justifyRight = createPushButton(images.justifyRight(),
        strings.justifyRight()));
  }

  if (extended != null) {
    topPanel.add(strikethrough = createToggleButton(images.strikeThrough(),
        strings.strikeThrough()));
    topPanel.add(indent = createPushButton(images.indent(), strings.indent()));
    topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent()));
    topPanel.add(hr = createPushButton(images.hr(), strings.hr()));
    topPanel.add(ol = createPushButton(images.ol(), strings.ol()));
    topPanel.add(ul = createPushButton(images.ul(), strings.ul()));
    topPanel.add(insertImage = createPushButton(images.insertImage(),
        strings.insertImage()));
    topPanel.add(createLink = createPushButton(images.createLink(),
        strings.createLink()));
    topPanel.add(removeLink = createPushButton(images.removeLink(),
        strings.removeLink()));
    topPanel.add(removeFormat = createPushButton(images.removeFormat(),
        strings.removeFormat()));
  }

  if (basic != null) {
    bottomPanel.add(backColors = createColorList("Background"));
    bottomPanel.add(foreColors = createColorList("Foreground"));
    bottomPanel.add(fonts = createFontList());
    bottomPanel.add(fontSizes = createFontSizes());

    // We only use these listeners for updating status, so don't hook them up
    // unless at least basic editing is supported.
    richText.addKeyboardListener(listener);
    richText.addClickListener(listener);
  }
}
 
开发者ID:luox12,项目名称:onecmdb,代码行数:67,代码来源:RichTextToolbar.java

示例13: RichTextToolbar

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
/**
 * Creates a new toolbar that drives the given rich text area.
 *
 * @param richText the rich text area to be controlled
 */
public RichTextToolbar(RichTextArea richText) {
  this.richText = richText;
  this.basic = richText.getBasicFormatter();
  this.extended = richText.getExtendedFormatter();

  outer.add(topPanel);
  outer.add(bottomPanel);
  topPanel.setWidth("100%");
  bottomPanel.setWidth("100%");

  initWidget(outer);
  setStyleName("gwt-RichTextToolbar");
  richText.addStyleName("hasRichTextToolbar");

  if (basic != null) {
    topPanel.add(bold = createToggleButton(images.bold(), strings.bold()));
    topPanel.add(italic = createToggleButton(images.italic(),
        strings.italic()));
    topPanel.add(underline = createToggleButton(images.underline(),
        strings.underline()));
    topPanel.add(subscript = createToggleButton(images.subscript(),
        strings.subscript()));
    topPanel.add(superscript = createToggleButton(images.superscript(),
        strings.superscript()));
    topPanel.add(justifyLeft = createPushButton(images.justifyLeft(),
        strings.justifyLeft()));
    topPanel.add(justifyCenter = createPushButton(images.justifyCenter(),
        strings.justifyCenter()));
    topPanel.add(justifyRight = createPushButton(images.justifyRight(),
        strings.justifyRight()));
  }

  if (extended != null) {
    topPanel.add(strikethrough = createToggleButton(images.strikeThrough(),
        strings.strikeThrough()));
    topPanel.add(indent = createPushButton(images.indent(), strings.indent()));
    topPanel.add(outdent = createPushButton(images.outdent(),
        strings.outdent()));
    topPanel.add(hr = createPushButton(images.hr(), strings.hr()));
    topPanel.add(ol = createPushButton(images.ol(), strings.ol()));
    topPanel.add(ul = createPushButton(images.ul(), strings.ul()));
    topPanel.add(insertImage = createPushButton(images.insertImage(),
        strings.insertImage()));
    topPanel.add(createLink = createPushButton(images.createLink(),
        strings.createLink()));
    topPanel.add(removeLink = createPushButton(images.removeLink(),
        strings.removeLink()));
    topPanel.add(removeFormat = createPushButton(images.removeFormat(),
        strings.removeFormat()));
  }

  if (basic != null) {
    bottomPanel.add(backColors = createColorList("Background"));
    bottomPanel.add(foreColors = createColorList("Foreground"));
    bottomPanel.add(fonts = createFontList());
    bottomPanel.add(fontSizes = createFontSizes());

    // We only use these handlers for updating status, so don't hook them up
    // unless at least basic editing is supported.
    richText.addKeyUpHandler(handler);
    richText.addClickHandler(handler);
  }
}
 
开发者ID:qafedev,项目名称:qafe-platform,代码行数:69,代码来源:RichTextToolbar.java

示例14: updateFromUIDL

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
@Override
public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
   getWidget().client = client;
   getWidget().id = uidl.getId();

   if (uidl.hasAttribute("fontName")) {
      RichTextArea.FontSize fontSize = null;

      if (uidl.hasAttribute("fontSize")) {
         int fontSizeValue = uidl.getIntAttribute("fontSize");
         for (RichTextArea.FontSize fontSizesConstant : fontSizesConstants) {
            if (fontSizesConstant.getNumber() == fontSizeValue) {
               fontSize = fontSizesConstant;
            }
         }
      }

      getWidget().setFont(uidl.getStringAttribute("fontName"), fontSize);
   }

   if (uidl.hasAttribute("insertHtml")) {
      getWidget().insertHtml(uidl.getStringAttribute("insertHtml"));
   }

   if (uidl.hasVariable("text")) {
      String newValue = uidl.getStringVariable("text");
      if (!SharedUtil.equals(newValue, cachedValue)) {
         getWidget().setValue(newValue);
         cachedValue = newValue;
      }
   }

   if (!isRealUpdate(uidl)) {
      return;
   }

   getWidget().setEnabled(isEnabled());
   getWidget().setReadOnly(isReadOnly());
   getWidget().immediate = getState().immediate;
   int newMaxLength = uidl.hasAttribute("maxLength") ? uidl
           .getIntAttribute("maxLength") : -1;
   if (newMaxLength >= 0) {
      if (getWidget().maxLength == -1) {
         getWidget().keyPressHandler = getWidget().rta
                 .addKeyPressHandler(getWidget());
      }
      getWidget().maxLength = newMaxLength;
   } else if (getWidget().maxLength != -1) {
      getWidget().getElement().setAttribute("maxlength", "");
      getWidget().maxLength = -1;
      getWidget().keyPressHandler.removeHandler();
   }

   if (uidl.hasAttribute("selectAll")) {
      getWidget().selectAll();
   }

}
 
开发者ID:vkazhdan,项目名称:vaadin-crichtextarea,代码行数:59,代码来源:CRichTextAreaConnector.java

示例15: RichTextToolbar

import com.google.gwt.user.client.ui.RichTextArea; //导入依赖的package包/类
/**
 * Creates a new toolbar that drives the given rich text area.
 * 
 * @param richText
 *            the rich text area to be controlled
 */
public RichTextToolbar(RichTextArea richText) {
    this.richText = richText;
    this.basic = richText.getBasicFormatter();
    this.extended = richText.getExtendedFormatter();

    outer.add(topPanel);
    outer.add(bottomPanel);
    topPanel.setWidth("100%");
    bottomPanel.setWidth("100%");

    initWidget(outer);
    setStyleName("gwt-RichTextToolbar");
    richText.addStyleName("hasRichTextToolbar");

    if (basic != null) {
        topPanel.add(bold = createToggleButton(images.bold(), strings.bold()));
        topPanel.add(italic = createToggleButton(images.italic(), strings.italic()));
        topPanel.add(underline = createToggleButton(images.underline(), strings.underline()));
        topPanel.add(subscript = createToggleButton(images.subscript(), strings.subscript()));
        topPanel
            .add(superscript = createToggleButton(images.superscript(), strings.superscript()));
        topPanel
            .add(justifyLeft = createPushButton(images.justifyLeft(), strings.justifyLeft()));
        topPanel.add(
            justifyCenter = createPushButton(images.justifyCenter(), strings.justifyCenter()));
        topPanel.add(
            justifyRight = createPushButton(images.justifyRight(), strings.justifyRight()));
    }

    if (extended != null) {
        topPanel.add(
            strikethrough = createToggleButton(
                images.strikeThrough(),
                strings.strikeThrough()));
        topPanel.add(indent = createPushButton(images.indent(), strings.indent()));
        topPanel.add(outdent = createPushButton(images.outdent(), strings.outdent()));
        topPanel.add(hr = createPushButton(images.hr(), strings.hr()));
        topPanel.add(ol = createPushButton(images.ol(), strings.ol()));
        topPanel.add(ul = createPushButton(images.ul(), strings.ul()));
        topPanel
            .add(insertImage = createPushButton(images.insertImage(), strings.insertImage()));
        topPanel.add(createLink = createPushButton(images.createLink(), strings.createLink()));
        topPanel.add(removeLink = createPushButton(images.removeLink(), strings.removeLink()));
        topPanel.add(
            removeFormat = createPushButton(images.removeFormat(), strings.removeFormat()));
    }

    if (basic != null) {
        bottomPanel.add(backColors = createColorList("Background"));
        bottomPanel.add(foreColors = createColorList("Foreground"));
        bottomPanel.add(fonts = createFontList());
        bottomPanel.add(fontSizes = createFontSizes());

        // We only use these handlers for updating status, so don't hook
        // them up
        // unless at least basic editing is supported.
        richText.addKeyUpHandler(handler);
        richText.addClickHandler(handler);
    }
}
 
开发者ID:inepex,项目名称:ineform,代码行数:67,代码来源:RichTextToolbar.java


注:本文中的com.google.gwt.user.client.ui.RichTextArea类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。