示例#1
0
 private void createLoadingBar() {
   new ProgressMonitorDialog(parent);
   Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
   shell.setText("Report Loading");
   shell.addDisposeListener(
       new org.eclipse.swt.events.DisposeListener() {
         @Override
         public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
           if (thread.isAlive()) {
             thread.interrupt();
             reportFinished = true;
           }
         }
       });
   Label label = new Label(shell, SWT.NONE);
   label.setSize(new Point(260, 20));
   label.setLocation(20, 30);
   label.setText("Please wait while the report loads.");
   label.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
   label.setAlignment(SWT.CENTER);
   Label timelabel = new Label(shell, SWT.NONE);
   timelabel.setSize(new Point(260, 20));
   timelabel.setLocation(20, 50);
   // timelabel.setText("(approx " + timeEst + ")");
   timelabel.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
   timelabel.setAlignment(SWT.CENTER);
   ProgressBar progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE);
   progressBar.setSize(new Point(200, 20));
   progressBar.setLocation(50, 80);
   Button button = new Button(shell, SWT.NONE);
   button.setSize(new Point(100, 30));
   button.setLocation(100, 120);
   button.setText("Cancel");
   button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
   button.setAlignment(SWT.CENTER);
   button.addSelectionListener(
       new org.eclipse.swt.events.SelectionAdapter() {
         @Override
         public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
           if ((thread != null) && thread.isAlive()) {
             thread.interrupt();
             reportFinished = true;
           }
         }
       });
   shell.setSize(new Point(300, 200));
   LayoutUtils.centerGUI(shell);
   shell.open();
   while (!reportFinished) {
     if (!parent.getDisplay().readAndDispatch()) {
       parent.getDisplay().sleep();
     }
   }
   if (!shell.isDisposed()) {
     shell.close();
   }
 }
示例#2
0
  private void setTitleLocation() {
    int textWidth = titleLabel.getSize().x;
    int textHeight = titleLabel.getSize().y;

    if ((flags & SWT.CENTER) != 0) {
      titleLabel.setLocation(getWidth() / 2 - textWidth / 2, 0);
    } else if ((flags & SWT.RIGHT) != 0) {
      titleLabel.setLocation(getWidth() - textWidth, 0);
    } else {
      titleLabel.setLocation(0, 0);
    }
  }
示例#3
0
  /** Performs layouting. */
  private void layout() {

    // Disable redrawing
    toolbar.setRedraw(false);

    // Adjust size of items and composite
    Rectangle bounds = toolbar.getBounds();
    int remaining = toolbar.getBounds().width;
    for (final ToolItem item : toolitems) {
      remaining -= item.getBounds().width;
    }
    remaining -= OFFSET;
    infoComposite.setSize(remaining, bounds.height);
    infoItem.setWidth(remaining);
    int locationY = (infoComposite.getBounds().height - labelSelected.getBounds().height) / 2;

    // Layout label
    int locationX = remaining - labelApplied.getSize().x;
    labelApplied.setLocation(locationX, locationY);
    if (locationX < 0) labelApplied.setVisible(false);
    else labelApplied.setVisible(true);

    // Layout label
    locationX -= labelSelected.getSize().x + OFFSET;
    labelSelected.setLocation(locationX, locationY);
    if (locationX < 0) labelSelected.setVisible(false);
    else labelSelected.setVisible(true);

    // Layout label
    locationX -= labelTransformations.getSize().x + OFFSET;
    labelTransformations.setLocation(locationX, locationY);
    if (locationX < 0) labelTransformations.setVisible(false);
    else labelTransformations.setVisible(true);

    // Layout label
    locationX -= labelAttribute.getSize().x + OFFSET;
    labelAttribute.setLocation(locationX, locationY);
    if (locationX < 0) labelAttribute.setVisible(false);
    else labelAttribute.setVisible(true);

    // Redraw
    toolbar.setRedraw(true);
  }
