public Composite create(Composite parentComp) {

    Composite comp = new Composite(parentComp, SWT.EMBEDDED);
    comp.setLayout(new MigLayout());
    createGroup(comp, "车站信息浏览", "pos 0.5al 0.2al", null);
    return comp;
  }
  public void createControl(Composite parent) {
    Composite maincomposite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    maincomposite.setLayout(layout);

    GridData data = new GridData(GridData.FILL_BOTH);
    maincomposite.setLayoutData(data);

    showAttributes(maincomposite);

    IModelPropertyEditorAdapter a = support.getPropertyEditorAdapterByName("value");
    if (a instanceof JSFKnowledgeBaseAdapter) {
      ISelection s =
          getSpecificWizard().getWizardModel().getDropData().getSelectionProvider().getSelection();
      if (s instanceof TextSelection) {
        int offset = ((TextSelection) s).getOffset();
        context.put("offset", new Integer(offset));
      }
      ((JSFKnowledgeBaseAdapter) a).setContext(context);
    }

    setControl(maincomposite);
    getSpecificWizard()
        .getWizardModel()
        .addPropertyChangeListener(IDropWizardModel.TAG_PROPOSAL, this);
    updateTitle();
    runValidation();
  }
  @Override
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.makeColumnsEqualWidth = false;
    layout.horizontalSpacing = 5;
    layout.verticalSpacing = 10;
    container.setLayout(layout);

    createScrollArea(container);
    createAvailableList(container).setLayoutData(new GridData(GridData.FILL_BOTH));
    createButtonArea(container);
    createImportList(container).setLayoutData(new GridData(GridData.FILL_BOTH));
    updateCount();

    // create container for buttons
    Composite optionComp =
        SWTFactory.createComposite(container, 1, 3, GridData.FILL_HORIZONTAL, 5, 0);
    createComputationsOption(optionComp);
    createFilterOptions(optionComp);

    addViewerListeners();
    initialize();
    addFilters();
    setControl(container);
    Dialog.applyDialogFont(container);
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(container, IHelpContextIds.PLUGIN_IMPORT_SECOND_PAGE);
  }
  /**
   * Creates an instance of a ControlExample embedded inside the supplied parent Composite.
   *
   * @param parent the container of the example
   */
  public ControlExample(Composite parent) {
    initResources();
    tabFolder = new TabFolder(parent, SWT.NONE);
    tabs = createTabs();
    for (Tab tab : tabs) {
      TabItem item = new TabItem(tabFolder, SWT.NONE);
      item.setText(tab.getTabText());
      item.setControl(tab.createTabFolderPage(tabFolder));
      item.setData(tab);
    }

    /* Workaround: if the tab folder is wider than the screen,
     * Mac platforms clip instead of somehow scrolling the tab items.
     * We try to recover some width by using shorter tab names. */
    Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Rectangle monitorArea = parent.getMonitor().getClientArea();
    boolean isMac = SWT.getPlatform().equals("cocoa");
    if (size.x > monitorArea.width && isMac) {
      TabItem[] tabItems = tabFolder.getItems();
      for (int i = 0; i < tabItems.length; i++) {
        tabItems[i].setText(tabs[i].getShortTabText());
      }
    }
    startup = false;
  }
  private Composite createAvailableList(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData());

    Label label = new Label(container, SWT.NONE);
    label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList);

    Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 200;
    gd.widthHint = 225;
    table.setLayoutData(gd);

    fAvailableListViewer = new TableViewer(table);
    fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider());
    fAvailableListViewer.setContentProvider(new ContentProvider());
    fAvailableListViewer.setInput(PDECore.getDefault().getModelManager());
    fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);

    return container;
  }
