Example #1
0
  private void addButtons() {
    if ((flags & SWT.CLOSE) != 0) {
      closeButton = new Label(composite, SWT.NONE);
      closeButton.setSize(getHeight(), getHeight());
      closeButton.setImage(closeImage);

      closeButton.addListener(SWT.MouseUp, buttonListener);
      closeButton.addListener(SWT.MouseEnter, buttonListener);
      closeButton.addListener(SWT.MouseExit, buttonListener);
    }

    if ((flags & SWT.MIN) != 0) {
      minimizeButton = new Label(composite, SWT.PUSH | SWT.FLAT);
      minimizeButton.setSize(getHeight(), getHeight());
      minimizeButton.setImage(minimizeImage);

      minimizeButton.addListener(SWT.MouseUp, buttonListener);
      minimizeButton.addListener(SWT.MouseEnter, buttonListener);
      minimizeButton.addListener(SWT.MouseExit, buttonListener);
    }

    if ((flags & SWT.MAX) != 0) {
      restoreButton = new Label(composite, SWT.PUSH | SWT.FLAT);
      restoreButton.setSize(getHeight(), getHeight());
      restoreButton.setImage(restoreImage);

      restoreButton.addListener(SWT.MouseUp, buttonListener);
      restoreButton.addListener(SWT.MouseEnter, buttonListener);
      restoreButton.addListener(SWT.MouseExit, buttonListener);
    }

    setForeground(new Color(Display.getDefault(), 40, 40, 40));
    setBackground(new Color(Display.getDefault(), 140, 140, 140));
  }
Example #2
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();
   }
 }
  @Override
  protected void addFields() {

    // Header Fields
    Composite mainComposite =
        Form.startNewDimensionnedGridLayout(this, 2, WIDTH_GRIDDATA_PIXEL, 60);
    metadataNameText =
        new LabelledText(
            mainComposite, Messages.getString("FileStep3.metadataName")); // $NON-NLS-1$
    metadataCommentText =
        new LabelledText(
            mainComposite, Messages.getString("FileStep3.metadataComment")); // $NON-NLS-1$

    // Group MetaData
    Group groupMetaData =
        Form.createGroup(
            this, 1, Messages.getString("FileStep3.groupMetadata"), 280); // $NON-NLS-1$
    Composite compositeMetaData = Form.startNewGridLayout(groupMetaData, 1);

    // Composite Guess
    Composite compositeGuessButton =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 2, WIDTH_GRIDDATA_PIXEL, 40);
    informationLabel = new Label(compositeGuessButton, SWT.NONE);
    informationLabel.setText(
        Messages.getString("FileStep3.informationLabel")
            + "                                                  "); //$NON-NLS-1$ //$NON-NLS-2$
    informationLabel.setSize(500, HEIGHT_BUTTON_PIXEL);

    guessButton =
        new UtilsButton(
            compositeGuessButton,
            Messages.getString("FileStep3.guess"),
            WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
            HEIGHT_BUTTON_PIXEL);
    guessButton.setToolTipText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$

    // Composite MetadataTableEditorView
    Composite compositeTable =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 1, WIDTH_GRIDDATA_PIXEL, 200);
    compositeTable.setLayout(new FillLayout());
    metadataEditor =
        new MetadataEmfTableEditor(
            Messages.getString("FileStep3.metadataDescription")); // $NON-NLS-1$
    tableEditorView = new MetadataEmfTableEditorView(compositeTable, SWT.NONE);

    if (!isInWizard()) {
      // Bottom Button
      Composite compositeBottomButton =
          Form.startNewGridLayout(this, 2, false, SWT.CENTER, SWT.CENTER);
      // Button Cancel
      cancelButton =
          new UtilsButton(
              compositeBottomButton,
              Messages.getString("CommonWizard.cancel"),
              WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
              HEIGHT_BUTTON_PIXEL);
    }
    // addUtilsButtonListeners(); changed by hqzhang, need not call here, has been called in
    // setupForm()
  }