示例#4
0
  private void layoutButtons() {
    int offset = 0;

    if (PROPERTIES.get("os.name").equals("macosx")) {
      if (closeButton != null && closeButton.isVisible()) {
        closeButton.setLocation(offset, 0);

        offset += getHeight() + 1;
      }
      if (minimizeButton != null && minimizeButton.isVisible()) {
        minimizeButton.setLocation(offset, 0);

        offset += getHeight() + 1;
      }
      if (restoreButton != null && restoreButton.isVisible()) {
        restoreButton.setLocation(offset, 0);

        offset += getHeight() + 1;
      }
    } else {
      if (closeButton != null && closeButton.isVisible()) {
        closeButton.setLocation(getWidth() - closeButton.getSize().x - offset, 0);

        offset += getHeight() + 1 + closeButton.getSize().x;
      }
      if (restoreButton != null && restoreButton.isVisible()) {
        restoreButton.setLocation(getWidth() - offset, 0);

        offset += getHeight() + 1;
      }
      if (minimizeButton != null && minimizeButton.isVisible()) {
        minimizeButton.setLocation(getWidth() - offset, 0);

        offset += getHeight() + 1;
      }
    }
  }
  /** Create contents of the window. */
  protected void createContents() {
    shlMcScheduler = new Shell();
    shlMcScheduler.setSize(803, 401);
    shlMcScheduler.setText("MC3 Scheduler");

    // MENU BAR
    Menu MenuBar = new Menu(shlMcScheduler, SWT.BAR);
    shlMcScheduler.setMenuBar(MenuBar);

    // FILE
    MenuItem FileMenu = new MenuItem(MenuBar, SWT.CASCADE);
    FileMenu.setText("File");

    Menu FileCascade = new Menu(FileMenu);
    FileMenu.setMenu(FileCascade);

    MenuItem mntmSave = new MenuItem(FileCascade, SWT.NONE);
    mntmSave.setText("Save");

    MenuItem mntmOpen = new MenuItem(FileCascade, SWT.NONE);
    mntmOpen.setText("Open");

    MenuItem mntmExit = new MenuItem(FileCascade, SWT.NONE);
    mntmExit.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            shlMcScheduler.close();
          }
        });
    mntmExit.setText("Exit");

    // EDIT
    MenuItem EditMenu = new MenuItem(MenuBar, SWT.CASCADE);
    EditMenu.setText("Edit");

    Menu EditCascade = new Menu(EditMenu);
    EditMenu.setMenu(EditCascade);

    // INSERT
    MenuItem InsertMenu = new MenuItem(MenuBar, SWT.CASCADE);
    InsertMenu.setText("Insert");

    Menu InsertCascade = new Menu(InsertMenu);
    InsertMenu.setMenu(InsertCascade);

    MenuItem InsertTranscript = new MenuItem(InsertCascade, SWT.NONE);
    InsertTranscript.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final InsertDialog dial = new InsertDialog(shlMcScheduler, 1, txtXscript);
            dial.open();
          }
        });
    InsertTranscript.setText("Insert Transcript");

    MenuItem InsertCoursePlan = new MenuItem(InsertCascade, SWT.NONE);
    InsertCoursePlan.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final InsertDialog dial = new InsertDialog(shlMcScheduler, 1, txtCoursePlan);
            dial.open();
          }
        });
    InsertCoursePlan.setText("Insert Course Plan");

    MenuItem InsertCourseList = new MenuItem(InsertCascade, SWT.NONE);
    InsertCourseList.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {}
        });
    InsertCourseList.setText("Insert a Course List");

    // WINDOW TABS
    TabFolder WindowTab = new TabFolder(shlMcScheduler, SWT.NONE);
    WindowTab.setBounds(0, 0, 565, 343);

    // TRANSCRIPT TAB
    TabItem TranscriptTab = new TabItem(WindowTab, SWT.NONE);
    TranscriptTab.setText("Transcript");

    Composite TranscriptWindow = new Composite(WindowTab, SWT.NONE);
    TranscriptTab.setControl(TranscriptWindow);

    txtXscript =
        new Text(
            TranscriptWindow,
            SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL);
    txtXscript.setEditable(false);
    txtXscript.setText("Insert your Transcript!");
    txtXscript.setBounds(0, 0, 557, 315);

    // COURSE PLAN TAB
    TabItem CoursePlanTab = new TabItem(WindowTab, SWT.NONE);
    CoursePlanTab.setText("Course Plan");

    Composite CoursePlanWindow = new Composite(WindowTab, SWT.NONE);
    CoursePlanTab.setControl(CoursePlanWindow);

    txtCoursePlan =
        new Text(
            CoursePlanWindow,
            SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL);
    txtCoursePlan.setText("Insert your Course Plan");
    txtCoursePlan.setEditable(false);
    txtCoursePlan.setBounds(0, 0, 557, 315);

    // COURSE LIST TAB
    TabItem CourseListTab = new TabItem(WindowTab, SWT.NONE);
    CourseListTab.setText("Course List");

    Composite CourseListWindow = new Composite(WindowTab, SWT.NONE);
    CourseListTab.setControl(CourseListWindow);

    final List cList = new List(CourseListWindow, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    cList.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            currentCourseSelected = cList.getSelection()[0];
          }
        });
    cList.setBounds(0, 0, 557, 315);
    cList.add("MATH TEST");
    cList.add("SCIENCE TEST");

    TabItem CalendarTab = new TabItem(WindowTab, SWT.NONE);
    CalendarTab.setText("Calendar");

    Composite CalenderWindow = new Composite(WindowTab, SWT.NONE);
    CalenderWindow.setEnabled(false);
    CalendarTab.setControl(CalenderWindow);

    table = new Table(CalenderWindow, SWT.BORDER | SWT.FULL_SELECTION);
    table.setBounds(0, 0, 557, 315);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn SunColumn = new TableColumn(table, SWT.NONE);
    SunColumn.setWidth(79);
    SunColumn.setText("Sunday");

    TableColumn MonColumn = new TableColumn(table, SWT.NONE);
    MonColumn.setWidth(79);
    MonColumn.setText("Monday");

    TableColumn TueColumn = new TableColumn(table, SWT.NONE);
    TueColumn.setWidth(79);
    TueColumn.setText("Tuesday");

    TableColumn WedsColumn = new TableColumn(table, SWT.NONE);
    WedsColumn.setWidth(79);
    WedsColumn.setText("Wednesday");

    TableColumn ThuColumn = new TableColumn(table, SWT.NONE);
    ThuColumn.setWidth(79);
    ThuColumn.setText("Thursday");

    TableColumn FriColumn = new TableColumn(table, SWT.NONE);
    FriColumn.setWidth(79);
    FriColumn.setText("Friday");

    TableColumn SatColumn = new TableColumn(table, SWT.NONE);
    SatColumn.setWidth(79);
    SatColumn.setText("Saturday");

    //
    Label LabelSelectedCourses = new Label(shlMcScheduler, SWT.NONE);
    LabelSelectedCourses.setLocation(621, 2);
    LabelSelectedCourses.setSize(112, 15);
    LabelSelectedCourses.setText("Selected Courses");

    Composite SelectedCoursesWindow = new Composite(shlMcScheduler, SWT.NONE);
    SelectedCoursesWindow.setBounds(571, 23, 206, 310);

    final List selectedList = new List(SelectedCoursesWindow, SWT.BORDER);
    selectedList.setBounds(0, 0, 206, 269);
    selectedList.add("No Courses Selected");

    Button btnRemoveCourse = new Button(SelectedCoursesWindow, SWT.NONE);
    btnRemoveCourse.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
            try {
              removeCurrentCourse(selectedList, selectedList.getSelection()[0]);
            } catch (ArrayIndexOutOfBoundsException error) {
              final ErrorDialog err = new ErrorDialog(shlMcScheduler, 1);
              err.open();
            }
          }
        });
    btnRemoveCourse.setBounds(111, 275, 95, 25);
    btnRemoveCourse.setText("Remove Course");

    Button btnAddCourse = new Button(SelectedCoursesWindow, SWT.NONE);
    btnAddCourse.setBounds(0, 275, 95, 25);
    btnAddCourse.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
            try {
              addCurrentCourse(selectedList, cList.getSelection()[0]);
            } catch (ArrayIndexOutOfBoundsException error) {
              final ErrorDialog err = new ErrorDialog(shlMcScheduler, 1);
              err.open();
            }
          }
        });
    btnAddCourse.setText("Add Course");
  }