Ejemplo n.º 6
0
 public void setEnabled(boolean isEnabled) {
   if (this.isEnabled != isEnabled) {
     this.isEnabled = isEnabled;
     avatarsPanel.setEnabled(isEnabled);
     avatarsPanel.layout(true);
   }
 }
  public void createControl(Composite parent) {

    Composite pageContent = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    pageContent.setLayout(layout);
    pageContent.setLayoutData(new GridData(GridData.FILL_BOTH));

    // variable never used ... is pageContent.getLayoutData() needed?
    // GridData outerFrameGridData = (GridData)
    pageContent.getLayoutData();

    //		outerFrameGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
    //		outerFrameGridData.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;

    //    WorkbenchHelp.setHelp(
    //        pageContent,
    //        B2BGUIContextIds.BTBG_SELECT_MULTI_FILE_PAGE);

    createLabels(pageContent);
    createSourceViewer(pageContent);
    createButtonPanel(pageContent);
    createSelectedListBox(pageContent);
    createImportButton(pageContent);

    setControl(pageContent);
    if (isFileMandatory) setPageComplete(false);
  }
Ejemplo n.º 8
0
 private void createRight(final Composite parent) {
   parent.setLayout(new FillLayout());
   Group styleGroup = new Group(parent, SWT.NONE);
   styleGroup.setText("Styles and Parameters");
   styleGroup.setLayout(new FillLayout());
   styleComp = new Composite(styleGroup, SWT.NONE);
   styleComp.setLayout(new RowLayout(SWT.VERTICAL));
 }
Ejemplo n.º 9
0
 /** Display a message in lieu of the normal page */
 protected void displayMsgInLieuOfPage(String msg) throws IOException {
   // TODO: Look at HTML
   Page page = newPage();
   Composite warning = new Composite();
   warning.add(msg);
   warning.add("<br>");
   page.add(warning);
   layoutFooter(page);
   page.write(resp.getWriter());
 }
Ejemplo n.º 10
0
 /**
  * Return a labelled rasio button
  *
  * @param label appears to right of circle if non null
  * @param value value assigned to key if box checked
  * @param key form key to which value is assigned
  * @param checked if true, is initially checked
  * @return a readio button Element
  */
 protected Element radioButton(String label, String value, String key, boolean checked) {
   Composite c = new Composite();
   Input in = new Input(Input.Radio, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   c.add(in);
   c.add(label);
   return c;
 }
  private Control createImplicitTabContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    container.setFont(parent.getFont());

    createImpLabel(container);
    createImpTable(container);
    createImpButtons(container);
    return container;
  }
Ejemplo n.º 12
0
 public void createContents() {
   if (!contentCreated) {
     Control sashForm = createSashForm();
     item.setControl(sashForm);
     initColors();
     createExampleControls(exmplComp);
     createStyleControls(styleComp);
     exmplComp.layout();
     styleComp.layout();
     contentCreated = true;
   }
 }
Ejemplo n.º 13
0
 private void updateFont() {
   Iterator iter = controls.iterator();
   while (iter.hasNext()) {
     Control control = (Control) iter.next();
     control.setFont(font);
   }
   // Force layout
   if (controls.size() > 0) {
     Composite parent = ((Control) controls.get(0)).getParent();
     parent.layout(true, true);
   }
 }
