Exemplo n.º 1
0
 private void resizeScrollPanel() {
   int width = Window.getClientWidth() - 20;
   String height = (Window.getClientHeight() - 60) + "px";
   treeScrollPanel.setWidth(Math.round(width * 0.2) + "px");
   treeScrollPanel.setHeight(height);
   explorerScrollPanel.setWidth(Math.round(width * 0.8) + "px");
   explorerScrollPanel.setHeight(height);
 }
Exemplo n.º 2
0
  public int load(Topic topic) {
    super.load(topic);
    childPanel.clear();

    int childCount = 0;
    for (Iterator iterator = topic.getInstances().iterator(); iterator.hasNext(); ) {

      TopicTypeConnector conn = (TopicTypeConnector) iterator.next();

      Topic child = conn.getTopic();
      if (manager.isEdittable() || child.isPublicVisible()) {
        childPanel.add(new TopicLink(child));
      }

      childCount++;
    }

    if (childCount < 1) {
      childPanel.add(new Label(" "));
    }
    int scrollH = childCount * HEIGHT_PER_ENTRY;
    scrollH = (scrollH < MAX_HEIGHT) ? scrollH : MAX_HEIGHT;
    scroll.setHeight(scrollH + "px");
    System.out.println("ChildGadg scroll heigh " + scrollH);

    return childCount;
  }
Exemplo n.º 3
0
  /** Popup the view source dialog, showing the given content. */
  public static void showSource(final String content, String name) {
    Constants constants = GWT.create(Constants.class);
    int windowWidth = Window.getClientWidth() / 2;
    int windowHeight = Window.getClientHeight() / 2;
    final FormStylePopup pop =
        new FormStylePopup(images.viewSource(), constants.ViewingSourceFor0(name), windowWidth);

    String[] rows = content.split("\n");

    FlexTable table = new FlexTable();
    for (int i = 0; i < rows.length; i++) {

      table.setHTML(i, 0, "<span style='color:grey;'>" + (i + 1) + ".</span>");
      table.setHTML(i, 1, "<span style='color:green;' >|</span>");
      table.setHTML(i, 2, addSyntaxHilights(rows[i]));
    }

    ScrollPanel scrollPanel = new ScrollPanel(table);

    scrollPanel.setHeight(windowHeight + "px");
    scrollPanel.setWidth(windowWidth + "px");

    pop.addRow(scrollPanel);

    LoadingPopup.close();

    pop.show();
  }
Exemplo n.º 4
0
  @Override
  protected Widget onInitialization() {
    setHeight100();

    lockInfo = new LockInfoWidget();
    HeaderWidget header = new HeaderWidget();
    sidebar = new SwitcherWidget(true);
    workarea.setStyleName("Workspace-body-center-content");

    ScrollPanel workareaScroller =
        new ScrollPanel(Gwt.createDiv("Workspace-body-center-content", workarea));
    workareaScroller.getElement().setId("workarea-scroller");
    workareaScroller.setHeight("100%");
    workarea.setScrollPanel(workareaScroller);

    FlowPanel body = new FlowPanel();
    body.setStyleName("Workspace-body");
    body.add(Gwt.createDiv("Workspace-body-west", sidebar));
    body.add(Gwt.createDiv("Workspace-body-center", workareaScroller));

    FlowPanel workspace = Gwt.createFlowPanel(Gwt.createDiv("Workspace-header", header), body);
    workspace.setStyleName("Workspace");

    locker = new LockWidget(workspace);

    return new FullscreenPanel(locker);
  }
Exemplo n.º 5
0
  /** Redraws app for GUI (with menu) */
  public static void redrawGuiWithMenu() {

    bodySplitter.clear();
    bodySplitter.addSouth(ft, 23);
    bodySplitter.addWest(leftMenu, 280);
    bodySplitter.add(contentPanel);
    leftMenu.setHeight("100%");
    contentPanel.setHeight("100%");
  }
Exemplo n.º 6
0
 public MoveTerm(TermObject tObj) {
   super(constants.buttonOk(), constants.buttonCancel());
   this.tObj = tObj;
   this.setText(constants.conceptMove());
   panel.setWidth("500px");
   panel.setHeight("350px");
   addWidget(panel);
   initLayout();
 }