示例#6
0
  @SuppressWarnings("unchecked")
  public void prepareForOpen() {
    Point contentsSize = contents.getSize();
    Point titleSize = new Point(0, 0);

    boolean showTitle = ((style & (SWT.CLOSE | SWT.TITLE)) != 0);
    if (showTitle) {
      if (titleLabel == null) {
        titleLabel = new Label(shell, SWT.NONE);
        titleLabel.setBackground(shell.getBackground());
        titleLabel.setForeground(shell.getForeground());
        FontData[] fds = shell.getFont().getFontData();
        for (int i = 0; i < fds.length; i++) {
          fds[i].setStyle(fds[i].getStyle() | SWT.BOLD);
        }
        final Font font = new Font(shell.getDisplay(), fds);
        titleLabel.addListener(
            SWT.Dispose,
            new Listener() {
              @Override
              public void handleEvent(Event event) {
                font.dispose();
              }
            });
        titleLabel.setFont(font);
        selectionControls.add(titleLabel);
      }
      String titleText = shell.getText();
      titleLabel.setText(titleText == null ? "" : titleText);
      titleLabel.pack();
      titleSize = titleLabel.getSize();

      final Image titleImage = shell.getImage();
      if (titleImageLabel == null && shell.getImage() != null) {
        titleImageLabel = new Canvas(shell, SWT.NONE);
        titleImageLabel.setBackground(shell.getBackground());
        titleImageLabel.setBounds(titleImage.getBounds());
        titleImageLabel.addListener(
            SWT.Paint,
            new Listener() {
              @Override
              public void handleEvent(Event event) {
                event.gc.drawImage(titleImage, 0, 0);
              }
            });
        Point tilSize = titleImageLabel.getSize();
        titleSize.x += tilSize.x + titleWidgetSpacing;
        if (tilSize.y > titleSize.y) titleSize.y = tilSize.y;
        selectionControls.add(titleImageLabel);
      }

      if (systemControlsBar == null && (style & SWT.CLOSE) != 0) {
        // Color closeFG = shell.getForeground(), closeBG = shell.getBackground();
        // Color closeFG = shell.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY), closeBG =
        // shell.getBackground();
        Color closeFG = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND),
            closeBG = shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
        final Image closeImage = createCloseImage(shell.getDisplay(), closeBG, closeFG);
        shell.addListener(
            SWT.Dispose,
            new Listener() {
              @Override
              public void handleEvent(Event event) {
                closeImage.dispose();
              }
            });
        systemControlsBar = new ToolBar(shell, SWT.FLAT);
        systemControlsBar.setBackground(closeBG);
        systemControlsBar.setForeground(closeFG);
        ToolItem closeItem = new ToolItem(systemControlsBar, SWT.PUSH);
        closeItem.setImage(closeImage);
        closeItem.addListener(
            SWT.Selection,
            new Listener() {
              @Override
              public void handleEvent(Event event) {
                shell.close();
              }
            });
        systemControlsBar.pack();
        Point closeSize = systemControlsBar.getSize();
        titleSize.x += closeSize.x + titleWidgetSpacing;
        if (closeSize.y > titleSize.y) titleSize.y = closeSize.y;
      }

      titleSize.y += titleSpacing;
      if (titleSize.x > contentsSize.x) {
        contentsSize.x = titleSize.x;
        contents.setSize(contentsSize.x, contentsSize.y);
      }
      contentsSize.y += titleSize.y;
    }

    Rectangle screen = shell.getDisplay().getClientArea();

    int anchor = preferredAnchor;
    if (anchor != SWT.NONE && autoAnchor && locX != Integer.MIN_VALUE) {
      if ((anchor & SWT.LEFT) != 0) {
        if (locX + contentsSize.x + marginLeft + marginRight - 16 >= screen.x + screen.width)
          anchor = anchor - SWT.LEFT + SWT.RIGHT;
      } else // RIGHT
      {
        if (locX - contentsSize.x - marginLeft - marginRight + 16 < screen.x)
          anchor = anchor - SWT.RIGHT + SWT.LEFT;
      }
      if ((anchor & SWT.TOP) != 0) {
        if (locY + contentsSize.y + 20 + marginTop + marginBottom >= screen.y + screen.height)
          anchor = anchor - SWT.TOP + SWT.BOTTOM;
      } else // BOTTOM
      {
        if (locY - contentsSize.y - 20 - marginTop - marginBottom < screen.y)
          anchor = anchor - SWT.BOTTOM + SWT.TOP;
      }
    }

    final Point shellSize =
        (anchor == SWT.NONE)
            ? new Point(
                contentsSize.x + marginLeft + marginRight,
                contentsSize.y + marginTop + marginBottom)
            : new Point(
                contentsSize.x + marginLeft + marginRight,
                contentsSize.y + marginTop + marginBottom + 20);

    if (shellSize.x < 54 + marginLeft + marginRight) shellSize.x = 54 + marginLeft + marginRight;
    if (anchor == SWT.NONE) {
      if (shellSize.y < 10 + marginTop + marginBottom) shellSize.y = 10 + marginTop + marginBottom;
    } else {
      if (shellSize.y < 30 + marginTop + marginBottom) shellSize.y = 30 + marginTop + marginBottom;
    }

    shell.setSize(shellSize);
    int titleLocY = marginTop + (((anchor & SWT.TOP) != 0) ? 20 : 0);
    contents.setLocation(marginLeft, titleSize.y + titleLocY);
    if (showTitle) {
      int realTitleHeight = titleSize.y - titleSpacing;
      if (titleImageLabel != null) {
        titleImageLabel.setLocation(
            marginLeft, titleLocY + (realTitleHeight - titleImageLabel.getSize().y) / 2);
        titleLabel.setLocation(
            marginLeft + titleImageLabel.getSize().x + titleWidgetSpacing,
            titleLocY + (realTitleHeight - titleLabel.getSize().y) / 2);
      } else
        titleLabel.setLocation(
            marginLeft, titleLocY + (realTitleHeight - titleLabel.getSize().y) / 2);
      if (systemControlsBar != null)
        systemControlsBar.setLocation(
            shellSize.x - marginRight - systemControlsBar.getSize().x,
            titleLocY + (realTitleHeight - systemControlsBar.getSize().y) / 2);
    }

    final Region region = new Region();
    region.add(createOutline(shellSize, anchor, true));

    shell.setRegion(region);
    shell.addListener(
        SWT.Dispose,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            region.dispose();
          }
        });

    final int[] outline = createOutline(shellSize, anchor, false);
    shell.addListener(
        SWT.Paint,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            event.gc.drawPolygon(outline);
          }
        });

    if (locX != Integer.MIN_VALUE) {
      Point shellLoc = new Point(locX, locY);
      if ((anchor & SWT.BOTTOM) != 0) shellLoc.y = shellLoc.y - shellSize.y + 1;
      if ((anchor & SWT.LEFT) != 0) shellLoc.x -= 15;
      else if ((anchor & SWT.RIGHT) != 0) shellLoc.x = shellLoc.x - shellSize.x + 16;

      if (autoAnchor) {
        if (shellLoc.x < screen.x) shellLoc.x = screen.x;
        else if (shellLoc.x > screen.x + screen.width - shellSize.x)
          shellLoc.x = screen.x + screen.width - shellSize.x;

        if (anchor == SWT.NONE) {
          if (shellLoc.y < screen.y) shellLoc.y = screen.y;
          else if (shellLoc.y > screen.y + screen.height - shellSize.y)
            shellLoc.y = screen.y + screen.height - shellSize.y;
        }
      }

      shell.setLocation(shellLoc);
    }
  }