Ejemplo n.º 14
0
  /** Creates a text that controls whether a border radius is set on the registered controls. */
  protected void cteateRoundedBorderGroup() {
    Group group = new Group(styleComp, SWT.NONE);
    group.setText("Rounded Border");
    group.setLayout(new GridLayout(2, false));
    new Label(group, SWT.NONE).setText("Width");
    final Text textWidth = new Text(group, SWT.SINGLE | SWT.BORDER);
    textWidth.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(group, SWT.NONE).setText("Color");
    final Button buttonColor = new Button(group, SWT.PUSH);
    buttonColor.setLayoutData(new GridData(20, 20));
    buttonColor.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            rbIndex = (rbIndex + 1) % bgColors.length;
            if (bgColors[rbIndex] == null) {
              buttonColor.setText("");
            } else {
              buttonColor.setText("\u2588");
            }
            buttonColor.setForeground(bgColors[rbIndex]);
          }
        });
    new Label(group, SWT.NONE).setText("Radius ");
    Composite radiusGroup = new Composite(group, SWT.NONE);
    radiusGroup.setLayout(new GridLayout(4, false));
    new Label(radiusGroup, SWT.NONE).setText("T-L");
    final Text textTopLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textTopLeft.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(radiusGroup, SWT.NONE).setText("T-R");
    final Text textTopRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textTopRight.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(radiusGroup, SWT.NONE).setText("B-L");
    final Text textBottomLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textBottomLeft.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(radiusGroup, SWT.NONE).setText("B-R");
    final Text textBottomRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textBottomRight.setLayoutData(new GridData(20, SWT.DEFAULT));
    Button button = new Button(group, SWT.PUSH);
    button.setText("Set");
    button.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(final SelectionEvent e) {
            int width = parseInt(textWidth.getText());
            Color color = buttonColor.getBackground();
            int topLeft = parseInt(textTopLeft.getText());
            int topRight = parseInt(textTopRight.getText());
            int bottomRight = parseInt(textBottomRight.getText());
            int bottomLeft = parseInt(textBottomLeft.getText());
            updateRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft);
          }
        });
  }
Ejemplo n.º 15
0
  /**
   * Returns whether the given <code>AvatarWidget</code> is fully visible in the view port of the
   * viewer
   */
  public boolean isFullyVisible(AvatarWidget avatarWidget) {
    if (null != avatarWidget
        && null != avatarWidget.getControl()
        && false == avatarWidget.getControl().isDisposed()) {

      Rectangle controlBounds = avatarWidget.getControl().getBounds();
      if (controlBounds.x + controlBounds.width
          < avatarsPanel.getBounds().width - avatarsPanel.getBounds().x) {
        return true;
      }
    }
    return false;
  }
Ejemplo n.º 16
0
 @Test
 public void uuidFunctions() throws IOException {
   ServiceLocator locator = container;
   CompositeRepository repository = locator.resolve(CompositeRepository.class);
   UUID id = UUID.randomUUID();
   String uri = repository.insert(new Composite().setId(id));
   Composite found =
       repository.query().filter(it -> it.getId().toString().equals(uri)).findAny().get();
   Assert.assertEquals(id, found.getId());
   found =
       repository.query().filter(it -> UUID.fromString(it.getURI()).equals(id)).findAny().get();
   Assert.assertEquals(id, found.getId());
 }
 @Override
 public Configurable[] getConfigurables() {
   if (!isInitialized) {
     ArrayList<Configurable> list = new ArrayList<Configurable>();
     if (super.myEp.dynamic) {
       Composite composite = cast(Composite.class, this);
       if (composite != null) {
         Collections.addAll(list, composite.getConfigurables());
       }
     }
     if (super.myEp.children != null) {
       for (ConfigurableEP ep : super.myEp.getChildren()) {
         if (ep.isAvailable()) {
           list.add((Configurable) wrapConfigurable(ep));
         }
       }
     }
     if (super.myEp.childrenEPName != null) {
       Object[] extensions =
           Extensions.getArea(super.myEp.getProject())
               .getExtensionPoint(super.myEp.childrenEPName)
               .getExtensions();
       if (extensions.length > 0) {
         if (extensions[0] instanceof ConfigurableEP) {
           for (Object object : extensions) {
             list.add((Configurable) wrapConfigurable((ConfigurableEP) object));
           }
         } else if (!super.myEp.dynamic) {
           Composite composite = cast(Composite.class, this);
           if (composite != null) {
             Collections.addAll(list, composite.getConfigurables());
           }
         }
       }
     }
     Collections.addAll(list, myKids);
     // sort configurables is needed
     for (Configurable configurable : list) {
       if (configurable instanceof Weighted) {
         if (((Weighted) configurable).getWeight() != 0) {
           myComparator = COMPARATOR;
           Collections.sort(list, myComparator);
           break;
         }
       }
     }
     myKids = ArrayUtil.toObjectArray(list, Configurable.class);
     isInitialized = true;
   }
   return myKids;
 }
  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
   */
  protected Control createContents(Composite parent) {
    Composite comp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0);
    link = new Link(comp, SWT.NONE);
    link.setLayoutData(new GridData(GridData.END, GridData.CENTER, true, false));
    link.setFont(comp.getFont());
    link.setText(PDEUIMessages.CompilersPreferencePage_configure_project_specific_settings);
    link.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            HashSet set = new HashSet();
            try {
              IJavaProject[] projects =
                  JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
              IProject project = null;
              for (int i = 0; i < projects.length; i++) {
                project = projects[i].getProject();
                try {
                  if (project.hasNature(PDE.PLUGIN_NATURE)
                      && fBlock.hasProjectSpecificSettings(project)) {
                    set.add(projects[i]);
                  }
                } catch (CoreException ce) {
                  // do nothing ignore the project
                }
              }
            } catch (JavaModelException jme) {
              // ignore
            }
            ProjectSelectionDialog psd = new ProjectSelectionDialog(getShell(), set);
            if (psd.open() == IDialogConstants.OK_ID) {
              HashMap data = new HashMap();
              data.put(NO_LINK, Boolean.TRUE);
              PreferencesUtil.createPropertyDialogOn(
                      getShell(),
                      ((IJavaProject) psd.getFirstResult()).getProject(),
                      "org.eclipse.pde.internal.ui.properties.compilersPropertyPage", //$NON-NLS-1$
                      new String[] {"org.eclipse.pde.internal.ui.properties.compilersPropertyPage"},
                      data)
                  .open(); //$NON-NLS-1$
            }
          }
        });
    fBlock =
        new PDECompilersConfigurationBlock(null, (IWorkbenchPreferenceContainer) getContainer());
    fBlock.createControl(comp);

    // Initialize with data map in case applyData was called before createContents
    applyData(fPageData);

    return comp;
  }
