Ejemplo n.º 1
0
  @Override
  protected Control createContents(Composite parent) {
    ColorController.assignMethodColors(parent.getDisplay(), mReader.getMethods());
    SelectionController selectionController = new SelectionController();

    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    parent.setLayout(gridLayout);

    Display display = parent.getDisplay();
    Color darkGray = display.getSystemColor(SWT.COLOR_DARK_GRAY);

    // Create a sash form to separate the timeline view (on top)
    // and the profile view (on bottom)
    SashForm sashForm1 = new SashForm(parent, SWT.VERTICAL);
    sashForm1.setBackground(darkGray);
    sashForm1.SASH_WIDTH = 3;
    GridData data = new GridData(GridData.FILL_BOTH);
    sashForm1.setLayoutData(data);

    // Create the timeline view
    new TimeLineView(sashForm1, mReader, selectionController);

    // Create the profile view
    new ProfileView(sashForm1, mReader, selectionController);
    return sashForm1;
  }
Ejemplo n.º 2
0
  public void createControl(Composite parent, IActionBars actionbars) {

    this.content = new Composite(parent, SWT.NONE);
    content.setLayout(new GridLayout(1, false));
    GridUtils.removeMargins(content);
    content.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    // Make some sashes
    final SashForm horiz = new SashForm(content, SWT.VERTICAL);
    horiz.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    horiz.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    final SashForm top = new SashForm(horiz, SWT.HORIZONTAL);
    final SashForm bottom = new SashForm(horiz, SWT.HORIZONTAL);

    // Fill the sashes
    topSystem.createPlotPart(top, "Integration", null, PlotType.XY, getPart());
    Label label = new Label(top, SWT.NONE);
    label.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    super.createControl(bottom, actionbars);
    rightSystem.createPlotPart(bottom, "Integration", null, PlotType.XY, getPart());

    horiz.setWeights(new int[] {30, 70});
    top.setWeights(new int[] {70, 30});
    bottom.setWeights(new int[] {70, 30});

    topSystem.setShowLegend(false);
    rightSystem.setShowLegend(false);
    profilePlottingSystem.setShowIntensity(false);
  }
Ejemplo n.º 3
0
  @Override
  public Control createControl(Composite parent) {
    SashForm sash = new SashForm(parent, SWT.HORIZONTAL);
    sash.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    Composite container = new Composite(sash, SWT.NONE);
    container.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    treeMap = new TreeMap<TaxonomyNode>(container);
    treeMap.setTreeMapLayout(new SquarifiedLayout<TaxonomyNode>(10));
    treeMap.setLabelProvider(
        new ILabelProvider<TaxonomyNode>() {
          @Override
          public String getLabel(
              ITreeModel<IRectangle<TaxonomyNode>> model, IRectangle<TaxonomyNode> rectangle) {
            return rectangle.getNode().getName();
          }
        });

    legend = new TreeMapLegend(container, treeMap, getModel(), getRenderer());

    final SecurityDetailsViewer details =
        new SecurityDetailsViewer(sash, SWT.NONE, getModel().getClient(), true);
    treeMap.addSelectionChangeListener(
        new ISelectionChangeListener<TaxonomyNode>() {
          @Override
          public void selectionChanged(
              ITreeModel<IRectangle<TaxonomyNode>> model,
              IRectangle<TaxonomyNode> rectangle,
              String label) {
            TaxonomyNode node = rectangle.getNode();
            details.setInput(node.getBackingSecurity());
          }
        });

    // layout tree map + legend
    GridLayoutFactory.fillDefaults().numColumns(1).margins(10, 10).applyTo(container);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(treeMap);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(legend);

    // layout sash
    details.getControl().pack();
    int width = details.getControl().getBounds().width;
    sash.setWeights(new int[] {parent.getParent().getParent().getBounds().width - width, width});

    treeMap.setRectangleRenderer(new ClassificationRectangleRenderer(getModel(), getRenderer()));
    treeMap.setTreeModel(new Model(getModel().getRootNode()));
    legend.setRootItem(getModel().getRootNode());

    return sash;
  }