示例#7
0
文件: Assets.java 项目: striko0/isms
  @PostConstruct
  public void createComposite(final Composite parent, IEclipseContext context) {

    final ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrollBox.setMinHeight(349);
    scrollBox.setMinWidth(650);

    scrollBox.setExpandHorizontal(true);
    scrollBox.setExpandVertical(true);

    mParent = new Composite(scrollBox, SWT.NONE);
    parent.getShell().setSize(759, 389);

    FormLayout layout = new FormLayout();
    layout.marginWidth = 5;
    layout.marginHeight = 5;
    mParent.setLayout(layout);

    parent.getShell().setText("Unesi novu imovinu");

    m_Table = NewASKTable1.m_TableAsset;
    m_Model = DataFromServer.listAssetASKTableModel;
    m_Row = NewASKTable1.clickedAssetRow;
    dB = new DataFromDatabase();

    Composite compositeLeft = new Composite(mParent, SWT.NONE);
    compositeLeft.setLayout(new FormLayout());
    compositeLeft.setBounds(5, 10, 392, 299);

    Label lblNaziv_ = new Label(compositeLeft, SWT.NONE);
    lblNaziv_.setText("Naziv:");

    textNaziv_ = new Text(compositeLeft, SWT.BORDER);

    Label lblKategorija_ = new Label(compositeLeft, SWT.NONE);
    lblKategorija_.setText("Kategorija:");

    comboKateg_ = new Combo(compositeLeft, SWT.READ_ONLY);
    comboPodkateg_ = new Combo(compositeLeft, SWT.READ_ONLY);
    comboPodkateg_.setEnabled(false);

    Label lblPodkateg_ = new Label(compositeLeft, SWT.NONE);
    lblPodkateg_.setText("Podkategorija:");

    Label lblNoisteljorgjed_ = new Label(compositeLeft, SWT.NONE);
    lblNoisteljorgjed_.setText("Nositelj (org.jed.):");

    comboNoisteljorgjed_ = new Combo(compositeLeft, SWT.NONE);

    textOpis_ = new Text(compositeLeft, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);

    Label lblOpis_ = new Label(compositeLeft, SWT.NONE);
    lblOpis_.setText("Opis:");

    Group grpVanostImovine = new Group(mParent, SWT.NONE);
    grpVanostImovine.setText("Va\u017Enost Imovine");
    grpVanostImovine.setLocation(413, 10);
    grpVanostImovine.setSize(328, 253);

    Label lblPovjerljivost_ = new Label(grpVanostImovine, SWT.NONE);
    lblPovjerljivost_.setLocation(15, 43);
    lblPovjerljivost_.setSize(73, 13);
    lblPovjerljivost_.setText("Povjerljivost:");

    comboPovjerljivost_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboPovjerljivost_.setLocation(90, 40);
    comboPovjerljivost_.setSize(180, 21);

    Label lblCjelovitost = new Label(grpVanostImovine, SWT.NONE);
    lblCjelovitost.setLocation(15, 73);
    lblCjelovitost.setSize(65, 13);
    lblCjelovitost.setText("Cjelovitost:");

    comboCjelovitost_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboCjelovitost_.setLocation(90, 70);
    comboCjelovitost_.setSize(180, 21);

    Label lblRaspoloivost_ = new Label(grpVanostImovine, SWT.NONE);
    lblRaspoloivost_.setLocation(15, 103);
    lblRaspoloivost_.setSize(73, 13);
    lblRaspoloivost_.setText("Raspolo\u017Eivost:");

    comboRaspolozivost_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboRaspolozivost_.setLocation(90, 100);
    comboRaspolozivost_.setSize(180, 21);

    Label lblBi_ = new Label(grpVanostImovine, SWT.NONE);
    lblBi_.setLocation(15, 133);
    lblBi_.setSize(65, 13);
    lblBi_.setText("P. Utjecaj:");

    comboBi_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboBi_.setLocation(90, 130);
    comboBi_.setSize(180, 21);

    Label lblObjanjenjeostalo_ = new Label(grpVanostImovine, SWT.NONE);
    lblObjanjenjeostalo_.setText("Obja\u0161njenje (Poslovni utjecaj):");
    lblObjanjenjeostalo_.setBounds(15, 163, 165, 13);

    textObjanjenjeostalo_ = new Text(grpVanostImovine, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
    textObjanjenjeostalo_.setBounds(10, 180, 308, 92);

    Button btnDescriptionPov_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionPov_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionPov_.setBounds(276, 40, 42, 23);
    btnDescriptionPov_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 1);
          }
        });

    Button btnDescriptionCje_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionCje_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionCje_.setBounds(276, 70, 42, 23);
    btnDescriptionCje_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 2);
          }
        });

    Button btnDescriptionRas_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionRas_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionRas_.setBounds(276, 100, 42, 23);
    btnDescriptionRas_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 3);
          }
        });

    Button btnDescriptionBi_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionBi_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionBi_.setBounds(276, 130, 42, 23);
    btnDescriptionBi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 4);
          }
        });

    Composite compositeButtons_ = new Composite(mParent, SWT.NONE);
    compositeButtons_.setBounds(506, 315, 235, 33);
    compositeButtons_.setLayout(new GridLayout(2, false));

    Button btnSpremi_ = new Button(compositeButtons_, SWT.NONE);
    btnSpremi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            //				dirty.setDirty(true);
            saveAction();
            if (m_Row != 0) mParent.getShell().close();
            action = 1;
          }
        });
    GridData gd_btnSpremi_ = new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1);
    gd_btnSpremi_.widthHint = 100;
    btnSpremi_.setText("Spremi");
    btnSpremi_.setLayoutData(gd_btnSpremi_);

    Button btnIzlaz_ = new Button(compositeButtons_, SWT.CENTER);
    GridData gd_btnIzlaz_ = new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1);
    gd_btnIzlaz_.widthHint = 100;
    btnIzlaz_.setLayoutData(gd_btnIzlaz_);
    btnIzlaz_.setLayoutData(gd_btnIzlaz_);
    btnIzlaz_.setText("Izlaz");
    btnIzlaz_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            mParent.getShell().close();
          }
        });

    // **********compositeLeft layout
    FormData co_compositeLeft = new FormData();
    co_compositeLeft.right = new FormAttachment(grpVanostImovine, -15);
    co_compositeLeft.left = new FormAttachment(0);
    co_compositeLeft.bottom = new FormAttachment(90, 0);
    co_compositeLeft.top = new FormAttachment(0);
    compositeLeft.setLayoutData(co_compositeLeft);

    // **********lblNaziv_ layout
    FormData data = new FormData();
    data.right = new FormAttachment(0, 50);
    data.top = new FormAttachment(0, 13);
    data.left = new FormAttachment(0, 15);
    lblNaziv_.setLayoutData(data);

    // ************textNaziv_ layout
    FormData data1 = new FormData();
    data1.right = new FormAttachment(100, -5);
    data1.top = new FormAttachment(0, 10);
    data1.left = new FormAttachment(0, 125);
    textNaziv_.setLayoutData(data1);

    // **********lblKategorija_ layout
    FormData data2 = new FormData();
    data2.right = new FormAttachment(0, 73);
    data2.top = new FormAttachment(0, 43);
    data2.left = new FormAttachment(0, 15);
    lblKategorija_.setLayoutData(data2);

    // **********comboKateg_ layout
    FormData fd_comboKateg_ = new FormData();
    fd_comboKateg_.right = new FormAttachment(100, -70);
    fd_comboKateg_.top = new FormAttachment(0, 40);
    fd_comboKateg_.left = new FormAttachment(0, 125);
    comboKateg_.setLayoutData(fd_comboKateg_);

    // **********lblPodkateg_ layout
    FormData fd_lblPodkateg_ = new FormData();
    fd_lblPodkateg_.right = new FormAttachment(0, 88);
    fd_lblPodkateg_.top = new FormAttachment(0, 73);
    fd_lblPodkateg_.left = new FormAttachment(0, 15);
    lblPodkateg_.setLayoutData(fd_lblPodkateg_);

    // **********comboPodkateg_ layout
    FormData fd_comboPodkateg_ = new FormData();
    fd_comboPodkateg_.right = new FormAttachment(100, -50);
    fd_comboPodkateg_.top = new FormAttachment(0, 70);
    fd_comboPodkateg_.left = new FormAttachment(0, 125);
    comboPodkateg_.setLayoutData(fd_comboPodkateg_);

    // **********lblNoisteljorgjed_ layout
    FormData fd_lblNoisteljorgjed_ = new FormData();
    fd_lblNoisteljorgjed_.right = new FormAttachment(0, 110);
    fd_lblNoisteljorgjed_.top = new FormAttachment(0, 103);
    fd_lblNoisteljorgjed_.left = new FormAttachment(0, 15);
    lblNoisteljorgjed_.setLayoutData(fd_lblNoisteljorgjed_);

    // **********comboNoisteljorgjed_ layout
    FormData fd_comboNoisteljorgjed_ = new FormData();
    fd_comboNoisteljorgjed_.right = new FormAttachment(100, -5);
    fd_comboNoisteljorgjed_.top = new FormAttachment(0, 100);
    fd_comboNoisteljorgjed_.left = new FormAttachment(0, 125);
    comboNoisteljorgjed_.setLayoutData(fd_comboNoisteljorgjed_);

    // **********lblOpis_ layout
    FormData fd_lblOpis_ = new FormData();
    fd_lblOpis_.bottom = new FormAttachment(textOpis_, -6);
    fd_lblOpis_.left = new FormAttachment(lblNaziv_, 0, SWT.LEFT);
    fd_lblOpis_.right = new FormAttachment(0, 50);
    lblOpis_.setLayoutData(fd_lblOpis_);

    // **********textOpis_ layout
    FormData fd_textOpis_ = new FormData();
    fd_textOpis_.bottom = new FormAttachment(100, 0);
    fd_textOpis_.right = new FormAttachment(100, -5);
    fd_textOpis_.top = new FormAttachment(0, 180);
    fd_textOpis_.left = new FormAttachment(0, 15);
    textOpis_.setLayoutData(fd_textOpis_);

    // **********grpVanostImovine layout
    FormData fd_grpVanostImovine = new FormData();
    fd_grpVanostImovine.top = new FormAttachment(0);
    // fd_grpVanostImovine.bottom = new FormAttachment(100, -72);
    // fd_grpVanostImovine.left = new FormAttachment(compositeLeft, 5);
    fd_grpVanostImovine.right = new FormAttachment(100, 0);
    grpVanostImovine.setLayoutData(fd_grpVanostImovine);

    // **********textObjanjenjeostalo_ layout
    FormData fd_textObjanjenjeostalo = new FormData();
    fd_textObjanjenjeostalo.top = new FormAttachment(comboBi_, 0);
    fd_textObjanjenjeostalo.bottom = new FormAttachment(100, 0);
    fd_textObjanjenjeostalo.right = new FormAttachment(100, 0);
    textObjanjenjeostalo_.setLayoutData(fd_textObjanjenjeostalo);

    // **********compositeButtons_ layout
    FormData data6 = new FormData();
    data6.top = new FormAttachment(grpVanostImovine, 34);
    data6.right = new FormAttachment(100, 0);
    // data6.bottom = new FormAttachment(100, 0);
    compositeButtons_.setLayoutData(data6);

    fillForm();

    scrollBox.setContent(mParent);
    mParent.getShell().setDefaultButton(btnSpremi_);
  }