Ejemplo n.º 19
0
  private void fillBuddies(Composite composite) {

    List buddies = getBuddies();

    showNoBuddiesPanel(buddies.size() == 0);

    for (Iterator iterator = buddies.iterator(); iterator.hasNext(); ) {
      VuzeBuddySWT vuzeBuddy = (VuzeBuddySWT) iterator.next();
      createBuddyControls(composite, vuzeBuddy);
    }
    composite.layout();
    Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    composite.setSize(size);
  }
Ejemplo n.º 20
0
  private void parseSampleURL(DBPDriver driver) {
    metaURL = null;

    if (!CommonUtils.isEmpty(driver.getSampleURL())) {
      isCustom = false;
      try {
        metaURL = DriverDescriptor.parseSampleURL(driver.getSampleURL());
      } catch (DBException e) {
        setErrorMessage(e.getMessage());
      }
      final Set<String> properties = metaURL.getAvailableProperties();
      urlText.setEditable(false);
      // urlText.setBackground(urlText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

      showControlGroup(GROUP_HOST, properties.contains(DriverDescriptor.PROP_HOST));
      showControlGroup(GROUP_SERVER, properties.contains(DriverDescriptor.PROP_SERVER));
      showControlGroup(GROUP_DB, properties.contains(DriverDescriptor.PROP_DATABASE));
      showControlGroup(
          GROUP_PATH,
          properties.contains(DriverDescriptor.PROP_FOLDER)
              || properties.contains(DriverDescriptor.PROP_FILE));
    } else {
      isCustom = true;
      showControlGroup(GROUP_HOST, false);
      showControlGroup(GROUP_SERVER, false);
      showControlGroup(GROUP_DB, false);
      showControlGroup(GROUP_PATH, false);
      urlText.setEditable(true);
      urlText.setBackground(null);
    }
    showControlGroup(GROUP_LOGIN, !driver.isAnonymousAccess());
    updateCreateButton(driver);

    settingsGroup.layout();
  }