Ejemplo n.º 4
0
 @Override
 public void createPartControl(Composite parent) {
   parent.setLayout(new FillLayout(SWT.VERTICAL));
   SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH);
   sashForm.setSashWidth(5);
   sashForm.setBackground(ColorConstants.white);
   sashForm.setLayout(new FillLayout());
   Composite top = kit.createComposite(sashForm);
   top.setLayout(new FillLayout(SWT.VERTICAL));
   Composite bottom = kit.createComposite(sashForm);
   bottom.setLayout(new FillLayout(SWT.VERTICAL));
   sashForm.setWeights(new int[] {3, 2});
   createViewer(top);
   createTimeScalingSection(bottom);
   hookActions();
   setActiveSession();
 }
  /**
   * Creates the sashform for the master detail colums.
   *
   * @param parent the parent
   * @return the sash
   */
  protected SashForm createSash(Composite parent) {
    /* THe contents of the composite */
    final Composite sashComposite = new Composite(parent, SWT.FILL);
    final GridLayout sashLayout = GridLayoutFactory.fillDefaults().create();
    sashLayout.marginWidth = 5;
    sashComposite.setLayout(sashLayout);
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.FILL)
        .grab(true, true)
        .applyTo(sashComposite);

    final SashForm sash = new SashForm(sashComposite, SWT.HORIZONTAL);

    sash.setBackground(parent.getBackground());
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(sash);
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(sash);
    sash.setSashWidth(5);
    return sash;
  }