Example #4
0
  @Override
  protected void createControl(Composite parent) {

    Label label = new Label(parent, SWT.NONE);
    label.setText(getLabelText());
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));

    Composite comp = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fText = new Text(comp, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 200;
    fText.setLayoutData(data);

    // make sure rows are the same height on both panels.
    label.setSize(label.getSize().x, fText.getSize().y);

    if (getInitialValue() != null) {
      fText.setText(getInitialValue());
    }

    fCurrentSelection = fText.getText();

    fText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            fCurrentSelection = fText.getText();
            getDialog().validateFields();
          }
        });

    Button button = createButton(comp, IDialogConstants.IGNORE_ID, "&Browse...", false);
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            String selected =
                FileSelector.getFile(
                    getDialog().getShell(),
                    fText.getText(),
                    fFileValidator,
                    fFilter,
                    fRoot,
                    fCurrentDir);

            if (selected != null) {
              fCurrentSelection = fText.getText();
              fText.setText(selected);
              getDialog().validateFields();
            }
          }
        });
  }
Example #5
0
  private void setTitle(String title) {
    int textWidth = titleGC.textExtent(title).x;
    int textHeight = titleGC.textExtent(title).y;

    titleLabel.setText(title);
    titleLabel.setSize(textWidth, textHeight);

    setTitleLocation();
  }