Ejemplo n.º 21
0
 /**
  * Return a (possibly labelled) checkbox.
  *
  * @param label appears to right of checkbox if non null
  * @param value value included in result set if box checked
  * @param key form key to which result set is assigned
  * @param checked if true, box is initially checked
  * @return a checkbox Element
  */
 Element checkBox(String label, String value, String key, boolean checked) {
   Input in = new Input(Input.Checkbox, key, value);
   if (checked) {
     in.check();
   }
   setTabOrder(in);
   if (StringUtil.isNullString(label)) {
     return in;
   } else {
     Composite c = new Composite();
     c.add(in);
     c.add(" ");
     c.add(label);
     return c;
   }
 }
Ejemplo n.º 22
0
 public MainWindow(Composite parent, int style) {
   super(parent, style);
   initGUI();
   setPreferences();
   waitCursor = getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
   defaultCursor = getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
   clientArea.setFocus();
 }
 private void createImpLabel(Composite container) {
   Label label = new Label(container, SWT.NONE);
   label.setText(PDEUIMessages.TargetImplicitPluginsTab_desc);
   label.setFont(container.getFont());
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = 2;
   label.setLayoutData(gd);
 }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData sectionData = new GridData(GridData.FILL_BOTH);
    sectionData.verticalSpan = 2;
    section.setLayoutData(sectionData);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createOptionalDependenciesButton(container);

    TablePart tablePart = getTablePart();
    fPluginTable = tablePart.getTableViewer();
    fPluginTable.setContentProvider(new ContentProvider());
    fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPluginTable.setComparator(
        new ViewerComparator() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            IProductPlugin p1 = (IProductPlugin) e1;
            IProductPlugin p2 = (IProductPlugin) e2;
            return super.compare(viewer, p1.getId(), p2.getId());
          }
        });
    GridData data = (GridData) tablePart.getControl().getLayoutData();
    data.minimumWidth = 200;
    fPluginTable.setInput(getProduct());

    tablePart.setButtonEnabled(0, isEditable());
    tablePart.setButtonEnabled(1, isEditable());
    tablePart.setButtonEnabled(2, isEditable());

    // remove buttons will be updated on refresh

    tablePart.setButtonEnabled(5, isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);

    section.setText(PDEUIMessages.Product_PluginSection_title);
    section.setDescription(PDEUIMessages.Product_PluginSection_desc);
    getModel().addModelChangedListener(this);
    createSectionToolbar(section, toolkit);
  }
