Esempio n. 1
0
 @Override
 public void preserveValues(ExpandItem item) {
   WidgetLCAUtil.preserveBounds(item, getBounds(item));
   ItemLCAUtil.preserve(item);
   preserveProperty(item, PROP_EXPANDED, item.getExpanded());
   preserveProperty(item, PROP_HEADER_HEIGHT, item.getHeaderHeight());
 }
Esempio n. 2
0
 @Override
 public void renderChanges(ExpandItem item) throws IOException {
   WidgetLCAUtil.renderCustomVariant(item);
   WidgetLCAUtil.renderBounds(item, getBounds(item));
   ItemLCAUtil.renderChanges(item);
   renderProperty(item, PROP_EXPANDED, item.getExpanded(), false);
   renderProperty(item, PROP_HEADER_HEIGHT, item.getHeaderHeight(), DEFAULT_HEADER_HEIGHT);
 }
 private void createExpandBar(List<String> events) {
   expandBar = new ExpandBar(shell, SWT.V_SCROLL);
   for (int i = 0; i < 3; i++) {
     ExpandItem item = new ExpandItem(expandBar, SWT.NONE);
     item.setText("ExpandBar" + i);
     hookExpectedEvents(item, getTestName(), events);
   }
   setWidget(expandBar);
 }