Exemplo n.º 7
0
  public ChildrenGadget(Manager _manager) {

    super(_manager);

    childPanel = new VerticalPanel();
    childPanel.addStyleName("H-ChildDisplay");

    // PEND awkward. we'd really like to set scroll.setMaxHeight(),
    // but that doesn't exist. setting it in all cases leads to excess space
    scroll = new ScrollPanel(childPanel);
    scroll.setAlwaysShowScrollBars(false);

    scroll.setHeight(MAX_HEIGHT + "px");

    initWidget(scroll);
  }
  public TouchPadScrollWidget() {
    super(false);
    scroller.setHeight("100%");
    scroller.setWidth("100%");
    add(scroller);
    scroller.add(spacer);
    updater =
        new Timer() {

          @Override
          public void run() {
            currentScreenX =
                spacer.getOffsetWidth()
                    - scroller.getHorizontalScrollPosition()
                    - scroller.getOffsetWidth();
            currentScreenY =
                spacer.getOffsetHeight()
                    - scroller.getVerticalScrollPosition()
                    - scroller.getOffsetHeight();
          }
        };
  }
  @Override
  public void initialize() {
    setHeight(200);
    changeListView = new ChangeListViewImpl();
    refreshButton = new ToolbarButton(REFRESH_TO_SEE_THE_LATEST_CHANGES);
    refreshButton.addListener(
        new ButtonListenerAdapter() {
          @Override
          public void onClick(Button button, EventObject e) {
            onRefresh();
          }
        });
    setTopToolbar(refreshButton);

    ScrollPanel scrollPanel = new ScrollPanel(changeListView.asWidget());
    scrollPanel.setWidth("100%");
    scrollPanel.setHeight("100%");
    add(scrollPanel);
    addProjectEventHandler(
        ProjectChangedEvent.TYPE,
        new ProjectChangedHandler() {
          @Override
          public void handleProjectChanged(ProjectChangedEvent event) {
            ChangeSummaryPortlet.this.handleProjectChanged(event);
          }
        });
    addApplicationEventHandler(
        PermissionsChangedEvent.TYPE,
        new PermissionsChangedHandler() {
          @Override
          public void handlePersmissionsChanged(PermissionsChangedEvent event) {
            onRefresh();
          }
        });
    onRefresh();
  }
Exemplo n.º 10
0
 public void onResize(ResizeEvent event) {
   scrollPanel.setHeight((event.getHeight() - 20) + "px");
 }
Exemplo n.º 11
0
    HtmlUploadComponentImpl(final UploadComponentOptions options, final boolean zip) {
      this.zip = zip;
      if (zip) {
        types = "*.zip";
        typesDescription = "Zip";
      } else {
        types = options.getTypes() == null ? null : options.getTypes();
        typesDescription =
            options.getTypesDescription() == null ? null : options.getTypesDescription();
      }
      this.options = options;
      if (isMultiple()) {
        formPanel.setHeight("125px");
        scrollPanel.setHeight("125px");
        formPanel.setWidth("320px");
        scrollPanel.setWidth("320px");
      } else {
        formPanel.setHeight("30px");
        scrollPanel.setHeight("30px");
        formPanel.setWidth("310px");
        scrollPanel.setWidth("310px");
      }

      panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

      formPanel.setWidget(scrollPanel);
      formPanel.setAction(GWT.getHostPageBaseURL() + "fileupload?zip=" + zip);
      formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
      formPanel.setMethod(FormPanel.METHOD_POST);
      formPanel.addSubmitHandler(
          new SubmitHandler() {
            public void onSubmit(final SubmitEvent submitEvent) {}
          });
      formPanel.addSubmitCompleteHandler(
          new SubmitCompleteHandler() {
            public void onSubmitComplete(final SubmitCompleteEvent completeEvent) {
              System.out.println("Submit complete " + completeEvent.getResults());
              final String result = completeEvent.getResults();
              try {
                final List<FileSource> fileSources = toFileSources(result);
                options.getCompletionCallback().onSuccess(fileSources);
              } catch (final Exception e) {
                options.getCompletionCallback().onFailure(e);
              }
            }
          });
      final Layout parent = getParentCanvas(options);
      // final String parentPreix;
      // if(isZip) {
      //  parentPrefix = DomConstants.UPLOAD_PANEL_ZIP;
      // } else {
      //  parentPrefix = DomConstants.UPLOAD_PANEL_PLAIN;
      // }

      parent.setWidth100();
      if (debug) {
        parent.setBorder("1px solid pink");
      }
      parent.setAlign(VerticalAlignment.CENTER);
      parent.setLayoutAlign(VerticalAlignment.CENTER);
      final Layout wrapperLayout = new VLayout();
      // wrapperLayout.setHeight100();
      wrapperLayout.setWidth100();
      if (isMultiple()) {
        wrapperLayout.setHeight("140px");
      } else {
        wrapperLayout.setHeight("30px");
      }
      if (debug) {
        wrapperLayout.setBorder("1px solid blue");
      }
      wrapperLayout.setAlign(VerticalAlignment.CENTER);
      wrapperLayout.setLayoutAlign(VerticalAlignment.CENTER);
      /*
       * wrapperLayout.setGroupTitle(isMultiple() ? "File(s)" : (zip ? "Zip File" : "File"));
       * wrapperLayout.setIsGroup(true);
       * wrapperLayout.setPadding(15);
       * wrapperLayout.setLayoutAlign(Alignment.CENTER);
       * wrapperLayout.setAlign(Alignment.CENTER);
       */
      if (isMultiple()) {
        final Label addLabel =
            SmartUtils.smartParagraph(
                "<span style=\"color:blue;cursor:pointer; text-decoration: underline;\">Add Upload</span>");
        addLabel.addClickHandler(
            new ClickHandler() {
              public void onClick(final ClickEvent clickEvent) {
                addFileUploadWidget();
              }
            });
        wrapperLayout.addMember(addLabel);
      }
      wrapperLayout.addMember(formPanel);
      parent.addMember(wrapperLayout);
      // parent.setLayoutAlign(Alignment.CENTER);
      // parent.setAlign(Alignment.CENTER);
      addFileUploadWidget();
      setWidget(parent);
      parent.addDrawHandler(
          new DrawHandler() {

            public void onDraw(DrawEvent event) {
              if (zip) {
                parent.getDOM().addClassName(DomConstants.UPLOAD_PANEL_ZIP);
              } else {
                parent.getDOM().addClassName(DomConstants.UPLOAD_PANEL_PLAIN);
              }
            }
          });
    }
