Package sos.scheduler.editor.doc.forms

Source Code of sos.scheduler.editor.doc.forms.JobForm

/********************************************************* begin of preamble
**
** Copyright (C) 2003-2010 Software- und Organisations-Service GmbH.
** All rights reserved.
**
** This file may be used under the terms of either the
**
**   GNU General Public License version 2.0 (GPL)
**
**   as published by the Free Software Foundation
**   http://www.gnu.org/licenses/gpl-2.0.txt and appearing in the file
**   LICENSE.GPL included in the packaging of this file.
**
** or the
** 
**   Agreement for Purchase and Licensing
**
**   as offered by Software- und Organisations-Service GmbH
**   in the respective terms of supply that ship with this file.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
** IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
** BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE.
********************************************************** end of preamble*/
package sos.scheduler.editor.doc.forms;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.jdom.Element;
import sos.scheduler.editor.app.IUpdateLanguage;
import sos.scheduler.editor.app.Messages;
import sos.scheduler.editor.app.Utils;
import sos.scheduler.editor.doc.DocumentationDom;
import sos.scheduler.editor.doc.listeners.JobListener;

public class JobForm extends Composite implements IUpdateLanguage {
    private JobListener listener = null;

    private Group       group    = null;

    private Label       label    = null;

    private Text        tName    = null;

    private Label       label1   = null;

    private Text        tTitle   = null;

    private Label       label2   = null;

    private Label       label3   = null;

    private Combo       cOrder   = null;

    private Combo       cTasks   = null;


    public JobForm(Composite parent, int style, DocumentationDom dom, Element job) {
        super(parent, style);
        initialize();
        setToolTipText();

        listener = new JobListener(dom, job);
        initValues();
    }


    private void initialize() {
        createGroup();
        setSize(new Point(696, 462));
        setLayout(new FillLayout());

    }


    /**
     * This method initializes group
     */
    private void createGroup() {
        GridData gridData1 = new GridData();
        gridData1.horizontalAlignment = GridData.FILL; // Generated
        gridData1.grabExcessHorizontalSpace = true; // Generated
        gridData1.verticalAlignment = GridData.CENTER; // Generated
        GridData gridData = new GridData();
        gridData.horizontalAlignment = GridData.FILL; // Generated
        gridData.grabExcessHorizontalSpace = true; // Generated
        gridData.verticalAlignment = GridData.CENTER; // Generated
        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 2; // Generated
        group = new Group(this, SWT.NONE);
        group.setText("Job"); // Generated
        group.setLayout(gridLayout); // Generated
        label = new Label(group, SWT.NONE);
        label.setText("Name:"); // Generated
        tName = new Text(group, SWT.BORDER);
        tName.addFocusListener(new FocusAdapter() {
          public void focusGained(final FocusEvent e) {
            tName.selectAll();
          }
        });
        tName.setLayoutData(gridData); // Generated
        tName.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
            public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
                listener.setName(tName.getText());
                Utils.setBackground(tName, true);
            }
        });
        label1 = new Label(group, SWT.NONE);
        label1.setText("Title:"); // Generated
        tTitle = new Text(group, SWT.BORDER);
        tTitle.addFocusListener(new FocusAdapter() {
          public void focusGained(final FocusEvent e) {
            tTitle.selectAll();
          }
        });
        tTitle.setLayoutData(gridData1); // Generated
        tTitle.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
            public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
                listener.setTitle(tTitle.getText());
                Utils.setBackground(tTitle, true);
            }
        });
        label2 = new Label(group, SWT.NONE);
        label2.setText("Order:"); // Generated
        createCOrder();
        label3 = new Label(group, SWT.NONE);
        label3.setText("Tasks:"); // Generated
        GridData gridData3 = new GridData(200, SWT.DEFAULT);
        cTasks = new Combo(group, SWT.BORDER | SWT.READ_ONLY);
        cTasks.setLayoutData(gridData3); // Generated
        cTasks.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                listener.setTasks(cTasks.getText());
            }


            public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
            }
        });
        new Label(group, SWT.NONE);

        final Button vorschauButton = new Button(group, SWT.NONE);
        vorschauButton.setLayoutData(new GridData());
        vorschauButton.addSelectionListener(new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {
            listener.preview();
          }
        });
        vorschauButton.setText("Preview");
        createCTasks();
    }


    /**
     * This method initializes cOrder
     */
    private void createCOrder() {
        GridData gridData2 = new GridData();
        gridData2.horizontalAlignment = GridData.BEGINNING; // Generated
        gridData2.widthHint = 200; // Generated
        gridData2.verticalAlignment = GridData.CENTER; // Generated
        cOrder = new Combo(group, SWT.BORDER | SWT.READ_ONLY);
        cOrder.setLayoutData(gridData2); // Generated
        cOrder.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                listener.setOrder(cOrder.getText());
            }


            public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
            }
        });
    }


    /**
     * This method initializes cTasks
     */
    private void createCTasks() {
    }


    private void initValues() {
        tName.setText(listener.getName());
        tTitle.setText(listener.getTitle());
        cOrder.setItems(listener.getOrderValues());
        cOrder.select(cOrder.indexOf(listener.getOrder()));
        cTasks.setItems(listener.getTasksValues());
        cTasks.select(cTasks.indexOf(listener.getTasks()));

        tName.setFocus();
    }


    public void setToolTipText() {
        tName.setToolTipText(Messages.getTooltip("doc.job.name"));
        tTitle.setToolTipText(Messages.getTooltip("doc.job.title"));
        cOrder.setToolTipText(Messages.getTooltip("doc.job.order"));
        cTasks.setToolTipText(Messages.getTooltip("doc.job.tasks"));
    }

} // @jve:decl-index=0:visual-constraint="10,10"
TOP

Related Classes of sos.scheduler.editor.doc.forms.JobForm

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.