Example #6
0
  public void createPartControl(Composite parent) {

    // top banner
    this.parent = parent;
    display = Display.getDefault();

    banner = new Composite(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    //		banner.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL,
    //				GridData.VERTICAL_ALIGN_BEGINNING, true, false));
    GridLayout layout = new GridLayout();
    layout.marginHeight = 20;
    layout.marginWidth = 30;
    layout.numColumns = 2;

    banner.setLayout(layout);
    left = new Composite(banner, SWT.BORDER);
    layout = new GridLayout();
    layout.numColumns = 1;
    left.setLayout(layout);

    right = new Composite(banner, SWT.BORDER);
    ;
    right.setLayout(new FillLayout());
    sstLabel = new Label(right, SWT.H_SCROLL);
    sstLabel.setSize(SHOT_W, SHOT_H);

    // setup bold font
    Font boldFont = JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);

    Label l = new Label(left, SWT.WRAP);
    l.setText("Welcome Device Manager!");
    l.setFont(boldFont);
    treeObj = null;

    pushSession = new ServerPushSession();
    pushSession.start();
    // register listener
    getSite().getPage().addSelectionListener(ListView.ID, (ISelectionListener) this);
  }
  /** 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");
  }
Example #8
0
  public boolean createTable(
      int lenX, int lenY, String[][] dataArray, typeOfCell[][] type, Object[][] extra) {
    int[] widthArr = new int[lenX];
    for (int i = 0; i < lenX; i++) widthArr[i] = normalWidth;
    widthArr[0] = Width0;
    Table varTable = new Table(_parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    if (lenY > 30) {
      if (debug) System.out.println("lenY=" + lenY);
      varTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    }
    // else varTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 10));

    varTable.setHeaderVisible(true);
    TableColumn tableColumn[] = new TableColumn[lenX];
    for (int i = 0; i < lenX; i++) {
      tableColumn[i] = new TableColumn(varTable, SWT.LEFT);
      tableColumn[i].setText(_columnName[i]);
      tableColumn[i].setWidth(widthArr[i]);
    }
    TableItem Sp[] = new TableItem[lenY];
    String[] value = new String[lenX];
    for (int j = 0; j < lenY; j++) {
      for (int i = 0; i < lenX; i++) value[i] = dataArray[i][j];
      Sp[j] = new TableItem(varTable, SWT.NONE);
      Sp[j].setText(value);

      for (int i = 0; i < lenX; i++) {
        switch (type[i][j]) {
          case Combo:
            int current = -1;
            combo = new CCombo(varTable, SWT.NONE);
            Object valueArr = extra[i][j];
            if (valueArr instanceof String[]) {
              String[] valueAsString = (String[]) valueArr;
              for (int k = 0; k < valueAsString.length; k++) {
                combo.add(valueAsString[k]);
                if (valueAsString[k].compareTo(dataArray[i][j]) == 0) current = k;
              }
              if (current == -1) {
                // org.csstudio.diag.IOCremoteManagement.Activator.errorPrint ("Wrong comboSelect");
                System.out.println("Wrong comboSelect");
              } else combo.select(current);

              TableEditor editor = new TableEditor(varTable);
              editor.grabHorizontal = editor.grabVertical = true;
              editor.setEditor(combo, Sp[j], i);
              if (dataArray[0][j].compareTo(ssRunCtrlStr) == 0) {
                comboSsRunCtrl = combo;
                comboSsRunCtrl.addSelectionListener(
                    new SelectionAdapter() {
                      public void widgetSelected(SelectionEvent e) {
                        overwriteSS();
                      }
                    });
              } else if (dataArray[0][j].compareTo(this.currentStateStr) == 0) {
                comboCurrentState = combo;
                comboCurrentState.addSelectionListener(
                    new SelectionAdapter() {
                      public void widgetSelected(SelectionEvent e) {
                        overwriteCS();
                      }
                    });
              }

            } else {
              // org.csstudio.diag.IOCremoteManagement.Activator.errorPrint ("Wrong instance");
              System.out.println("Wrong instance");
            }
            break;

          case EditableText:
            Text txt = new Text(varTable, SWT.SINGLE | SWT.BORDER);
            txt.setText(dataArray[i][j]);
            txt.addSelectionListener(
                new SelectionAdapter() {
                  public void widgetDefaultSelected(SelectionEvent e) {
                    Text t = (Text) e.widget;
                    valueChanged(t.getText());
                    System.out.println("DummyListenerText");
                  }
                });
            TableEditor editor = new TableEditor(varTable);
            editor.grabHorizontal = editor.grabVertical = true;
            editor.setEditor(txt, Sp[j], i);
            break;
            //				TODO jhatje: implement new datatypes
            //				case MB3_member:
            //					ListViewer listMB3 = new ListViewer(varTable, SWT.NONE);
            //					final String[] arr = new String[1];
            //					arr[0]=dataArray[i][j];
            //					listMB3.setContentProvider(new IStructuredContentProvider() {
            //					public void dispose() {
            //					}
            //					public Object[] getElements(Object inputElement) {
            //					IProcessVariable[] ipv = new IProcessVariable[1];
            //					ipv[0] = CentralItemFactory.createProcessVariable(arr[0]);
            //					return ipv;
            //					}
            //					public void inputChanged(Viewer viewer,Object oldInput, Object newInput) {
            //					}
            //					});
            //
            //					listMB3.setLabelProvider(new ILabelProvider() {
            //					public Image getImage(Object element) {
            //					return null;
            //					}
            //					public String getText(Object element) {
            //					IProcessVariable ipv = (IProcessVariable) element;
            //					return ipv.getName();
            //					}
            //					public void addListener(ILabelProviderListener listener) {
            //					}
            //					public void dispose() {
            //					}
            //					public boolean isLabelProperty(Object element,String property) {
            //					return false;
            //					}
            //					public void removeListener(
            //						ILabelProviderListener listener) {
            //					}
            //					});
            //					listMB3.setInput(arr);
            //					editor = new TableEditor(varTable);
            //					editor.grabHorizontal = editor.grabVertical = true;
            //
            //					List list =  listMB3.getList();
            //					list.setForeground(_display.getSystemColor(SWT.COLOR_BLUE));
            //					editor.setEditor( list, Sp[j], 1);
            //					new ProcessVariableDragSource (listMB3.getControl(), listMB3);
            //					makeContextMenu(listMB3);
            //				break;

          case Message:
            Group textGroup = new Group(_parent, SWT.NONE);
            GridLayout gridLayout = new GridLayout();
            textGroup.setLayout(gridLayout);
            gridLayout.numColumns = 1;
            textGroup.setLayoutData(
                new GridData(
                    /*GridData.GRAB_HORIZONTAL|GridData.HORIZONTAL_ALIGN_FILL|*/ GridData
                        .VERTICAL_ALIGN_FILL));
            textGroup.setText("Message:");
            Label labelWrap = new Label(textGroup, SWT.WRAP | SWT.BORDER);
            labelWrap.setText(dataArray[i][j]);
            labelWrap.setSize(20, 50);
            break;

          case String:
            break;
          default:
            // org.csstudio.diag.IOCremoteManagement.Activator.errorPrint ("Wrong switch");
            System.out.println("Wrong switch");
            break;
        }
      }
    }

    if (_warning) {
      varTable.setForeground(_display.getSystemColor(SWT.COLOR_RED));
      varTable.setBackground(_display.getSystemColor(SWT.COLOR_YELLOW));
    }

    if (debug) System.out.println("result is OK");
    // org.csstudio.diag.IOCremoteManagement.Activator.errorPrint ("result is OK");
    return true;
  }
  /** Opens the Dialog Shell. Auto-generated code - any changes you make will disappear. */
  public void open() {
    try {
      preInitGUI();

      Shell parent = getParent();
      dialogShell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
      dialogShell.setText(getText());

      composite2 = new Composite(dialogShell, SWT.NULL);
      isLocalBtn = new Button(composite2, SWT.CHECK | SWT.LEFT);
      isAbstractBtn = new Button(composite2, SWT.CHECK | SWT.LEFT);
      repositoryIdTxt = new Text(composite2, SWT.BORDER);
      versionTxt = new Text(composite2, SWT.BORDER);
      identifierTxt = new Text(composite2, SWT.BORDER);
      versionLb = new Label(composite2, SWT.NULL);
      repositoryIdLb = new Label(composite2, SWT.NULL);
      idLb = new Label(composite2, SWT.NULL);
      composite3 = new Composite(dialogShell, SWT.NULL);
      cancel = new Button(composite3, SWT.PUSH | SWT.CENTER);
      enter = new Button(composite3, SWT.PUSH | SWT.CENTER);

      dialogShell.setText("Add Module");
      dialogShell.setSize(new org.eclipse.swt.graphics.Point(476, 145));

      GridData composite2LData = new GridData();
      composite2LData.verticalAlignment = GridData.CENTER;
      composite2LData.horizontalAlignment = GridData.BEGINNING;
      composite2LData.widthHint = 464;
      composite2LData.heightHint = 102;
      composite2LData.horizontalIndent = 0;
      composite2LData.horizontalSpan = 1;
      composite2LData.verticalSpan = 1;
      composite2LData.grabExcessHorizontalSpace = false;
      composite2LData.grabExcessVerticalSpace = false;
      composite2.setLayoutData(composite2LData);
      composite2.setSize(new org.eclipse.swt.graphics.Point(464, 102));

      FormData isLocalBtnLData = new FormData();
      isLocalBtnLData.height = 20;
      isLocalBtnLData.width = 70;
      isLocalBtnLData.left = new FormAttachment(519, 1000, 0);
      isLocalBtnLData.right = new FormAttachment(750, 1000, 0);
      isLocalBtnLData.top = new FormAttachment(700, 1000, 0);
      isLocalBtnLData.bottom = new FormAttachment(897, 1000, 0);
      isLocalBtn.setLayoutData(isLocalBtnLData);
      isLocalBtn.setText("is local");
      isLocalBtn.setSize(new org.eclipse.swt.graphics.Point(70, 20));
      final Font isLocalBtnfont = new Font(Display.getDefault(), "Tahoma", 8, 1);
      isLocalBtn.setFont(isLocalBtnfont);

      FormData isAbstractBtnLData = new FormData();
      isAbstractBtnLData.height = 20;
      isAbstractBtnLData.width = 100;
      isAbstractBtnLData.left = new FormAttachment(239, 1000, 0);
      isAbstractBtnLData.right = new FormAttachment(475, 1000, 0);
      isAbstractBtnLData.top = new FormAttachment(700, 1000, 0);
      isAbstractBtnLData.bottom = new FormAttachment(897, 1000, 0);
      isAbstractBtn.setLayoutData(isAbstractBtnLData);
      isAbstractBtn.setText("is abstract");
      isAbstractBtn.setSize(new org.eclipse.swt.graphics.Point(100, 20));
      isAbstractBtn.setFont(isLocalBtnfont);

      FormData repositoryIdTxtLData = new FormData();
      repositoryIdTxtLData.height = 13;
      repositoryIdTxtLData.width = 352;
      repositoryIdTxtLData.left = new FormAttachment(239, 1000, 0);
      repositoryIdTxtLData.right = new FormAttachment(996, 1000, 0);
      repositoryIdTxtLData.top = new FormAttachment(269, 1000, 0);
      repositoryIdTxtLData.bottom = new FormAttachment(465, 1000, 0);
      repositoryIdTxt.setLayoutData(repositoryIdTxtLData);
      repositoryIdTxt.setDoubleClickEnabled(false);
      final Font repositoryIdTxtfont = new Font(Display.getDefault(), "Tahoma", 7, 0);
      repositoryIdTxt.setFont(repositoryIdTxtfont);
      repositoryIdTxt.setEditable(false);
      repositoryIdTxt.setSize(new org.eclipse.swt.graphics.Point(352, 13));
      repositoryIdTxt.setEnabled(false);

      FormData versionTxtLData = new FormData();
      versionTxtLData.height = 13;
      versionTxtLData.width = 352;
      versionTxtLData.left = new FormAttachment(239, 1000, 0);
      versionTxtLData.right = new FormAttachment(996, 1000, 0);
      versionTxtLData.top = new FormAttachment(485, 1000, 0);
      versionTxtLData.bottom = new FormAttachment(691, 1000, 0);
      versionTxt.setLayoutData(versionTxtLData);
      versionTxt.setFont(repositoryIdTxtfont);
      versionTxt.setSize(new org.eclipse.swt.graphics.Point(352, 13));
      versionTxt.addKeyListener(
          new KeyAdapter() {
            public void keyReleased(KeyEvent evt) {
              versionTxtKeyReleased(evt);
            }
          });

      FormData identifierTxtLData = new FormData();
      identifierTxtLData.height = 13;
      identifierTxtLData.width = 352;
      identifierTxtLData.left = new FormAttachment(239, 1000, 0);
      identifierTxtLData.right = new FormAttachment(996, 1000, 0);
      identifierTxtLData.top = new FormAttachment(48, 1000, 0);
      identifierTxtLData.bottom = new FormAttachment(250, 1000, 0);
      identifierTxt.setLayoutData(identifierTxtLData);
      identifierTxt.setFont(repositoryIdTxtfont);
      identifierTxt.setSize(new org.eclipse.swt.graphics.Point(352, 13));
      identifierTxt.setFocus();
      identifierTxt.addKeyListener(
          new KeyAdapter() {
            public void keyReleased(KeyEvent evt) {
              identifierTxtKeyReleased(evt);
            }
          });

      FormData versionLbLData = new FormData();
      versionLbLData.height = 20;
      versionLbLData.width = 90;
      versionLbLData.left = new FormAttachment(11, 1000, 0);
      versionLbLData.right = new FormAttachment(245, 1000, 0);
      versionLbLData.top = new FormAttachment(485, 1000, 0);
      versionLbLData.bottom = new FormAttachment(681, 1000, 0);
      versionLb.setLayoutData(versionLbLData);
      versionLb.setText("Version:");
      versionLb.setSize(new org.eclipse.swt.graphics.Point(90, 20));
      versionLb.setFont(isLocalBtnfont);

      FormData repositoryIdLbLData = new FormData();
      repositoryIdLbLData.height = 20;
      repositoryIdLbLData.width = 90;
      repositoryIdLbLData.left = new FormAttachment(11, 1000, 0);
      repositoryIdLbLData.right = new FormAttachment(245, 1000, 0);
      repositoryIdLbLData.top = new FormAttachment(269, 1000, 0);
      repositoryIdLbLData.bottom = new FormAttachment(465, 1000, 0);
      repositoryIdLb.setLayoutData(repositoryIdLbLData);
      repositoryIdLb.setText("Repository ID:");
      repositoryIdLb.setSize(new org.eclipse.swt.graphics.Point(90, 20));
      repositoryIdLb.setFont(isLocalBtnfont);

      FormData idLbLData = new FormData();
      idLbLData.height = 20;
      idLbLData.width = 90;
      idLbLData.left = new FormAttachment(11, 1000, 0);
      idLbLData.right = new FormAttachment(245, 1000, 0);
      idLbLData.top = new FormAttachment(53, 1000, 0);
      idLbLData.bottom = new FormAttachment(250, 1000, 0);
      idLb.setLayoutData(idLbLData);
      idLb.setText("Identifier:");
      idLb.setSize(new org.eclipse.swt.graphics.Point(90, 20));
      idLb.setFont(isLocalBtnfont);
      FormLayout composite2Layout = new FormLayout();
      composite2.setLayout(composite2Layout);
      composite2Layout.marginWidth = 0;
      composite2Layout.marginHeight = 0;
      composite2Layout.spacing = 0;
      composite2.layout();

      GridData composite3LData = new GridData();
      composite3LData.verticalAlignment = GridData.CENTER;
      composite3LData.horizontalAlignment = GridData.BEGINNING;
      composite3LData.widthHint = 466;
      composite3LData.heightHint = 46;
      composite3LData.horizontalIndent = 0;
      composite3LData.horizontalSpan = 1;
      composite3LData.verticalSpan = 1;
      composite3LData.grabExcessHorizontalSpace = false;
      composite3LData.grabExcessVerticalSpace = false;
      composite3.setLayoutData(composite3LData);
      composite3.setSize(new org.eclipse.swt.graphics.Point(466, 46));

      FormData cancelLData = new FormData();
      cancelLData.height = 21;
      cancelLData.width = 80;
      cancelLData.left = new FormAttachment(816, 1000, 0);
      cancelLData.right = new FormAttachment(988, 1000, 0);
      cancelLData.top = new FormAttachment(6, 1000, 0);
      cancelLData.bottom = new FormAttachment(580, 1000, 0);
      cancel.setLayoutData(cancelLData);
      cancel.setText("CANCEL");
      cancel.setSize(new org.eclipse.swt.graphics.Point(80, 21));
      cancel.setFont(isLocalBtnfont);
      cancel.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent evt) {
              cancelMouseDown(evt);
            }
          });

      FormData enterLData = new FormData();
      enterLData.height = 21;
      enterLData.width = 80;
      enterLData.left = new FormAttachment(623, 1000, 0);
      enterLData.right = new FormAttachment(795, 1000, 0);
      enterLData.top = new FormAttachment(6, 1000, 0);
      enterLData.bottom = new FormAttachment(580, 1000, 0);
      enter.setLayoutData(enterLData);
      enter.setText("ENTER");
      enter.setSize(new org.eclipse.swt.graphics.Point(80, 21));
      enter.setFont(isLocalBtnfont);
      enter.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent evt) {
              enterMouseDown(evt);
            }
          });
      FormLayout composite3Layout = new FormLayout();
      composite3.setLayout(composite3Layout);
      composite3Layout.marginWidth = 0;
      composite3Layout.marginHeight = 0;
      composite3Layout.spacing = 0;
      composite3.layout();
      GridLayout dialogShellLayout = new GridLayout(1, true);
      dialogShell.setLayout(dialogShellLayout);
      dialogShellLayout.marginWidth = 5;
      dialogShellLayout.marginHeight = 5;
      dialogShellLayout.numColumns = 1;
      dialogShellLayout.makeColumnsEqualWidth = true;
      dialogShellLayout.horizontalSpacing = 5;
      dialogShellLayout.verticalSpacing = 5;
      dialogShell.layout();
      dialogShell.addDisposeListener(
          new DisposeListener() {
            public void widgetDisposed(DisposeEvent e) {

              isLocalBtnfont.dispose();
              repositoryIdTxtfont.dispose();
            }
          });
      Rectangle bounds = dialogShell.computeTrim(0, 0, 476, 145);
      dialogShell.setSize(bounds.width, bounds.height);
      postInitGUI();
      dialogShell.open();
      Display display = dialogShell.getDisplay();
      while (!dialogShell.isDisposed()) {
        if (!display.readAndDispatch()) display.sleep();
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Example #10
0
  public void createPartControl(Composite parent) {
    GridLayout gl_parent = new GridLayout(1, false);
    gl_parent.verticalSpacing = 0;
    gl_parent.marginWidth = 0;
    gl_parent.marginHeight = 0;
    parent.setLayout(gl_parent);

    pvFomulaInputBar =
        new PVFormulaInputBar(
            parent, SWT.None, Activator.getDefault().getDialogSettings(), MEMENTO_PVFORMULA_LIST);
    pvFomulaInputBar.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent event) {
            if ("pvFormula".equals(event.getPropertyName())) { // $NON-NLS-1$
              setPVFormula((String) event.getNewValue());
            }
          }
        });

    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    pvFomulaInputBar.setLayoutData(gd);

    errorBar = new ErrorBar(parent, SWT.NONE);
    errorBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    errorBar.setMarginRight(5);
    errorBar.setMarginLeft(5);
    errorBar.setMarginBottom(5);

    ScrolledComposite mainScroll = new ScrolledComposite(parent, SWT.V_SCROLL);
    mainScroll.setExpandHorizontal(true);
    mainScroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    mainPanel =
        new Composite(mainScroll, SWT.NONE) {
          @Override
          public void layout() {
            // TODO Auto-generated method stub
            super.layout();
            mainPanel.setSize(mainPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
          }
        };
    GridLayout gl_mainPanel = new GridLayout();
    mainPanel.setLayout(gl_mainPanel);
    mainScroll.setContent(mainPanel);

    viewerPanel = new ViewerPanel(mainPanel, SWT.BORDER);
    viewerPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    viewerPanel.setEnabled(false);

    valuePanel = new ValuePanel(mainPanel, SWT.BORDER);
    valuePanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    changeValuePanel = new ChangeValuePanel(mainPanel, SWT.BORDER);
    changeValuePanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    metadataPanel = new MetadataPanel(mainPanel, SWT.BORDER);
    metadataPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    detailsPanel = new DetailsPanel(mainPanel, SWT.BORDER);
    detailsPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    // Status bar
    statusBarPanel = new Composite(parent, SWT.NONE);
    GridLayout gl_statusBarPanel = new GridLayout(1, false);
    gl_statusBarPanel.verticalSpacing = 0;
    gl_statusBarPanel.marginWidth = 0;
    gl_statusBarPanel.marginHeight = 0;
    statusBarPanel.setLayout(gl_statusBarPanel);
    statusBarPanel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label label = new Label(statusBarPanel, SWT.SEPARATOR | SWT.HORIZONTAL);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    label.setSize(64, 2);

    statusBar = new Composite(statusBarPanel, SWT.NONE);
    statusBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    statusBar.setLayout(new GridLayout(2, false));

    statusLabel = new Label(statusBar, 0);
    statusLabel.setSize(43, 20);
    statusLabel.setText(Messages.Probe_statusLabelText);

    statusField = new Label(statusBar, SWT.BORDER);
    statusField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    statusField.setSize(326, 22);
    statusField.setText(Messages.Probe_statusWaitingForPV);

    createActions();
    initializeToolBar();

    // Determine initial state
    String initialPVFormula = null;
    boolean showViewer = false;
    boolean showValue = true;
    boolean showChangeValue = true;
    boolean showMetadata = false;
    boolean showDetails = false;

    if (memento != null) {
      initialPVFormula = memento.getString(MEMENTO_PVFORMULA);
      showViewer = nullDefault(memento.getBoolean(MEMENTO_SHOW_VIEWER), showViewer);
      showValue = nullDefault(memento.getBoolean(MEMENTO_SHOW_VALUE), showValue);
      showChangeValue = nullDefault(memento.getBoolean(MEMENTO_SHOW_CHANGE_VALUE), showChangeValue);
      showMetadata = nullDefault(memento.getBoolean(MEMENTO_SHOW_METADATA), showMetadata);
      showDetails = nullDefault(memento.getBoolean(MEMENTO_SHOW_DETAILS), showDetails);
    }
    setPVFormula(initialPVFormula);
    initSection(viewerPanel, showViewer);
    initSection(valuePanel, showValue);
    initSection(changeValuePanel, showChangeValue);
    initSection(metadataPanel, showMetadata);
    initSection(detailsPanel, showDetails);

    parent.layout();
    mainPanel.layout();
  }
  @Override
  protected void addFields() {

    int leftCompositeWidth = 125;
    int rightCompositeWidth = WIDTH_GRIDDATA_PIXEL - leftCompositeWidth;
    int headerCompositeHeight = 80;
    int tableSettingsCompositeHeight = 15;
    int tableCompositeHeight = 200;

    int height = headerCompositeHeight + tableSettingsCompositeHeight + tableCompositeHeight;

    // Header Fields
    Composite mainComposite =
        Form.startNewDimensionnedGridLayout(this, 2, WIDTH_GRIDDATA_PIXEL, 60);

    SashForm sash = new SashForm(mainComposite, SWT.HORIZONTAL);
    GridData sashData = new GridData(GridData.FILL_BOTH);
    sash.setLayoutData(sashData);
    Composite leftComposite =
        Form.startNewDimensionnedGridLayout(sash, 1, leftCompositeWidth, height);
    Composite rightComposite =
        Form.startNewDimensionnedGridLayout(sash, 1, rightCompositeWidth, height);
    sash.setWeights(new int[] {1, 5});
    addTreeNavigator(leftComposite, leftCompositeWidth, height);
    metadataNameText =
        new LabelledText(
            rightComposite, Messages.getString("FileStep3.metadataName")); // $NON-NLS-1$
    metadataCommentText =
        new LabelledText(
            rightComposite, Messages.getString("FileStep3.metadataComment")); // $NON-NLS-1$

    // Group MetaData
    Group groupMetaData =
        Form.createGroup(
            rightComposite, 1, Messages.getString("FileStep3.groupMetadata"), 280); // $NON-NLS-1$
    Composite compositeMetaData = Form.startNewGridLayout(groupMetaData, 1);

    // Composite Guess
    Composite compositeGuessButton =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 2, WIDTH_GRIDDATA_PIXEL, 40);
    informationLabel = new Label(compositeGuessButton, SWT.NONE);
    informationLabel.setText(
        Messages.getString("FileStep3.informationLabel")
            + "                                                  "); //$NON-NLS-1$ //$NON-NLS-2$
    informationLabel.setSize(500, HEIGHT_BUTTON_PIXEL);

    guessButton =
        new UtilsButton(
            compositeGuessButton,
            Messages.getString("FileStep3.guess"),
            WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
            HEIGHT_BUTTON_PIXEL);
    guessButton.setToolTipText(Messages.getString("FileStep3.guessTip")); // $NON-NLS-1$

    // Composite MetadataTableEditorView
    Composite compositeTable =
        Form.startNewDimensionnedGridLayout(compositeMetaData, 1, WIDTH_GRIDDATA_PIXEL, 200);
    compositeTable.setLayout(new FillLayout());
    metadataEditor =
        new MetadataEmfTableEditor(
            Messages.getString("FileStep3.metadataDescription")); // $NON-NLS-1$
    tableEditorView = new MetadataEmfTableEditorView(compositeTable, SWT.NONE);

    if (!isInWizard()) {
      // Bottom Button
      Composite compositeBottomButton =
          Form.startNewGridLayout(this, 2, false, SWT.CENTER, SWT.CENTER);
      // Button Cancel
      cancelButton =
          new UtilsButton(
              compositeBottomButton,
              Messages.getString("CommonWizard.cancel"),
              WIDTH_BUTTON_PIXEL, //$NON-NLS-1$
              HEIGHT_BUTTON_PIXEL);
    }
    addUtilsButtonListeners();
  }
Example #12
0
  @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_);
  }
Example #13
0
  /** 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();
    }
  }