Esempio n. 4
0
 protected Composite createComponent(final Shell panel) {
   this.rootPanel = panel;
   final Composite widget_lh9w84_a0b0h =
       new _FunctionTypes._return_P1_E0<Composite, Composite>() {
         public Composite invoke(Composite context_lh9w84_a) {
           Composite cmp = new Composite(panel, SWT.NONE);
           cmp.setLayout(new DockLayout());
           return cmp;
         }
       }.invoke(panel);
   final ExpandBar widget_lh9w84_a0a0a1a7 = new ExpandBar(widget_lh9w84_a0b0h, SWT.V_SCROLL);
   final ExpandController ec_lh9w84_a0b0c0b0h = new ExpandController(widget_lh9w84_a0a0a1a7);
   final Composite widget_lh9w84_a0a0a0a0b0h =
       new _FunctionTypes._return_P1_E0<Composite, ExpandBar>() {
         public Composite invoke(ExpandBar context_lh9w84_a_0) {
           Composite cmp = new Composite(widget_lh9w84_a0a0a1a7, SWT.NONE);
           cmp.setLayout(new FillLayout());
           return cmp;
         }
       }.invoke(widget_lh9w84_a0a0a1a7);
   final ExpandItem eitem_lh9w84_a0b0c0c0b0h =
       new _FunctionTypes._return_P0_E0<ExpandItem>() {
         public ExpandItem invoke() {
           ExpandItem ei =
               new ExpandItem((ExpandBar) widget_lh9w84_a0a0a0a0b0h.getParent(), SWT.NONE);
           ei.setControl(widget_lh9w84_a0a0a0a0b0h);
           ei.setHeight(1 << 9);
           return ei;
         }
       }.invoke();
   eitem_lh9w84_a0b0c0c0b0h.setText("Panels");
   final Composite widget_lh9w84_a0a0a0a0a0a1a7 =
       new _FunctionTypes._return_P1_E0<Composite, Composite>() {
         public Composite invoke(Composite context_lh9w84_a_1) {
           Composite cmp = new Composite(widget_lh9w84_a0a0a0a0b0h, SWT.NONE);
           RowLayout rlt = new RowLayout(SWT.VERTICAL);
           rlt.wrap = false;
           rlt.fill = false;
           rlt.justify = false;
           cmp.setLayout(rlt);
           return cmp;
         }
       }.invoke(widget_lh9w84_a0a0a0a0b0h);
   new PanelsDemo_SWT(this).buildUI(widget_lh9w84_a0a0a0a0a0a1a7);
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   final Composite widget_lh9w84_b0a0a0a0b0h =
       new _FunctionTypes._return_P1_E0<Composite, ExpandBar>() {
         public Composite invoke(ExpandBar context_lh9w84_a_2) {
           Composite cmp = new Composite(widget_lh9w84_a0a0a1a7, SWT.NONE);
           cmp.setLayout(new FillLayout());
           return cmp;
         }
       }.invoke(widget_lh9w84_a0a0a1a7);
   final ExpandItem eitem_lh9w84_a0g0c0c0b0h =
       new _FunctionTypes._return_P0_E0<ExpandItem>() {
         public ExpandItem invoke() {
           ExpandItem ei =
               new ExpandItem((ExpandBar) widget_lh9w84_b0a0a0a0b0h.getParent(), SWT.NONE);
           ei.setControl(widget_lh9w84_b0a0a0a0b0h);
           ei.setHeight(1 << 9);
           return ei;
         }
       }.invoke();
   eitem_lh9w84_a0g0c0c0b0h.setText("Controls");
   final Composite widget_lh9w84_a0a1a0a0a0a1a7 =
       new _FunctionTypes._return_P1_E0<Composite, Composite>() {
         public Composite invoke(Composite context_lh9w84_a_3) {
           Composite cmp = new Composite(widget_lh9w84_b0a0a0a0b0h, SWT.NONE);
           RowLayout rlt = new RowLayout(SWT.VERTICAL);
           rlt.wrap = false;
           rlt.fill = false;
           rlt.justify = false;
           cmp.setLayout(rlt);
           return cmp;
         }
       }.invoke(widget_lh9w84_b0a0a0a0b0h);
   new ControlsDemo_SWT(this).buildUI(widget_lh9w84_a0a1a0a0a0a1a7);
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   final Composite widget_lh9w84_c0a0a0a0b0h =
       new _FunctionTypes._return_P1_E0<Composite, ExpandBar>() {
         public Composite invoke(ExpandBar context_lh9w84_a_4) {
           Composite cmp = new Composite(widget_lh9w84_a0a0a1a7, SWT.NONE);
           cmp.setLayout(new FillLayout());
           return cmp;
         }
       }.invoke(widget_lh9w84_a0a0a1a7);
   final ExpandItem eitem_lh9w84_a0l0c0c0b0h =
       new _FunctionTypes._return_P0_E0<ExpandItem>() {
         public ExpandItem invoke() {
           ExpandItem ei =
               new ExpandItem((ExpandBar) widget_lh9w84_c0a0a0a0b0h.getParent(), SWT.NONE);
           ei.setControl(widget_lh9w84_c0a0a0a0b0h);
           ei.setHeight(1 << 9);
           return ei;
         }
       }.invoke();
   eitem_lh9w84_a0l0c0c0b0h.setText("Windows");
   final Composite widget_lh9w84_a0a2a0a0a0a1a7 =
       new _FunctionTypes._return_P1_E0<Composite, Composite>() {
         public Composite invoke(Composite context_lh9w84_a_5) {
           Composite cmp = new Composite(widget_lh9w84_c0a0a0a0b0h, SWT.NONE);
           RowLayout rlt = new RowLayout(SWT.VERTICAL);
           rlt.wrap = false;
           rlt.fill = false;
           rlt.justify = false;
           cmp.setLayout(rlt);
           return cmp;
         }
       }.invoke(widget_lh9w84_c0a0a0a0b0h);
   new WindowsDemo_SWT(this).buildUI(widget_lh9w84_a0a2a0a0a0a1a7);
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   final Composite widget_lh9w84_d0a0a0a0b0h =
       new _FunctionTypes._return_P1_E0<Composite, ExpandBar>() {
         public Composite invoke(ExpandBar context_lh9w84_a_6) {
           Composite cmp = new Composite(widget_lh9w84_a0a0a1a7, SWT.NONE);
           cmp.setLayout(new FillLayout());
           return cmp;
         }
       }.invoke(widget_lh9w84_a0a0a1a7);
   final ExpandItem eitem_lh9w84_a0q0c0c0b0h =
       new _FunctionTypes._return_P0_E0<ExpandItem>() {
         public ExpandItem invoke() {
           ExpandItem ei =
               new ExpandItem((ExpandBar) widget_lh9w84_d0a0a0a0b0h.getParent(), SWT.NONE);
           ei.setControl(widget_lh9w84_d0a0a0a0b0h);
           ei.setHeight(1 << 9);
           return ei;
         }
       }.invoke();
   eitem_lh9w84_a0q0c0c0b0h.setText("\u0422\u044b\u0440\u044b\u043f\u044b\u0440\u044b");
   final Composite widget_lh9w84_a0a3a0a0a0a1a7 =
       new _FunctionTypes._return_P1_E0<Composite, Composite>() {
         public Composite invoke(Composite context_lh9w84_a_7) {
           Composite cmp = new Composite(widget_lh9w84_d0a0a0a0b0h, SWT.NONE);
           RowLayout rlt = new RowLayout(SWT.VERTICAL);
           rlt.wrap = false;
           rlt.fill = false;
           rlt.justify = false;
           cmp.setLayout(rlt);
           return cmp;
         }
       }.invoke(widget_lh9w84_d0a0a0a0b0h);
   final Button widget_lh9w84_a0a0a0d0a0a0a0b0h =
       new Button(widget_lh9w84_a0a3a0a0a0a1a7, SWT.RADIO);
   widget_lh9w84_a0a0a0d0a0a0a0b0h.setText("Stage 1");
   //  with SWT items are not added to container
   final Button widget_lh9w84_b0a0a0d0a0a0a0b0h =
       new Button(widget_lh9w84_a0a3a0a0a0a1a7, SWT.RADIO);
   widget_lh9w84_b0a0a0d0a0a0a0b0h.setText("Stage 2");
   //  with SWT items are not added to container
   final Button widget_lh9w84_c0a0a0d0a0a0a0b0h =
       new Button(widget_lh9w84_a0a3a0a0a0a1a7, SWT.RADIO);
   widget_lh9w84_c0a0a0d0a0a0a0b0h.setText("Stage 3");
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   final Composite widget_lh9w84_e0a0a0a0b0h =
       new _FunctionTypes._return_P1_E0<Composite, ExpandBar>() {
         public Composite invoke(ExpandBar context_lh9w84_a_8) {
           Composite cmp = new Composite(widget_lh9w84_a0a0a1a7, SWT.NONE);
           cmp.setLayout(new FillLayout());
           return cmp;
         }
       }.invoke(widget_lh9w84_a0a0a1a7);
   final ExpandItem eitem_lh9w84_a0v0c0c0b0h =
       new _FunctionTypes._return_P0_E0<ExpandItem>() {
         public ExpandItem invoke() {
           ExpandItem ei =
               new ExpandItem((ExpandBar) widget_lh9w84_e0a0a0a0b0h.getParent(), SWT.NONE);
           ei.setControl(widget_lh9w84_e0a0a0a0b0h);
           ei.setHeight(1 << 9);
           return ei;
         }
       }.invoke();
   eitem_lh9w84_a0v0c0c0b0h.setText("\u0401\u043c\u0430\u0451");
   final Composite widget_lh9w84_a0a4a0a0a0a1a7 =
       new _FunctionTypes._return_P1_E0<Composite, Composite>() {
         public Composite invoke(Composite context_lh9w84_a_9) {
           Composite cmp = new Composite(widget_lh9w84_e0a0a0a0b0h, SWT.NONE);
           RowLayout rlt = new RowLayout(SWT.VERTICAL);
           rlt.wrap = false;
           rlt.fill = false;
           rlt.justify = false;
           cmp.setLayout(rlt);
           return cmp;
         }
       }.invoke(widget_lh9w84_e0a0a0a0b0h);
   final Button widget_lh9w84_a0a0a0e0a0a0a0b0h =
       new Button(widget_lh9w84_a0a4a0a0a0a1a7, SWT.RADIO);
   widget_lh9w84_a0a0a0e0a0a0a0b0h.setText("Stage 1");
   //  with SWT items are not added to container
   final Button widget_lh9w84_b0a0a0e0a0a0a0b0h =
       new Button(widget_lh9w84_a0a4a0a0a0a1a7, SWT.RADIO);
   widget_lh9w84_b0a0a0e0a0a0a0b0h.setText("Stage 2");
   //  with SWT items are not added to container
   final Button widget_lh9w84_c0a0a0e0a0a0a0b0h =
       new Button(widget_lh9w84_a0a4a0a0a0a1a7, SWT.RADIO);
   widget_lh9w84_c0a0a0e0a0a0a0b0h.setText("Stage 3");
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   //  with SWT items are not added to container
   widget_lh9w84_a0a0a1a7.setLayoutData(DockLayoutData.WEST);
   this.demoContainer = widget_lh9w84_a0b0h;
   return widget_lh9w84_a0b0h;
 }
