/** * Set the major UI features of this basic view composite * * @param textEditor * @param parentComposite * @param styleBit */ public Transition(final XMLEditor textEditor, final Composite parentComposite, int styleBit) { super(parentComposite, SWT.BORDER); setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_MAGENTA)); this.textEditor = textEditor; addDisposeListener( new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { toolkit.dispose(); } }); toolkit.adapt(this); toolkit.paintBordersFor(this); setLayout(new FormLayout()); setLayoutData(new GridData(GridData.FILL_BOTH)); final ScrolledComposite parentScrolledComposite = new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL); parentScrolledComposite.setAlwaysShowScrollBars(true); parentScrolledComposite.setExpandHorizontal(true); parentScrolledComposite.setExpandVertical(true); FormData parentScrolledCompositeFormLayoutData = new FormData(); parentScrolledCompositeFormLayoutData.right = new FormAttachment(100); parentScrolledCompositeFormLayoutData.bottom = new FormAttachment(100); parentScrolledCompositeFormLayoutData.top = new FormAttachment(0, 5); parentScrolledCompositeFormLayoutData.left = new FormAttachment(0, 5); parentScrolledComposite.setLayoutData(parentScrolledCompositeFormLayoutData); this.setData(parentScrolledComposite); baseContainer = new Composite(parentScrolledComposite, SWT.NONE); baseContainer.setBackground(SWTResourceManager.getColor(204, 153, 255)); parentScrolledComposite.setContent(baseContainer); baseContainer.setLayout(new GridLayout(1, true)); try { CentralUtils centralUtils = CentralUtils.getCentralUtils(textEditor); centralUtils.setBasicUI(parentScrolledComposite, baseContainer); centralUtils.unmarshal(textEditor); } catch (JAXBException e) { LOG.info(e.getMessage()); } // create a THumanInteractions object if humanInteractions variable is // null if (textEditor.getRootElement() == null) { humanInteractions = new THumanInteractions(); textEditor.setRootElement(humanInteractions); } try { // create the biggest xml element- UI section humanInteractionsUI = new THumanInteractionsUI( textEditor, baseContainer, this, SWT.NONE, textEditor.getRootElement(), 0, 0); } catch (JAXBException e1) { LOG.info(e1.getMessage()); } }
public void refreshLogic(XMLEditor editor) throws JAXBException { if (humanInteractions != null) { humanInteractionsUI.dispose(); humanInteractionsUI = new THumanInteractionsUI( textEditor, baseContainer, this, SWT.NONE, textEditor.getRootElement(), 0, 0); humanInteractionsUI.initialize(editor); } }