Ejemplo n.º 6
0
  protected Control createDialogArea(Composite parent) {
    parent.setBackground(EccTreeControl.color);
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));
    composite.setLayout(new FillLayout(SWT.HORIZONTAL));
    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));

    TabItem basicItem = new TabItem(tabFolder, SWT.NONE);
    basicItem.setText("基本");

    Composite composite1 = new Composite(tabFolder, SWT.NONE);
    composite1.setBackground(EccTreeControl.color);
    basicItem.setControl(composite1);

    SashForm sashForm = new SashForm(composite1, SWT.VERTICAL);
    sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    sashForm.setSize(445, 211);
    sashForm.setLocation(0, 0);

    Composite composite_1 = new Composite(sashForm, SWT.NONE);
    composite_1.setBackground(EccTreeControl.color);

    ICollection ico = FileTools.getBussCollection("TaskName", name, "EccTaskPlan");
    IEnumerator ien = ico.GetEnumerator();
    while (ien.MoveNext()) {
      bo = (BusinessObject) ien.get_Current();
      if (bo != null && bo.GetField("Model").get_NativeValue().toString().equals("绝对时间任务计划")) {
        TaskName = bo.GetField("TaskName").get_NativeValue().toString();
        Instruction = bo.GetField("Instruction").get_NativeValue().toString();
        StatrtTime = bo.GetField("StatrtTime").get_NativeValue().toString();
        String[] s2 = StatrtTime.split(";");
        String[] b1 = s2[0].split(",");
        time = b1[1];
        String[] b2 = s2[1].split(",");
        time_1 = b2[1];
        String[] b3 = s2[2].split(",");
        time_2 = b3[1];
        String[] b4 = s2[3].split(",");
        time_3 = b4[1];
        String[] b5 = s2[4].split(",");
        time_4 = b5[1];
        String[] b6 = s2[5].split(",");
        time_5 = b6[1];
        String[] b7 = s2[6].split(",");
        time_6 = b7[1];

        Status = bo.GetField("Status").get_NativeValue().toString();
        String[] s1 = Status.split(";");
        String[] a1 = s1[0].split(":");
        date = a1[0]; // 星期日
        permission = a1[1];
        String[] a2 = s1[1].split(":");
        date_1 = a2[0]; // 星期一
        permission_1 = a2[1];
        String[] a3 = s1[2].split(":");
        date_2 = a3[0]; // 星期二
        permission_2 = a3[1];
        String[] a4 = s1[3].split(":");
        date_3 = a4[0]; // 星期三
        permission_3 = a4[1];
        String[] a5 = s1[4].split(":");
        date_4 = a5[0]; // 星期四
        permission_4 = a5[1];
        String[] a6 = s1[5].split(":");
        date_5 = a6[0]; // 星期五
        permission_5 = a6[1];
        String[] a7 = s1[6].split(":");
        date_6 = a7[0]; // 星期六
        permission_6 = a7[1];
      }
    }

    text = new Text(composite_1, SWT.BORDER); // 任务计划名称
    text.setLocation(137, 0);
    text.setSize(177, 18);
    text.setText(TaskName);
    text.setEnabled(false);

    Label lblNewLabel = new Label(composite_1, SWT.NONE);
    lblNewLabel.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_FOREGROUND));
    lblNewLabel.setFont(SWTResourceManager.getFont("宋体", 10, SWT.NORMAL));
    lblNewLabel.setBounds(10, 2, 102, 18);
    lblNewLabel.setText("\u4EFB\u52A1\u8BA1\u5212\u540D\u79F0*:");

    Composite composite_2 = new Composite(sashForm, SWT.NONE);
    composite_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));

    lblNewLabel_1 = new Label(composite_2, SWT.NONE);
    lblNewLabel_1.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_1.setBounds(20, 10, 54, 16);
    lblNewLabel_1.setText("星期日");

    btnCheckButton = new Button(composite_2, SWT.CHECK);
    btnCheckButton.setBounds(102, 8, 45, 16);
    btnCheckButton.setBackground(EccTreeControl.color);
    btnCheckButton.setText("\u5141\u8BB8");
    if (lblNewLabel_1.getText().equals(date) && permission.equals("允许")) {
      btnCheckButton.setSelection(true);
    } else if (lblNewLabel_1.getText().equals(date) && permission.equals("禁止")) {
      btnCheckButton.setSelection(false);
    }

    final DateTime startTime = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime.setLocation(164, 10);
    startTime.setSize(79, 15);
    int h = Integer.parseInt(time.substring(0, time.indexOf(":")));
    int m = Integer.parseInt(time.substring(time.indexOf(":") + 1, time.lastIndexOf(":")));
    int mm = Integer.parseInt(time.substring(time.lastIndexOf(":") + 1));
    startTime.setTime(h, m, mm);
    startTimeStr =
        startTime.getHours() + ":" + startTime.getMinutes() + ":" + startTime.getSeconds();
    startTime.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr =
                startTime.getHours() + ":" + startTime.getMinutes() + ":" + startTime.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_2 = new Label(composite_2, SWT.NONE);
    lblNewLabel_2.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_2.setBounds(20, 32, 54, 16);
    lblNewLabel_2.setText("星期一");

    btnCheckButton_1 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_1.setBounds(102, 30, 45, 16);
    btnCheckButton_1.setBackground(EccTreeControl.color);
    btnCheckButton_1.setText("\u5141\u8BB8");
    if (lblNewLabel_2.getText().equals(date_1) && permission_1.equals("允许")) {
      btnCheckButton_1.setSelection(true);
    } else if (lblNewLabel_2.getText().equals(date_1) && permission_1.equals("禁止")) {
      btnCheckButton_1.setSelection(false);
    }

    final DateTime startTime_1 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_1.setLocation(164, 31);
    startTime_1.setSize(79, 15);
    int h1 = Integer.parseInt(time_1.substring(0, time_1.indexOf(":")));
    int m1 = Integer.parseInt(time_1.substring(time_1.indexOf(":") + 1, time_1.lastIndexOf(":")));
    int mm1 = Integer.parseInt(time_1.substring(time_1.lastIndexOf(":") + 1));
    startTime_1.setTime(h1, m1, mm1);
    startTimeStr_1 =
        startTime_1.getHours() + ":" + startTime_1.getMinutes() + ":" + startTime_1.getSeconds();
    startTime_1.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_1 =
                startTime_1.getHours()
                    + ":"
                    + startTime_1.getMinutes()
                    + ":"
                    + startTime_1.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_3 = new Label(composite_2, SWT.NONE);
    lblNewLabel_3.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_3.setBounds(20, 54, 54, 16);
    lblNewLabel_3.setText("星期二");

    btnCheckButton_2 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_2.setBackground(EccTreeControl.color);
    btnCheckButton_2.setBounds(102, 51, 45, 16);
    btnCheckButton_2.setText("\u5141\u8BB8");
    if (lblNewLabel_3.getText().equals(date_2) && permission_2.equals("允许")) {
      btnCheckButton_2.setSelection(true);
    } else if (lblNewLabel_3.getText().equals(date_2) && permission_2.equals("禁止")) {
      btnCheckButton_2.setSelection(false);
    }

    final DateTime startTime_2 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_2.setLocation(164, 52);
    startTime_2.setSize(79, 15);
    int h2 = Integer.parseInt(time_2.substring(0, time_2.indexOf(":")));
    int m2 = Integer.parseInt(time_2.substring(time_2.indexOf(":") + 1, time_2.lastIndexOf(":")));
    int mm2 = Integer.parseInt(time_2.substring(time_2.lastIndexOf(":") + 1));
    startTime_2.setTime(h2, m2, mm2);
    startTimeStr_2 =
        startTime_2.getHours() + ":" + startTime_2.getMinutes() + ":" + startTime_2.getSeconds();
    startTime_2.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_2 =
                startTime_2.getHours()
                    + ":"
                    + startTime_2.getMinutes()
                    + ":"
                    + startTime_2.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_4 = new Label(composite_2, SWT.NONE);
    lblNewLabel_4.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_4.setBounds(20, 76, 54, 16);
    lblNewLabel_4.setText("星期三");

    btnCheckButton_3 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_3.setBackground(EccTreeControl.color);
    btnCheckButton_3.setBounds(102, 71, 45, 16);
    btnCheckButton_3.setText("\u5141\u8BB8");
    if (lblNewLabel_4.getText().equals(date_3) && permission_3.equals("允许")) {
      btnCheckButton_3.setSelection(true);
    } else if (lblNewLabel_4.getText().equals(date_3) && permission_3.equals("禁止")) {
      btnCheckButton_3.setSelection(false);
    }

    final DateTime startTime_3 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_3.setLocation(164, 73);
    startTime_3.setSize(79, 15);
    int h3 = Integer.parseInt(time_3.substring(0, time_3.indexOf(":")));
    int m3 = Integer.parseInt(time_3.substring(time_3.indexOf(":") + 1, time_3.lastIndexOf(":")));
    int mm3 = Integer.parseInt(time_3.substring(time_3.lastIndexOf(":") + 1));
    startTime_3.setTime(h3, m3, mm3);
    startTimeStr_3 =
        startTime_3.getHours() + ":" + startTime_3.getMinutes() + ":" + startTime_3.getSeconds();
    startTimeStr_3 =
        startTime_3.getHours() + ":" + startTime_3.getMinutes() + ":" + startTime_3.getSeconds();
    startTime_3.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_3 =
                startTime_3.getHours()
                    + ":"
                    + startTime_3.getMinutes()
                    + ":"
                    + startTime_3.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_5 = new Label(composite_2, SWT.NONE);
    lblNewLabel_5.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_5.setBounds(20, 98, 54, 16);
    lblNewLabel_5.setText("星期四");

    button = new Button(composite_2, SWT.CHECK);
    button.setBackground(EccTreeControl.color);
    button.setText("\u5141\u8BB8");
    button.setBounds(102, 93, 45, 16);
    if (lblNewLabel_5.getText().equals(date_4) && permission_4.equals("允许")) {
      button.setSelection(true);
    } else if (lblNewLabel_5.getText().equals(date_4) && permission_4.equals("禁止")) {
      button.setSelection(false);
    }

    final DateTime startTime_4 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_4.setLocation(164, 94);
    startTime_4.setSize(79, 15);
    int h4 = Integer.parseInt(time_4.substring(0, time_4.indexOf(":")));
    int m4 = Integer.parseInt(time_4.substring(time_4.indexOf(":") + 1, time_4.lastIndexOf(":")));
    int mm4 = Integer.parseInt(time_4.substring(time_4.lastIndexOf(":") + 1));
    startTime_4.setTime(h4, m4, mm4);
    startTimeStr_4 =
        startTime_4.getHours() + ":" + startTime_4.getMinutes() + ":" + startTime_4.getSeconds();
    startTime_4.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_4 =
                startTime_4.getHours()
                    + ":"
                    + startTime_4.getMinutes()
                    + ":"
                    + startTime_4.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_6 = new Label(composite_2, SWT.NONE);
    lblNewLabel_6.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_6.setBounds(20, 120, 54, 12);
    lblNewLabel_6.setText("星期五");
    btnCheckButton_4 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_4.setBackground(EccTreeControl.color);
    btnCheckButton_4.setBounds(102, 115, 45, 16);
    btnCheckButton_4.setText("\u5141\u8BB8");
    if (lblNewLabel_6.getText().equals(date_5) && permission_5.equals("允许")) {
      btnCheckButton_4.setSelection(true);
    } else if (lblNewLabel_6.getText().equals(date_5) && permission_5.equals("禁止")) {
      btnCheckButton_4.setSelection(false);
    }

    final DateTime startTime_5 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_5.setLocation(164, 115);
    startTime_5.setSize(79, 15);
    int h5 = Integer.parseInt(time_5.substring(0, time_5.indexOf(":")));
    int m5 = Integer.parseInt(time_5.substring(time_5.indexOf(":") + 1, time_5.lastIndexOf(":")));
    int mm5 = Integer.parseInt(time_5.substring(time_5.lastIndexOf(":") + 1));
    startTime_5.setTime(h5, m5, mm5);
    startTimeStr_5 =
        startTime_5.getHours() + ":" + startTime_5.getMinutes() + ":" + startTime_5.getSeconds();
    startTime_5.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_5 =
                startTime_5.getHours()
                    + ":"
                    + startTime_5.getMinutes()
                    + ":"
                    + startTime_5.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    lblNewLabel_7 = new Label(composite_2, SWT.NONE);
    lblNewLabel_7.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_7.setBounds(20, 142, 54, 16);
    lblNewLabel_7.setText("星期六");

    btnCheckButton_5 = new Button(composite_2, SWT.CHECK);
    btnCheckButton_5.setBackground(EccTreeControl.color);
    btnCheckButton_5.setBounds(102, 137, 45, 16);
    btnCheckButton_5.setText("\u5141\u8BB8");
    if (lblNewLabel_7.getText().equals(date_6) && permission_6.equals("允许")) {
      btnCheckButton_5.setSelection(true);
    } else if (lblNewLabel_7.getText().equals(date_6) && permission_6.equals("禁止")) {
      btnCheckButton_5.setSelection(false);
    }

    final DateTime startTime_6 = new DateTime(composite_2, SWT.TIME | SWT.SHORT);
    startTime_6.setLocation(164, 136);
    startTime_6.setSize(79, 15);
    int h6 = Integer.parseInt(time_6.substring(0, time_6.indexOf(":")));
    int m6 = Integer.parseInt(time_6.substring(time_6.indexOf(":") + 1, time_6.lastIndexOf(":")));
    int mm6 = Integer.parseInt(time_6.substring(time_6.lastIndexOf(":") + 1));
    startTime_6.setTime(h6, m6, mm6);
    startTimeStr_6 =
        startTime_6.getHours() + ":" + startTime_6.getMinutes() + ":" + startTime_6.getSeconds();
    startTime_6.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            startTimeStr_6 =
                startTime_6.getHours()
                    + ":"
                    + startTime_6.getMinutes()
                    + ":"
                    + startTime_6.getSeconds();
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    sashForm.setWeights(new int[] {1, 8});

    TabItem describeItem = new TabItem(tabFolder, SWT.NONE);
    describeItem.setText("描述");

    Composite composite2 = new Composite(tabFolder, SWT.NONE);
    composite2.setBackground(EccTreeControl.color);
    describeItem.setControl(composite2);
    composite2.setLayout(new BorderLayout(0, 0));

    Label label = new Label(composite2, SWT.HORIZONTAL);
    label.setAlignment(SWT.CENTER);
    label.setBackground(EccTreeControl.color);
    label.setBounds(0, 0, 54, 199);
    label.setLayoutData(BorderLayout.WEST);
    label.setText("\u63CF\u8FF0\uFF1A");

    text1 = new Text(composite2, SWT.WRAP | SWT.BORDER); // 描述
    text1.setLayoutData(BorderLayout.CENTER);
    text1.setText(Instruction);

    return composite;
  }