示例#8
0
文件: UI.java 项目: hafnium/Hafnium
  /** Initializes the GUI. */
  private void initGUI() {
    try {
      this.setBackground(SWTResourceManager.getColor(192, 192, 192));
      FormLayout thisLayout = new FormLayout();
      this.setLayout(thisLayout);
      this.layout();
      this.setSize(1024, 768);

      // Set up the header and the close button that goes on the header
      {
        FormData composite1LData = new FormData();
        composite1LData.width = 1024;
        composite1LData.height = 120;
        composite1LData.left = new FormAttachment(0, 1000, 0);
        composite1LData.top = new FormAttachment(0, 1000, 0);
        headerContainer = new Composite(this, SWT.NONE);
        headerContainer.setLayout(null);
        headerContainer.setLayoutData(composite1LData);
        headerContainer.setBackgroundImage(
            ImageLoader.load(this.getDisplay(), "resources/header.png"));
        {
          closeButton = new Label(headerContainer, SWT.PUSH | SWT.CENTER);
          closeButton.setLocation(new org.eclipse.swt.graphics.Point(100, 0));
          closeButton.setBounds(958, -2, 66, 33);
          closeButton.setImage(ImageLoader.load(this.getDisplay(), "resources/closeIcon.png"));
          closeButton.addMouseListener(
              new MouseAdapter() {
                public void mouseDown(MouseEvent evt) {
                  closeButtonMouseDown(evt);
                }
              });
        }
      }
      {
        FormData mainContentContainerLData = new FormData();
        mainContentContainerLData.width = 834;
        mainContentContainerLData.height = 648;
        mainContentContainerLData.left = new FormAttachment(0, 1000, 190);
        mainContentContainerLData.top = new FormAttachment(0, 1000, 120);
        mainContentContainer = new Composite(this, SWT.NONE);
        mainContentContainer.setLayout(null);
        mainContentContainer.setLayoutData(mainContentContainerLData);
        mainContentContainer.setBackground(SWTResourceManager.getColor(255, 255, 255));
        {
          mainNavigation = new ToolBar(mainContentContainer, SWT.FLAT | SWT.WRAP);
          mainNavigation.setBounds(0, 0, 835, 85);
          mainNavigation.setLayoutData(new FillLayout());
          mainNavigation.setBackground(SWTResourceManager.getColor(239, 239, 239));
          // Create the navigation tab bar
          {
            navigation = new NavigationBar(this.getDisplay(), this.mainContentContainer);
            navigation.createNavigationElement(
                home.getComponents("hvac"),
                mainNavigation,
                "resources/navigationIcons/hvac_active.png",
                "resources/navigationIcons/hvac_inactive.png");
            navigation.createNavigationElement(
                home.getComponents("lighting"),
                mainNavigation,
                "resources/navigationIcons/lighting_active.png",
                "resources/navigationIcons/lighting_inactive.png");
            navigation.createNavigationElement(
                home.getComponents("entertainment"),
                mainNavigation,
                "resources/navigationIcons/entertainment_active.png",
                "resources/navigationIcons/entertainment_inactive.png");
            navigation.createNavigationElement(
                home.getComponents("security"),
                mainNavigation,
                "resources/navigationIcons/security_active.png",
                "resources/navigationIcons/security_inactive.png");
            navigation.createNavigationElement(
                home.getComponents("other"),
                mainNavigation,
                "resources/navigationIcons/appliances_active.png",
                "resources/navigationIcons/appliances_inactive.png");
          }
          mainNavigation.pack();
        }

        {
          ambientTemperatureLabel = new Label(mainContentContainer, SWT.NONE);
          ambientTemperatureLabel.setText("Ambient Temperature: 0" + degreeSymbol);
          ambientTemperatureLabel.setBounds(176, 117, 385, 39);
          ambientTemperatureLabel.setBackground(SWTResourceManager.getColor(32, 32, 32));
          ambientTemperatureLabel.setForeground(SWTResourceManager.getColor(255, 255, 255));
          ambientTemperatureLabel.setFont(
              SWTResourceManager.getFont("Gill Sans MT", 18, 1, false, false));
          ambientTemperatureLabel.setAlignment(SWT.CENTER);
        }
      }

      // Set up the sidebar
      {
        // Make it look pretty
        FormData sideBarContainerLData = new FormData();
        sideBarContainerLData.width = 190;
        sideBarContainerLData.height = 647;
        sideBarContainerLData.left = new FormAttachment(0, 1000, 0);
        sideBarContainerLData.top = new FormAttachment(0, 1000, 120);
        sideBarContainer = new Composite(this, SWT.NONE);
        sideBarContainer.setLayout(null);
        sideBarContainer.setLayoutData(sideBarContainerLData);
        sideBarContainer.setBackgroundImage(
            ImageLoader.load(this.getDisplay(), "resources/sidebar.png"));

        // Current weather section
        {
          currentWeatherLabel = new Label(sideBarContainer, SWT.NONE);
          currentWeatherLabel.setText("Current Weather");
          currentWeatherLabel.setFont(
              SWTResourceManager.getFont("Gill Sans MT", 13, 1, false, false));
          currentWeatherLabel.setBounds(13, 24, 161, 25);
          currentWeatherLabel.setForeground(SWTResourceManager.getColor(51, 51, 51));
          currentWeatherLabel.setAlignment(SWT.CENTER);
        }
        {
          currentWeatherIcon = new Label(sideBarContainer, SWT.NONE);
          currentWeatherIcon.setBounds(43, 61, 100, 100);
          currentWeatherIcon.setSize(93, 93);
        }
        {
          currentWeatherTemperature = new Label(sideBarContainer, SWT.NONE);
          currentWeatherTemperature.setBounds(17, 160, 160, 43);
          currentWeatherTemperature.setFont(
              SWTResourceManager.getFont("Gill Sans MT", 24, 1, false, false));
          currentWeatherTemperature.setForeground(SWTResourceManager.getColor(51, 51, 51));
          currentWeatherTemperature.setAlignment(SWT.CENTER);
        }
        {
          currentWeatherAdditional = new Label(sideBarContainer, SWT.NONE);
          currentWeatherAdditional.setFont(
              SWTResourceManager.getFont("Gill Sans MT", 8, 1, false, false));
          currentWeatherAdditional.setForeground(SWTResourceManager.getColor(51, 51, 51));
          currentWeatherAdditional.setBounds(11, 202, 166, 47);
          currentWeatherAdditional.setAlignment(SWT.CENTER);
        }

        LocalWeather localWeather = new LocalWeather(home.getLocation().getZipcode());

        currentWeatherTemperature.setText("" + localWeather.getTemperature() + degreeSymbol + "F");
        currentWeatherIcon.setImage(localWeather.getCurrentImage(this.getDisplay()));
        currentWeatherAdditional.setText(
            "Today's High: "
                + localWeather.getHighTemperature()
                + "\nPrecipitation: "
                + localWeather.getPrecipitation()
                + "%");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }