예제 #1
0
 public void setAceEditorProperties(AceEditor aceTxtArea) {
   aceTxtArea.setMode(AceEditorMode.CQL);
   aceTxtArea.setTheme(AceEditorTheme.ECLIPSE);
   aceTxtArea.getElement().getStyle().setFontSize(14, Unit.PX);
   aceTxtArea.setHighlightSelectedWord(true);
   aceTxtArea.setAutocompleteEnabled(true);
   aceTxtArea.setShowPrintMargin(false);
 }
예제 #2
0
  public void onModuleLoad() {

    TabLayoutPanel tabLayoutPanel = new TabLayoutPanel(2.5, Unit.EM);
    final SplitLayoutPanel splitLayoutPanel = new SplitLayoutPanel();
    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.setSpacing(10);
    hPanel.add(new HTML("HQMF Viewer."));
    Button processHQMFButton = new Button("Process HQMF.");
    processHQMFButton.addStyleName("sendButton");
    hPanel.add(processHQMFButton);
    hPanel.add(new HTML("\t(For some reason, works only in IE right now.)"));

    final VerticalPanel summaryVerticalPanel = new VerticalPanel();
    summaryVerticalPanel.setSpacing(3);
    processHQMFButton.setStyleName("summaryVPanel");
    summaryVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    summaryVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    splitLayoutPanel.addNorth(hPanel, 50);
    splitLayoutPanel.addWest(summaryVerticalPanel, 0);

    final RichTextArea textArea = new RichTextArea();
    textArea.setTitle("Paste your HQMF XML here.");
    textArea.setText("Paste your HQMF XML here.");
    textArea.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            if (textArea.getText().length() < 30
                && textArea.getText().equals("Paste your HQMF XML here.")) {
              textArea.setText("");
            }
          }
        });
    textArea.addStyleName("boxsizingBorder");
    textArea.setWidth("100%");
    textArea.setHeight("100%");

    processHQMFButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            processHQMF(textArea, splitLayoutPanel, summaryVerticalPanel);
            splitLayoutPanel.remove(hPanel);
            splitLayoutPanel.setWidgetSize(summaryVerticalPanel, 200);
            splitLayoutPanel.setWidgetToggleDisplayAllowed(summaryVerticalPanel, true);
          }
        });
    splitLayoutPanel.add(textArea);

    MySplitLayoutPanel mySplitPanel = new MySplitLayoutPanel();
    final VerticalPanel testVerticalPanel = new VerticalPanel();
    testVerticalPanel.setSpacing(3);

    testVerticalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    testVerticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    // final RichTextArea testtextArea = getSmartTextArea();
    // final AceEditor testtextArea = getAceEditor();
    AceEditor aceTxtArea = new AceEditor();
    aceTxtArea.setWidth("100%");
    aceTxtArea.setHeight("100%");

    mySplitPanel.addEast(testVerticalPanel, 0);
    mySplitPanel.add(aceTxtArea);
    //		mySplitPanel.add(testtextArea);

    aceTxtArea.startEditor();

    setAceEditorProperties(aceTxtArea);

    mySplitPanel.setWidgetToggleDisplayAllowed(testVerticalPanel, true);

    tabLayoutPanel.add(mySplitPanel, "test CQL Editor.");
    tabLayoutPanel.add(splitLayoutPanel, "HQMF Viewer");

    RootLayoutPanel.get().add(tabLayoutPanel);
  }