Ejemplo n.º 25
0
  private void createButtonPanel(Composite pageContent) {
    Composite buttonPanel = new Composite(pageContent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    buttonPanel.setLayout(layout);

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = false;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.CENTER;
    gridData.horizontalAlignment = GridData.CENTER;
    buttonPanel.setLayoutData(gridData);

    addButton = new Button(buttonPanel, SWT.PUSH);
    addButton.setText(Messages._UI_ADD_BUTTON);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.CENTER;
    addButton.setLayoutData(gridData);
    addButton.addSelectionListener(new ButtonSelectListener());
    addButton.setToolTipText(Messages._UI_ADD_BUTTON_TOOL_TIP);
    addButton.setEnabled(false);

    removeButton = new Button(buttonPanel, SWT.PUSH);
    removeButton.setText(Messages._UI_REMOVE_BUTTON);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.CENTER;
    removeButton.setLayoutData(gridData);
    removeButton.addSelectionListener(new ButtonSelectListener());
    removeButton.setToolTipText(Messages._UI_REMOVE_BUTTON_TOOL_TIP);
    removeButton.setEnabled(false);

    removeAllButton = new Button(buttonPanel, SWT.PUSH);
    removeAllButton.setText(Messages._UI_REMOVE_ALL_BUTTON);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.CENTER;
    removeAllButton.setLayoutData(gridData);
    removeAllButton.addSelectionListener(new ButtonSelectListener());
    removeAllButton.setToolTipText(Messages._UI_REMOVE_ALL_BUTTON_TOOL_TIP);
    removeAllButton.setEnabled(false);
  }
Ejemplo n.º 26
0
  public void dispose() {
    /*
     * Unregister listeners.
     */
    for (IAttributeEditor editor : this.editors.values()) {
      editor.removeAttributeListener(forwardListener);
    }

    super.dispose();
  }
Ejemplo n.º 27
0
 @Test
 public void sendDomainObjectAsArgument() throws IOException {
   ServiceLocator locator = container;
   CompositeRepository repository = locator.resolve(CompositeRepository.class);
   UUID id = UUID.randomUUID();
   Random rnd = new Random();
   int next = rnd.nextInt(100000);
   repository.insert(
       new Composite().setId(id).setSimple(new Simple().setEn(En.A).setNumber(next)));
   Simple simple = new Simple().setEn(En.A).setNumber(next);
   Composite found =
       repository
           .query()
           .filter(it -> it.getSimple().getNumber() == simple.getNumber())
           .sortedBy(it -> it.getId())
           .findFirst()
           .get();
   Assert.assertEquals(id, found.getId());
 }
Ejemplo n.º 28
0
  /**
   * Creates a combo that controls whether a cursor is set on the registered controls.
   *
   * @return the created combo
   */
  protected Combo createCursorCombo() {
    Composite group = new Composite(styleComp, SWT.NONE);
    group.setLayout(new GridLayout(2, false));
    new Label(group, SWT.NONE).setText("Cursor");
    final Combo combo = new Combo(group, SWT.READ_ONLY);
    combo.setItems(SWT_CURSORS);
    combo.select(0);
    combo.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(final SelectionEvent e) {
            String selection = null;
            int index = combo.getSelectionIndex();
            if (index > 0) {
              selection = combo.getItem(index);
            }
            updateCursor(selection);
          }
        });
    return combo;
  }
  /**
   * Creates the contents of this group, using the given toolkit where appropriate so that the
   * controls have the form editor look and feel.
   *
   * @param parent parent composite
   * @param toolkit toolkit to create controls with
   */
  protected void createFormContents(Composite parent, FormToolkit toolkit) {
    fGrouping = GROUP_BY_NONE;

    Composite comp = toolkit.createComposite(parent);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = layout.marginHeight = 0;
    comp.setLayout(layout);
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));
    comp.setFont(parent.getFont());

    createTree(comp, toolkit);
    createButtons(comp, toolkit);

    fCountLabel = toolkit.createLabel(comp, ""); // $NON-NLS-1$
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    fCountLabel.setLayoutData(data);

    updateButtons();
    initializeFilters();
  }
Ejemplo n.º 30
0
  /** Common page setup. */
  protected Page newPage() {
    // Compute heading
    String heading = getHeading();
    if (heading == null) {
      heading = "Box Administration";
    }

    // Create page and layout header
    Page page = ServletUtil.doNewPage(getPageTitle(), isFramed());
    Iterator inNavIterator;
    if (myServletDescr().hasNoNavTable()) {
      inNavIterator = CollectionUtil.EMPTY_ITERATOR;
    } else {
      inNavIterator =
          new FilterIterator(
              new ObjectArrayIterator(getServletDescrs()),
              new Predicate() {
                public boolean evaluate(Object obj) {
                  return isServletInNav((ServletDescr) obj);
                }
              });
    }
    ServletUtil.layoutHeader(
        this,
        page,
        heading,
        isLargeLogo(),
        getMachineName(),
        getLockssApp().getStartDate(),
        inNavIterator);
    String warnMsg = CurrentConfig.getParam(PARAM_UI_WARNING);
    if (warnMsg != null) {
      Composite warning = new Composite();
      warning.add("<center><font color=red size=+1>");
      warning.add(warnMsg);
      warning.add("</font></center><br>");
      page.add(warning);
    }
    return page;
  }