예제 #1
0
파일: Window.java 프로젝트: jeffedlund/JF3d
  /**
   * Build the window structure. Override this method if you want to change the inner widgets
   * placement. Do not call this method. It is automaticaly call by the constructor.
   *
   * @param closeBtn
   * @param maximizeBtn
   * @param minimizeBtn
   */
  protected void build(boolean closeBtn, boolean maximizeBtn, boolean minimizeBtn) {
    titleBar = new Container();
    this.addWidget(titleBar);

    setLayoutManager(new BorderLayout());

    content = new Container();
    ((Container) content).setLayoutData(BorderLayoutData.CENTER);
    ((Container) content).setKeyTraversalRoot(true);
    this.addWidget(content);

    titleBar.setLayoutData(BorderLayoutData.NORTH);

    buildTitleBar(closeBtn, maximizeBtn, minimizeBtn);

    setSize(100, 120);
  }
예제 #2
0
파일: Window.java 프로젝트: jeffedlund/JF3d
 /**
  * Sets the content Container. This is desirable for example, if the content Container shall be a
  * <code>ScrollContainer</code>.
  *
  * @param c the new container
  */
 public void setContentContainer(IContainer c) {
   removeWidget(content);
   if (!getContent().contains(c)) addWidget(c);
   ((Widget) c).setLayoutData(BorderLayoutData.CENTER);
   if (c instanceof Container) ((Container) c).setKeyTraversalRoot(false);
   updateMinSize();
   content = c;
 }
예제 #3
0
파일: Window.java 프로젝트: jeffedlund/JF3d
 /** Build the maximizeButton */
 protected void buildMaximizeButton() {
   maximizeButton = new Button();
   titleBar.addWidget(maximizeButton);
   maximizeButton.addButtonPressedListener(
       new IButtonPressedListener() {
         public void buttonPressed(ButtonPressedEvent e) {
           throw new UnsupportedOperationException("Maximize Window: Not implemented yet");
         }
       });
 }
예제 #4
0
파일: Window.java 프로젝트: jeffedlund/JF3d
  /**
   * Constructs the title bar.
   *
   * @param closeBtn flag indicating the existence of a close button
   * @param maximizeBtn flag indicating the existence of a maximize button
   * @param minimizeBtn flag indicating the existence of a minimize button
   */
  protected void buildTitleBar(boolean closeBtn, boolean maximizeBtn, boolean minimizeBtn) {
    titleBar.setLayoutManager(new RowLayout(true));

    title = new Label();
    titleBar.addWidget(title);
    title.setText("Frame");

    if (minimizeBtn) {
      buildMinimizeButton();
    }

    if (maximizeBtn) {
      buildMaximizeButton();
    }

    if (closeBtn) {
      buildCloseButton();
    }
  }
예제 #5
0
파일: Window.java 프로젝트: jeffedlund/JF3d
 /** Build the closeButton */
 protected void buildCloseButton() {
   closeButton = new Button();
   titleBar.addWidget(closeButton);
   closeButton.setText("X");
   closeButton.addButtonPressedListener(
       new IButtonPressedListener() {
         public void buttonPressed(ButtonPressedEvent e) {
           fireWindowClosedEvent();
           // close();
         }
       });
   closeButton.setTraversable(false);
 }
예제 #6
0
파일: Window.java 프로젝트: jeffedlund/JF3d
 /**
  * Notifies this window that it has been removed from the widget tree. It will unregister its drag
  * and drop listeners from the display.
  */
 @Override
 public void removedFromWidgetTree() {
   super.removedFromWidgetTree();
   getDisplay().removeDndListener(moveDnDListener);
   getDisplay().removeDndListener(resizeDnDListener);
 }
예제 #7
0
파일: Window.java 프로젝트: jeffedlund/JF3d
 /** Overridden to register necessary listeners on current display. */
 @Override
 public void addedToWidgetTree() {
   super.addedToWidgetTree();
   getDisplay().addDndListener(moveDnDListener);
   if (resizeDnDListener != null) getDisplay().addDndListener(resizeDnDListener);
 }
  /**
   * Creates a new <code>ConnectionWindow</code>.
   *
   * @param closeBtn if this Window has a close button
   */
  public ConnectionWindow(boolean closeBtn) {
    super(closeBtn, false, false, true);

    // FIXME: change this soon
    this.setupTheme(ConnectionWindow.class);

    setSize(250, 250);
    setTitle("Connection Window");
    ((Container) getContentContainer()).setLayoutManager(new FormLayout());

    addressContainer = FengGUI.createContainer(getContentContainer());

    addressContainer.getAppearance().add(new TitledBorder("Address"));
    FormData fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(100, 0);
    addressContainer.setLayoutData(fd);
    addressContainer.setLayoutManager(new GridLayout(2, 2));

    Label l1 = FengGUI.createLabel(addressContainer, "Address:");

    addressTextField = FengGUI.createTextField(addressContainer);
    addressTextField.updateMinSize();

    FengGUI.createLabel(addressContainer, "Port:");
    portTextField = FengGUI.createTextField(addressContainer);
    portTextField.setRestrict(TextEditor.RESTRICT_NUMBERSONLY);
    portTextField.setMaxCharacters(8);
    portTextField.updateMinSize();
    portTextField.setText("80");

    loginContainer = FengGUI.createContainer(getContentContainer());
    loginContainer.getAppearance().add(new TitledBorder("Login"));
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(addressContainer, 0);
    loginContainer.setLayoutData(fd);

    loginContainer.setLayoutManager(new GridLayout(2, 2));
    Label l3 = FengGUI.createLabel(loginContainer, "Name:");

    loginNameTextField = FengGUI.createTextField(loginContainer);
    loginNameTextField.updateMinSize();

    FengGUI.createLabel(loginContainer, "Password:"******"Connect");
    connectButton.getAppearance().setMargin(new Spacing(2, 2));

    cancelButton = FengGUI.createButton(getContentContainer(), "Cancel");
    cancelButton.getAppearance().setMargin(new Spacing(2, 2));

    statusLabel = FengGUI.createLabel(getContentContainer(), "Say something...");
    statusLabel.getAppearance().setAlignment(Alignment.MIDDLE);

    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(connectButton, 0);
    fd.top = new FormAttachment(loginContainer, 0);
    statusLabel.setLayoutData(fd);

    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(50, 0);
    fd.bottom = new FormAttachment(0, 0);
    cancelButton.setLayoutData(fd);

    fd = new FormData();
    fd.left = new FormAttachment(50, 0);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(0, 0);
    connectButton.setLayoutData(fd);

    cancelButton.addButtonPressedListener(
        new IButtonPressedListener() {

          public void buttonPressed(ButtonPressedEvent e) {
            close();
          }
        });

    layout();
  }