Esempio n. 5
0
 private static IExpandBarAdapter getExpandBarAdapter(ExpandItem item) {
   return item.getParent().getAdapter(IExpandBarAdapter.class);
 }
Esempio n. 6
0
 @Override
 public void renderInitialization(ExpandItem item) throws IOException {
   RemoteObject remoteObject = createRemoteObject(item, TYPE);
   remoteObject.setHandler(new ExpandItemOperationHandler(item));
   remoteObject.set("parent", getId(item.getParent()));
 }
    public Composite createControls(Composite parent) {
      setPreferenceKey("mp3converttab");

      // set default for preferences.
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "quickcopy", true);
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "forceconvert", false);

      getPreferenceStore().setDefault(getPreferenceKey() + "." + "audioBitrate", "128");
      getPreferenceStore().setDefault(getPreferenceKey() + "." + "useAvisynth", false);

      Composite composite = new Composite(parent, SWT.NULL);
      composite.setLayout(new GridLayout(1, true));

      Group exportDir = new Group(composite, SWT.NULL);
      exportDir.setToolTipText(Messages.getString("mp3convert.exportDir.tooltip"));
      exportDir.setLayout(new GridLayout());
      exportDir.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      exportDir.setText(Messages.getString("mp3convert.exportDir"));

      createDirectoryInfo(exportDir);

      Group detailSetting = new Group(composite, SWT.NULL);
      detailSetting.setLayout(new FillLayout());
      detailSetting.setLayoutData(new GridData(GridData.FILL_BOTH));
      detailSetting.setText(Messages.getString("mp3convert.detail"));

      ExpandBar bar = new ExpandBar(detailSetting, SWT.V_SCROLL);

      Composite copybase = new Composite(bar, SWT.NULL);
      copybase.setLayout(new RowLayout());
      quickCopy = new Button(copybase, SWT.CHECK);
      quickCopy.setText(Messages.getString("mp3convert.quickcopy"));
      quickCopy.addSelectionListener(
          new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {}

            public void widgetSelected(SelectionEvent e) {
              updateStatus();
            }
          });
      // quickCopy.setSelection(true);//

      ExpandItem item0 = new ExpandItem(bar, SWT.NONE, 0);
      item0.setText(Messages.getString("mp3convert.aboutcopy"));
      item0.setHeight(copybase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item0.setControl(copybase);

      Composite advancedSetting = new Composite(bar, SWT.NULL);
      advancedSetting.setLayout(new GridLayout(1, false));

      Composite changebase = new Composite(advancedSetting, SWT.NULL);
      changebase.setLayout(new GridLayout(1, false));
      forceConvert = new Button(changebase, SWT.CHECK);
      forceConvert.setText(Messages.getString("mp3convert.forceconvert"));
      mp3setting = new MP3AudioSettingComposite(changebase, SWT.NULL, false, getPreferenceKey());
      ExpandItem item1 = new ExpandItem(bar, SWT.NONE, 1);
      item1.setText(Messages.getString("mp3convert.convertsetting"));
      item1.setHeight(advancedSetting.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item1.setControl(advancedSetting);

      Composite bitrateBase = new Composite(bar, SWT.NULL);
      bitrateBase.setLayout(new RowLayout());
      Label label1 = new Label(bitrateBase, SWT.NULL);
      label1.setText(Messages.getString("mp3convert.defaultBitrate"));
      defaultBitrate = new CCombo(bitrateBase, SWT.NULL);
      int bitrates[] = {64, 80, 96, 112, 128, 160, 192, 224, 256, 320};
      for (int i = 0; i < bitrates.length; i++) {
        defaultBitrate.add("" + bitrates[i]);
      }
      defaultBitrate.select(4);
      Label label = new Label(bitrateBase, SWT.NULL);
      label.setText("kbps");

      ExpandItem item2 = new ExpandItem(bar, SWT.NONE, 2);
      item2.setText(Messages.getString("mp3convert.optionbitrate"));
      item2.setHeight(bitrateBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item2.setControl(bitrateBase);

      forceConvert.addSelectionListener(new SynchEnabled(mp3setting));

      Composite avisynthBase = new Composite(bar, SWT.NULL);
      avisynthBase.setLayout(new RowLayout());
      useAvisynth = new Button(avisynthBase, SWT.CHECK);
      useAvisynth.setText(Messages.getString("mp3convert.useAvisynth"));
      // quickCopy.setSelection(true);//

      ExpandItem item3 = new ExpandItem(bar, SWT.NONE, 3);
      item3.setText(Messages.getString("mp3convert.about_useAvisynth"));
      item3.setHeight(avisynthBase.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
      item3.setControl(avisynthBase);

      canConvertImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_mp3.png")
              .createImage();
      noFFMpegImage =
          AbstractUIPlugin.imageDescriptorFromPlugin(
                  "jp.sourceforge.akjrcp.akj_betas", "icons/dandd_noffmpeg.png")
              .createImage();
      // bitrate
      // framerate
      // channel

      dragHere = new CLabel(composite, SWT.BORDER | SWT.LEFT);
      dragHere.setBackground(ColorConstants.white);
      dragHere.setImage(canConvertImage);
      dragHere.setAlignment(SWT.CENTER);

      dragHere.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      // keep preference store
      SavePreferenceStore sps = new SavePreferenceStore();

      // restore from setting..
      restoreControl(forceConvert);
      restoreControl(quickCopy);
      restoreControl(defaultBitrate);
      restoreControl(useAvisynth);

      forceConvert.addSelectionListener(sps);
      quickCopy.addSelectionListener(sps);
      defaultBitrate.addSelectionListener(sps);
      useAvisynth.addSelectionListener(sps);

      mp3setting.setEnabled(forceConvert.getSelection());
      mp3setting.setPreferenceStore(getPreferenceStore());

      // update status
      setCanConvert(true);
      updateStatus();
      PlatformUI.getPreferenceStore().addPropertyChangeListener(new SettingMonitor());
      return composite;
    }
  public static void main(String[] args) {
    Shell shell = new Shell();
    Display display = shell.getDisplay();
    shell.setLayout(new FillLayout());
    shell.setText("ExpandBar Example");

    Menu menubar = new Menu(shell, SWT.BAR);
    shell.setMenuBar(menubar);
    MenuItem fileItem = new MenuItem(menubar, SWT.CASCADE);
    fileItem.setText("&File");
    Menu submenu = new Menu(shell, SWT.DROP_DOWN);
    fileItem.setMenu(submenu);
    item = new MenuItem(submenu, SWT.PUSH);
    item.setText("New ExpandItem");

    bar = new ExpandBar(shell, SWT.V_SCROLL);
    image = display.getSystemImage(SWT.ICON_QUESTION);

    // First item
    Composite composite = new Composite(bar, SWT.NONE);
    Menu popupmenu = new Menu(shell, SWT.POP_UP);
    MenuItem popupItem = new MenuItem(popupmenu, SWT.PUSH);
    popupItem.setText("Popup");
    composite.setMenu(popupmenu);

    GridLayout layout = new GridLayout(2, false);
    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    Label label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_ERROR));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_ERROR");
    label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_INFORMATION");
    label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_WARNING));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_WARNING");
    label = new Label(composite, SWT.NONE);
    label.setImage(display.getSystemImage(SWT.ICON_QUESTION));
    label = new Label(composite, SWT.NONE);
    label.setText("SWT.ICON_QUESTION");
    ExpandItem item1 = new ExpandItem(bar, SWT.NONE);
    item1.setText("What is your favorite icon");
    item1.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    item1.setControl(composite);
    item1.setImage(image);

    // Second item
    composite = new Composite(bar, SWT.NONE);
    layout = new GridLayout(2, true);
    layout.marginLeft = layout.marginTop = layout.marginRight = layout.marginBottom = 10;
    layout.verticalSpacing = 10;
    composite.setLayout(layout);
    Button button1 = new Button(composite, SWT.PUSH);
    button1.setText("Button 1");
    Button button2 = new Button(composite, SWT.PUSH);
    button2.setText("Button 2");

    ExpandItem item0 = new ExpandItem(bar, SWT.NONE);
    item0.setText("What is your favorite button");
    item0.setHeight(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    item0.setControl(composite);
    item0.setImage(image);
    item0.setExpanded(false);

    item.addListener(
        SWT.Selection,
        new Listener() {
          @Override
          public void handleEvent(Event e) {
            ExpandItem item2 = new ExpandItem(bar, SWT.NONE);
            Composite composite = new Composite(bar, SWT.NONE);
            GridLayout layout = new GridLayout(2, false);
            composite.setLayout(layout);
            Label label = new Label(composite, SWT.NONE);
            label.setText("What is your name?");
            Composite pcomposite = new Composite(composite, SWT.NONE);
            Text text = new Text(pcomposite, SWT.NONE);
            item2.setText("New Question");
            text.pack();
            composite.pack();
            Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
            item2.setHeight(size.y);
            item2.setControl(composite);
            item2.setImage(image);
            item2.setExpanded(true);
          }
        });

    bar.setSpacing(8);
    shell.setSize(400, 550);
    shell.open();
    System.out.println("------------------------------");
    System.out.println("getSize: " + button1.getSize());
    System.out.println("getBounds: " + button1.getBounds());
    System.out.println("computeSize: " + button1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    System.out.println("getLocation: " + button1.getLocation());

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    image.dispose();
    display.dispose();
  }