Ejemplo n.º 7
0
  public HTMLExplorerViewer(Composite parent, int type) {
    super(parent);

    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    setLayout(gridLayout);

    ApplicationFactory factory = new ApplicationFactory(this, "HTMLExplorer", "HTMLExplorer");
    suggestTip = factory.getLabel("suggest.tip");

    SashForm mainSash = new SashForm(this, SWT.VERTICAL);
    mainSash.setBackground(getBackground());
    GridData gridData = new GridData(GridData.FILL_BOTH);
    mainSash.setLayoutData(gridData);

    SashForm sash0 = new SashForm(mainSash, SWT.HORIZONTAL);
    sash0.setBackground(getBackground());
    sash0.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING));

    Composite browserComposite = new Composite(sash0, SWT.NONE);
    browserComposite.setBackground(getBackground());
    gridLayout = new GridLayout(1, false);
    gridLayout.marginHeight = 0;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 0;
    browserComposite.setLayout(gridLayout);

    ToolbarResource.createInstance(getDisplay(), "HTMLExplorer", HTMLExplorer.class);
    //    toolbar = new HTMLExplorerToolbar(factory, browserComposite, this);
    //    gridData = new GridData(GridData.FILL_HORIZONTAL);
    //    toolbar.setLayoutData(gridData);
    //    toolbar.setBackground(getBackground());

    browser = ApplicationFactory.createBrowser(browserComposite, PageMenu.class);
    if (ApplicationFactory.isMozillaBrowser()) {
      browser.addProgressListener(
          new ProgressAdapter() {
            @SuppressWarnings("unused")
            public void completed(ProgressEvent event) {
              nsIWebBrowser webBrowser = (nsIWebBrowser) browser.getWebBrowser();
              if (webBrowser == null) return;
              nsIDOMWindow domWindow = webBrowser.getContentDOMWindow();
              if (domWindow == null) return;
              nsIDOMEventTarget target =
                  (nsIDOMEventTarget)
                      domWindow.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
              nsIDOMEventListener listener =
                  new nsIDOMEventListener() {
                    public nsISupports queryInterface(String uuid) {
                      if (uuid.equals(nsIDOMEventListener.NS_IDOMEVENTLISTENER_IID)
                          || uuid.equals(nsIDOMEventListener.NS_ISUPPORTS_IID)) {
                        return this;
                      }
                      return null;
                    }

                    public void handleEvent(nsIDOMEvent devent) {
                      nsIDOMElement element =
                          (nsIDOMElement)
                              devent.getTarget().queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
                      String text = element.getFirstChild().getNodeValue();
                      if (text == null || text.trim().isEmpty() || "null".equalsIgnoreCase(text))
                        return;
                      search(text.trim());
                    }
                  };
              target.addEventListener("click", listener, false);
            }
          });
    }

    gridData = new GridData(GridData.FILL_BOTH);
    browser.setLayoutData(gridData);
    browser.setBackground(getBackground());
    browser.addProgressListener(
        new ProgressAdapter() {
          public void changed(ProgressEvent event) {
            if (event.total == 0) return;
            int ratio = event.current * 100 / event.total;
            showInformation("Loading " + String.valueOf(ratio) + "%");
            String url = browser.getUrl();
            if (url != null && url.length() > 2 && !url.startsWith("about")) {
              currentURL = url;
            }
          }

          @SuppressWarnings("unused")
          public void completed(ProgressEvent event) {
            showInformation(suggestTip);
          }
        });

    browser.addStatusTextListener(
        new StatusTextListener() {
          @SuppressWarnings("unused")
          public void changed(StatusTextEvent event) {
            String url = browser.getUrl();
            if (url == null) return;
            if (url.indexOf('/') < 0) return;
            showInformation("Waiting for " + browser.getUrl());
            //        toolbar.setText(browser.getUrl());
          }
        });

    factory.setComposite(browserComposite);
    tree = new Tree(sash0, SWT.MULTI | SWT.BORDER);
    tree.addSelectionListener(
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            String path = selectTree();
            if (path != null) box.setSuggestPath(path);
          }
        });
    tree.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (e.button == 2) addItems();
          }
        });
    tree.setToolTipText(suggestTip);

    Menu treeMenu = new Menu(getShell(), SWT.POP_UP);
    tree.setMenu(treeMenu);

    factory.createStyleMenuItem(
        treeMenu,
        "itemAdd",
        "+.gif",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            try {
              traverseTree(TreeHandler.SELECT, addItems());
            } catch (Exception e) {
              ClientLog.getInstance().setMessage(tree.getShell(), e);
            }
          }
        });

    factory.createStyleMenuItem(
        treeMenu,
        "itemRemove",
        "-.gif",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            try {
              removeItem();
            } catch (Exception e) {
              ClientLog.getInstance().setMessage(tree.getShell(), e);
            }
          }
        });

    factory.createStyleMenuItem(treeMenu, SWT.SEPARATOR);

    factory.createStyleMenuItem(
        treeMenu,
        "itemExpand",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            expand(true);
          }
        });

    factory.createStyleMenuItem(
        treeMenu,
        "itemCollapse",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            expand(false);
          }
        });

    factory.createStyleMenuItem(treeMenu, SWT.SEPARATOR);

    factory.createStyleMenuItem(
        treeMenu,
        "itemExpandDataNode",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            expandDataNode();
          }
        });

    factory.createStyleMenuItem(
        treeMenu,
        "itemCollapseTree",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            TreeItem[] items = tree.getItems();
            if (items == null) return;
            for (TreeItem item : items) {
              expand(item, false);
            }
          }
        });

    factory.createStyleMenuItem(treeMenu, SWT.SEPARATOR);

    factory.createStyleMenuItem(
        treeMenu,
        "itemView",
        "view.gif",
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            viewItem();
          }
        });

    sash0.setWeights(new int[] {500, 300});
    handler = new TreeHandler();
    box = new PathBox(mainSash, factory);
    box.setLayoutData(gridData);
    //    String [] paths = {
    //
    // "BODY[0].TABLE[0].TBODY[0].TR[0].TD[0].TABLE[5].TBODY[0].TR[0].TD[0].TABLE[0].TBODY[0].TR[0].TD[2].TABLE[2].TBODY[0].TR[0].TD[0].TABLE[1].TBODY[0].TR[0].TD[2]",
    //
    // "BODY[0].TABLE[0].TBODY[0].TR[0].TD[0].TABLE[5].TBODY[0].TR[0].TD[0].TABLE[0].TBODY[0].TR[0].TD[2].TABLE[2].TBODY[0].TR[0].TD[0].TABLE[2].TBODY[0].TR[1]",
    //        "BODY[0].DIV[0].DIV[4].DIV[0].DIV[0]",
    //
    // "BODY[0].DIV[0].DIV[0].DIV[2].DIV[0].DIV[0].DIV[0].TABLE[0].TBODY[0].TR[1].TD[0].TABLE[0].TBODY[0].TR[1].TD[0].TABLE[0].TBODY[0].TR[0].TD[1].CONTENT[2]]"
    //    };
    //    box.setItems(paths);
    box.addSelectionListener(
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent e) {
            lblStatus.setText("");
            String path = box.getSelectedPath();
            if (path == null) return;
            try {
              traverseTree(TreeHandler.SELECT, new String[] {path});
            } catch (Exception exp) {
              ClientLog.getInstance().setMessage(tree.getShell(), exp);
            }
            if (isErrorPath(path)) showErrorPath(path);
          }
        });
    box.addSelectionListener(
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent e) {
            //        butDown.setVisible(true);
            //        butUp.setVisible(true);
            highlightErrorPath(box.getSelectedPath());
          }
        });
    box.addItemChangePath(
        new PathBox.ChangePath() {
          @Override
          public void change(PathEvent event) {
            traverseByPath(event.getPath());
            //        NodePathParser pathParser = new NodePathParser();
            //        NodePath nodePath = null;
            //        try {
            //          nodePath = pathParser.toPath(path);
            //        } catch (Exception exp) {
            //          return;
            //        }
            //        handler.traverseTree(HTMLExplorerViewer.this, tree, nodePath, path);
          }
        });
    box.addItemRemovePath(
        new RemovePath() {
          public void remove(PathEvent event) {
            try {
              traverseTree(TreeHandler.REMOVE, new String[] {event.getPath()});
            } catch (Exception e) {
              ClientLog.getInstance().setMessage(getShell(), e);
            }
          }
        });
    box.addItemCurrentPath(
        new PathBox.CurrentPath() {
          @Override
          public void change(PathBox.PathEvent event) {
            if (document == null) return;
            String path = event.getPath();
            String[] attrs = getAttrs(path);
            box.showAttrItemPopup(attrs);
          }
        });
    box.addSuggestCurrentPath(
        new PathBox.CurrentPath() {
          @Override
          public void change(PathBox.PathEvent event) {
            if (document == null) return;
            String path = event.getPath();
            String[] attrs = getAttrs(path);
            box.getSuggestWidget().showAttrSuggestion(attrs);
          }
        });

    mainSash.setWeights(new int[] {80, 20});

    if (type == HTMLExplorer.CONTENT) createButtonComponent(factory);
  }