Exemplo n.º 12
0
  @Override
  public void onModuleLoad() {
    chatService = GWT.create(ChatService.class);
    chatService.getUsername(
        new AsyncCallback<String>() {
          @Override
          public void onSuccess(String username) {
            if (username == null) {
              showLogonDialog();
            } else {
              loggedOn(username);
            }
          }

          @Override
          public void onFailure(Throwable caught) {
            output(caught.toString(), "red");
            // assume they are not logged in
            showLogonDialog();
          }
        });

    FlowPanel controls = new FlowPanel();
    final ListBox status = new ListBox();
    for (Status s : Status.values()) {
      status.addItem(s.name());
    }
    status.addChangeHandler(
        new ChangeHandler() {
          @Override
          public void onChange(ChangeEvent event) {
            setStatus(Status.values()[status.getSelectedIndex()]);
          }
        });

    final TextBox input = new TextBox();
    Button send =
        new Button(
            "Send",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                sendMessage(input.getValue());
              }
            });
    Button logout =
        new Button(
            "Logout",
            new ClickHandler() {
              @Override
              public void onClick(ClickEvent event) {
                logout();
              }
            });

    controls.add(status);
    controls.add(input);
    controls.add(send);
    controls.add(logout);

    DockPanel dockPanel = new DockPanel();
    messages = new HTML();
    scrollPanel = new ScrollPanel();
    scrollPanel.setHeight("250px");
    scrollPanel.add(messages);
    dockPanel.add(scrollPanel, DockPanel.CENTER);
    dockPanel.add(controls, DockPanel.SOUTH);

    RootPanel.get().add(dockPanel);
  }
Exemplo n.º 13
0
 /**
  * Sets the height of the window (used by minimise and maximise buttons). If store is true, store
  * this setting as the proper size. If false, the window is being minimised or maximised, so the
  * old dimensions should be saved to undo it later on.
  *
  * @param h Height
  * @param store If true, store the new height setting
  */
 public void setHeight(int h, boolean store) {
   if (store) height = h;
   String str = Integer.toString(h) + "px";
   setHeight(str);
   sp.setHeight(Integer.toString(h - 20) + "px");
 }
Exemplo n.º 14
0
  /** This is the entry point method. */
  @Override
  public void onModuleLoad() {
    // Create the popup dialog box
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText("CIS 550 HW5 - Query Results");
    dialogBox.setAnimationEnabled(true);
    final Button closeButton = new Button("Close");
    // We can set the id of a widget by accessing its Element
    closeButton.getElement().setId("closeButton");
    final HTML schemaLabel = new HTML();
    final HTML serverResponseLabel = new HTML();
    VerticalPanel dialogVPanel = new VerticalPanel();
    dialogVPanel.addStyleName("dialogVPanel");
    dialogVPanel.add(new HTML("<br><b>Relation schema:</b>"));
    dialogVPanel.add(schemaLabel);
    dialogVPanel.add(new HTML("<br><b>Returned data:</b>"));
    dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_RIGHT);
    dialogBox.setWidget(dialogVPanel);

    final ScrollPanel scroller = new ScrollPanel();
    scroller.setHeight("400px");
    dialogVPanel.add(scroller);

    dialogVPanel.add(closeButton);

    // Here we are creating a dialog box to return the query results
    queryService.getRelation(
        new AsyncCallback<Relation>() {

          @Override
          public void onFailure(Throwable caught) {
            // Show the RPC error message to the user
            dialogBox.setText("Remote Procedure Call - Failure");
            serverResponseLabel.addStyleName("serverResponseLabelError");
            serverResponseLabel.setHTML(SERVER_ERROR);
            dialogBox.show();
            dialogBox.center();

            closeButton.setFocus(true);
          }

          @Override
          public void onSuccess(Relation result) {
            // Add the relational schema to the output
            schemaLabel.setText(result.getSchema().toString());

            // Add the relation outputs to the output in a scrollable table
            scroller.add(result.getTableWidget());
            dialogBox.show();
            dialogBox.center();
          }
        });

    closeButton.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            dialogBox.hide();
          }
        });
  }