Example usage for com.jgoodies.forms.layout CellConstraints xyw

List of usage examples for com.jgoodies.forms.layout CellConstraints xyw

Introduction

In this page you can find the example usage for com.jgoodies.forms.layout CellConstraints xyw.

Prototype

public CellConstraints xyw(int col, int row, int colSpan) 

Source Link

Document

Sets the column, row, width, and height; uses a height (row span) of 1 and the horizontal and vertical default alignments.

Examples:

 cc.xyw(1, 3, 7); cc.xyw(1, 3, 2); 

Usage

From source file:gui.datasource.TDriverRecord.java

License:Open Source License

public TDriverRecord(Record rcd, boolean newr) {
    super(null, rcd, newr);

    setVisibleMessagePanel(false);/*  www. ja va 2 s.co m*/

    addInputComponent("t_drname", TUIUtils.getJTextField(rcd, "t_drname"), true, true);
    addInputComponent("t_drclass", TUIUtils.getJTextField(rcd, "t_drclass"), true, true);
    addInputComponent("t_drlibrary", TUIUtils.getJTextField(rcd, "t_drlibrary"), true, true);
    addInputComponent("t_drsampleurl", TUIUtils.getJTextField(rcd, "t_drsampleurl"), true, true);

    FormLayout lay = new FormLayout("left:pref, 300dlu", // columns
            "p, p, 3dlu, p, p, 3dlu, p, p, 3dlu, p, p, 3dlu, p, p"); // rows
    CellConstraints cc = new CellConstraints();
    PanelBuilder build = new PanelBuilder(lay);

    build.add(getLabelFor("t_drname"), cc.xy(1, 1));
    build.add(getInputComponent("t_drname"), cc.xyw(1, 2, 2));
    build.add(getLabelFor("t_drclass"), cc.xy(1, 4));
    build.add(getInputComponent("t_drclass"), cc.xyw(1, 5, 2));
    build.add(getLabelFor("t_drlibrary"), cc.xy(1, 7));
    build.add(getInputComponent("t_drlibrary"), cc.xyw(1, 8, 2));
    build.add(getLabelFor("t_drsampleurl"), cc.xy(1, 10));
    build.add(getInputComponent("t_drsampleurl"), cc.xyw(1, 11, 2));

    setActionBar(new ApplyAction(this));
    addWithoutBorder(build.getPanel());

    preValidate(null);
}

From source file:gui.TaskRecord.java

License:Open Source License

/**
 * nueva instancia//from   w  w w  . j  a  v  a  2s .  com
 * 
 * @param rcd - registro
 * @param newr - true si es nuevo registro
 */
public TaskRecord(Record rcd, boolean newr) {
    super("title.task", rcd, newr);
    addInputComponent("t_taname", TUIUtils.getJTextField(rcd, "t_taname"), true, newr);
    addInputComponent("t_tadescription", TUIUtils.getJTextArea(rcd, "t_tadescription"), true, true);
    addInputComponent("t_tastatus", TUIUtils.getJComboBox("rcd_sts", rcd, "t_tastatus"), true, true);
    //   addInputComponent("t_taid", TUIUtils.getExtendedJLabel(rcd, "t_taid", false), true, false);

    FormLayout lay = new FormLayout("left:pref, 3dlu, pref, 7dlu, left:pref, 3dlu, 110dlu", // columns
            "p, 3dlu, p, p, 3dlu, p, 3dlu, p, 150dlu");// rows
    CellConstraints cc = new CellConstraints();
    PanelBuilder build = new PanelBuilder(lay);

    build.add(getLabelFor("t_taname"), cc.xy(1, 1));
    build.add(getInputComponent("t_taname"), cc.xy(3, 1));
    build.add(getLabelFor("t_tadescription"), cc.xy(1, 3));
    build.add(getInputComponent("t_tadescription"), cc.xyw(1, 4, 3));
    build.add(getLabelFor("t_tastatus"), cc.xy(1, 6));
    build.add(getInputComponent("t_tastatus"), cc.xy(3, 6));
    //      build.add(getLabelFor("t_taid"), cc.xy(5, 6));
    //      build.add(getInputComponent("t_taid"), cc.xy(7, 6));
    build.add(TUIUtils.getJLabel("Parametros de la tares", false, true), cc.xyw(1, 8, 7));
    build.add(createTable(rcd), cc.xyw(1, 9, 7));

    setDefaultActionBar();
    add(build.getPanel());
    preValidate(null);
}

From source file:gui.UserLogIn.java

License:Open Source License

/**
 * nueva instancia/*from ww w .ja  v  a 2  s.c o m*/
 * 
 * @param usr - registro de usuario
 * 
 */
public UserLogIn() {
    super("security.title04", null, false);
    this.t_usmax_attemps = -1;
    ServiceRequest r = new ServiceRequest(ServiceRequest.DB_REQUEST_MODEL, "t_users", null);
    this.usrmod = (Record) ((ServiceResponse) ServiceConnection.sendTransaction(r)).getData();
    setModel(usrmod);
    addPropertyChangeListener(TConstants.ACTION_PERFORMED, this);
    this.jtf_user_id = TUIUtils.getJTextField("ttt_ususer_id", (String) usrmod.getFieldValue("t_ususer_id"),
            10);
    JPasswordField jtfp = TUIUtils.getJPasswordField("ttt_uspassword",
            (String) usrmod.getFieldValue("t_uspassword"), 10);
    jtfp.setText("");
    addInputComponent("t_ususer_id", jtf_user_id, true, true);
    addInputComponent("t_uspassword", jtfp, true, true);

    // recordar usuario
    boolean bol = (Boolean) TPreferences.getPreference(TPreferences.REMIND_USER, "", false);
    jtf_user_id.setText((String) TPreferences.getPreference(TPreferences.USER, "", ""));
    this.jcb_rem_usr = TUIUtils.getJCheckBox("security.r05", bol);

    FormLayout lay = new FormLayout("left:pref, 3dlu, pref, 7dlu, left:pref, 3dlu, pref",
            "pref, 3dlu, pref, 3dlu, pref, 3dlu, pref");
    PanelBuilder bui = new PanelBuilder(lay);
    CellConstraints cc = new CellConstraints();
    bui.add(getLabelFor("t_ususer_id"), cc.xy(1, 1));
    bui.add(getInputComponent("t_ususer_id"), cc.xy(3, 1));
    bui.add(getLabelFor("t_uspassword"), cc.xy(5, 1));
    bui.add(getInputComponent("t_uspassword"), cc.xy(7, 1));
    bui.add(jcb_rem_usr, cc.xyw(1, 5, 3));

    setDefaultActionBar();
    add(bui.getPanel());
    preValidate(null);
}

From source file:gui.UserRecord.java

License:Open Source License

/**
 * nueva instancia/*from w  w  w . j  av a  2s  . co m*/
 * 
 * @param rcd - registro
 * @param newr - true si es para crear un nuevo registro
 * @param uid - id de tipo de usuario a crear (constant.prperties)
 */
public UserRecord(Record rcd, boolean newr) {
    super(null, rcd, newr);

    ServiceRequest sr = new ServiceRequest(ServiceRequest.DB_QUERY, "t_users", "t_usrcd_type = 'grou'");
    RecordSelector rcds = new RecordSelector(sr, "t_ususer_id", "t_usname", rcd.getFieldValue("t_usroll"));
    // para cualquier usuario exepto *master
    if (!rcd.getFieldValue("t_ususer_id").equals("*master")) {
        //         rcds.insertItemAt(ConstantUtilities.getConstant("none"), 0);
        rcds.insertItemAt(TStringUtils.getTEntry("usrrol.none"), 0);
    } else {
        // para master
        rcds.removeAllItems();
        rcds.insertItemAt(TStringUtils.getTEntry("usrrol.master"), 0);
        //         rcds.insertItemAt(ConstantUtilities.getConstant("*master"), 0);
    }

    rcdT = TUIUtils.getJComboBox("t_usrcd_type", rcd, "t_usrcd_type");
    rcdT.addActionListener(this);

    addInputComponent("t_usrcd_type", rcdT, false, newr);
    addInputComponent("t_ususer_id", TUIUtils.getJTextField(rcd, "t_ususer_id"), true, newr);
    addInputComponent("t_usname", TUIUtils.getJTextField(rcd, "t_usname"), true, true);
    addInputComponent("t_usdescrip", TUIUtils.getJTextArea(rcd, "t_usdescrip"), false, true);
    addInputComponent("t_uspassword", TUIUtils.getJTextField(rcd, "t_uspassword"), true, true);
    addInputComponent("t_usroll", rcds, false, true);

    addInputComponent("t_usmc_upper", TUIUtils.getJCheckBox(rcd, "t_usmc_upper"), false, true);
    addInputComponent("t_usmc_digit", TUIUtils.getJCheckBox(rcd, "t_usmc_digit"), false, true);
    addInputComponent("t_usmc_ssimb", TUIUtils.getJCheckBox(rcd, "t_usmc_ssimb"), false, true);
    addInputComponent("t_uspass_mlen", TUIUtils.getJFormattedTextField(rcd, "t_uspass_mlen"), true, true,
            SystemVariables.getintVar("passMinLength"), SystemVariables.getintVar("passMaxLength"));

    ;
    ;
    addInputComponent("t_usmax_attemps", TUIUtils.getJFormattedTextField(rcd, "t_usmax_attemps"), true, true,
            SystemVariables.getintVar("loginMinAttemps"), SystemVariables.getintVar("loginMaxAttemps"));
    addInputComponent("t_usstatus", TUIUtils.getJComboBox("rcd_sts", rcd, "t_usstatus"), false, true);

    FormLayout lay = new FormLayout("left:pref, 3dlu, pref, 7dlu, left:pref, 3dlu, pref", // columns
            "p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, p, 3dlu p, 3dlu p"); // rows
    // lay.setColumnGroups(new int[][] { { 1, 5 }, { 3, 7 } });
    CellConstraints cc = new CellConstraints();
    PanelBuilder build = new PanelBuilder(lay);

    build.add(getLabelFor("t_usrcd_type"), cc.xy(1, 1));
    build.add(getInputComponent("t_usrcd_type"), cc.xy(3, 1));
    build.add(getLabelFor("t_ususer_id"), cc.xy(1, 3));
    build.add(getInputComponent("t_ususer_id"), cc.xy(3, 3));
    build.add(getLabelFor("t_uspassword"), cc.xy(5, 3));
    build.add(getInputComponent("t_uspassword"), cc.xy(7, 3));
    build.add(getLabelFor("t_usname"), cc.xy(1, 5));
    build.add(getInputComponent("t_usname"), cc.xyw(3, 5, 5));
    build.add(getLabelFor("t_usroll"), cc.xy(1, 7));
    build.add(getInputComponent("t_usroll"), cc.xyw(3, 7, 3));
    build.add(getLabelFor("t_usmax_attemps"), cc.xy(1, 9));
    build.add(getInputComponent("t_usmax_attemps"), cc.xy(3, 9));
    build.add(getLabelFor("t_uspass_mlen"), cc.xy(5, 9));
    build.add(getInputComponent("t_uspass_mlen"), cc.xy(7, 9));
    build.add(getLabelFor("t_uspass_mlen"), cc.xy(5, 9));
    build.add(getInputComponent("t_uspass_mlen"), cc.xy(7, 9));
    build.add(getLabelFor("t_usdescrip"), cc.xy(1, 11));
    build.add(getInputComponent("t_usdescrip"), cc.xyw(1, 12, 7));

    JPanel jp1 = new JPanel(new GridLayout(0, 2));
    jp1.add(getInputComponent("t_usmc_upper"));
    jp1.add(getInputComponent("t_usmc_digit"));
    jp1.add(getInputComponent("t_usmc_ssimb"));
    jp1.add(Box.createGlue());

    jp1.setBorder(new TitledBorder(TStringUtils.getBundleString("f05")));
    build.add(jp1, cc.xyw(1, 14, 7));

    build.add(getLabelFor("t_usstatus"), cc.xy(1, 16));
    build.add(getInputComponent("t_usstatus"), cc.xy(3, 16));

    setDefaultActionBar();
    add(build.getPanel());
    preValidate(null);
}

From source file:i18nplugin.LanguageChooser.java

License:Open Source License

/**
 * Create the Dialog//from   ww w .  j a v a 2  s. c  o m
 *
 * @param parent Parent-Dialog
 * @param currentLanguages Current Languages
 */
public LanguageChooser(JDialog parent, Vector<Locale> currentLanguages) {
    super(parent, true);

    Locale[] loc = Locale.getAvailableLocales();

    Arrays.sort(loc, new Comparator<Locale>() {
        public int compare(Locale o1, Locale o2) {
            return o1.getDisplayName().compareTo(o2.getDisplayName());
        }
    });

    Vector<Locale> newLocales = new Vector<Locale>();

    for (Locale locale : loc) {
        if ((!locale.getLanguage().equals("en")) && !currentLanguages.contains(locale)) {
            newLocales.add(locale);
        }
    }

    setTitle(mLocalizer.msg("addLanguage", "Add Language"));
    JPanel panel = (JPanel) getContentPane();

    panel.setLayout(new FormLayout("fill:pref:grow, center:pref, fill:pref:grow",
            "pref, 3dlu, pref, fill:3dlu:grow, pref"));
    panel.setBorder(Borders.DLU4_BORDER);
    CellConstraints cc = new CellConstraints();

    panel.add(new JLabel(mLocalizer.msg("chooseLanguage", "Please choose language:")), cc.xyw(1, 1, 3));

    mLangBox = new JComboBox(newLocales);
    mLangBox.setRenderer(new DefaultListCellRenderer() {
        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            return super.getListCellRendererComponent(list, ((Locale) value).getDisplayName(), index,
                    isSelected, cellHasFocus);
        }
    });

    panel.add(mLangBox, cc.xy(2, 3));

    ButtonBarBuilder2 builder = new ButtonBarBuilder2();

    JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            mSelectedLocale = (Locale) mLangBox.getSelectedItem();
            close();
        }
    });

    JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            close();
        }
    });

    builder.addGlue();
    builder.addButton(new JButton[] { ok, cancel });

    panel.add(builder.getPanel(), cc.xyw(1, 5, 3));

    getRootPane().setDefaultButton(ok);

    pack();

    UiUtilities.registerForClosing(this);
}

From source file:i18nplugin.TranslationDialog.java

License:Open Source License

private void createGui(final int splitPos) {
    setTitle(mLocalizer.msg("title", "Translation Tool"));

    JPanel panel = (JPanel) getContentPane();
    panel.setBorder(Borders.DLU4_BORDER);

    panel.setLayout(new FormLayout("3dlu, left:pref, 3dlu, pref, 3dlu, pref, fill:pref:grow, 3dlu",
            "pref, 5dlu, pref, 3dlu, pref, 5dlu, pref, 5dlu, fill:10dlu:grow, 3dlu, pref"));

    CellConstraints cc = new CellConstraints();

    panel.add(DefaultComponentFactory.getInstance()
            .createSeparator(mLocalizer.msg("chooseLanguage", "Choose Language")), cc.xyw(1, 1, 8));

    panel.add(new JLabel(mLocalizer.msg("language", "Language:")), cc.xy(2, 3));

    mCurrentLocales = new Vector<Locale>();
    Locale[] locales = mLocalizer.getAllAvailableLocales();

    for (Locale locale : locales) {
        if (!locale.getLanguage().equals("en")) {
            mCurrentLocales.add(locale);
        }/*  w w  w.  j  a va  2  s . c o  m*/
    }

    mLanguageCB = new JComboBox(mCurrentLocales);
    mLanguageCB.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Locale loc = (Locale) mLanguageCB.getSelectedItem();

            mTreeRenderer.setCurrentLocale(loc);
            mEditor.save();
            mEditor.setCurrentLocale(loc);
            filterChanged(mFilterTF.getText());
            mTree.repaint();
        }
    });

    mLanguageCB.setRenderer(new DefaultListCellRenderer() {
        public java.awt.Component getListCellRendererComponent(javax.swing.JList list, Object value, int index,
                boolean isSelected, boolean cellHasFocus) {
            return super.getListCellRendererComponent(list, ((Locale) value).getDisplayName(), index,
                    isSelected, cellHasFocus);
        }
    });

    panel.add(mLanguageCB, cc.xy(4, 3));

    JButton newButton = new JButton(TVBrowserIcons.newIcon(TVBrowserIcons.SIZE_SMALL));
    newButton.setToolTipText(mLocalizer.msg("newLanguage", "Add new language"));

    newButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addLanguage();
        }
    });

    panel.add(newButton, cc.xy(6, 3));

    panel.add(DefaultComponentFactory.getInstance().createSeparator(mLocalizer.msg("translate", "Translate")),
            cc.xyw(1, 5, 8));

    panel.add(new JLabel(mLocalizer.msg("search", "Search:")), cc.xy(2, 7));

    mFilterTF = new JTextField();
    panel.add(mFilterTF, cc.xy(4, 7));

    mClearFilterB = new JButton(IconLoader.getInstance().getIconFromTheme("action", "process-stop", 16));
    mClearFilterB.setEnabled(false);
    mClearFilterB.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            mFilterTF.setText(null);
        }
    });
    panel.add(mClearFilterB, cc.xy(6, 7));

    DefaultMutableTreeNode root = createRootNode();

    mTree = new JTree(root) {
        public void updateUI() {
            setUI(new SingleAndDoubleClickTreeUI(SingleAndDoubleClickTreeUI.AUTO_COLLAPSE_EXPAND,
                    getSelectionPath()));
            invalidate();
        }
    };

    mTreeRenderer = new PropertiesTreeCellRenderer(Locale.GERMAN);
    mTree.setCellRenderer(mTreeRenderer);

    mSplitpane = new JSplitPane();
    mSplitpane.setLeftComponent(new JScrollPane(mTree));

    panel.add(mSplitpane, cc.xyw(2, 9, 6));

    mEditor = new TranslatorEditor(Locale.GERMAN);
    final JPanel cardPanel = new JPanel(new CardLayout());

    cardPanel.add(mEditor, EDITOR);

    JEditorPane help = new JEditorPane("text/html", mLocalizer.msg("helpText", "<h1>Help missing</h1>"));
    help.setEditable(false);

    cardPanel.add(new JScrollPane(help, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), HELP);

    mTree.addTreeSelectionListener(new TreeSelectionListener() {
        public void valueChanged(TreeSelectionEvent e) {
            CardLayout cl = (CardLayout) (cardPanel.getLayout());

            if (mTree.getSelectionPath() != null) {
                Object node = mTree.getSelectionPath().getLastPathComponent();

                if (node instanceof PropertiesEntryNode) {
                    mEditor.save();
                    mEditor.setSelectedProperties((PropertiesEntryNode) node);
                    cl.show(cardPanel, EDITOR);
                } else {
                    cl.show(cardPanel, HELP);
                }
            } else {
                cl.show(cardPanel, HELP);
            }

        }
    });

    mTree.setSelectionPath(new TreePath(root));

    mSplitpane.setRightComponent(cardPanel);

    if (splitPos > 0) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                mSplitpane.setDividerLocation(splitPos);
            }
        });
    }

    ButtonBarBuilder2 buttonbar = new ButtonBarBuilder2();

    JButton save = new JButton(mLocalizer.msg("save", "Save"));

    save.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            save();
        }
    });

    JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent e) {
            close();
        }
    });

    JButton export = new JButton(IconLoader.getInstance().getIconFromTheme("actions", "document-save-as", 16));
    export.setToolTipText(mLocalizer.msg("export", "Export Translations to File"));

    export.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            export();
        }
    });

    LinkButton link = new LinkButton(mLocalizer.msg("getHelp", "Get Help"),
            mLocalizer.msg("getHelpUrl", "http://enwiki.tvbrowser.org"));

    buttonbar.addFixed(export);
    buttonbar.addGlue();
    buttonbar.addFixed(link);
    buttonbar.addGlue();
    buttonbar.addButton(new JButton[] { save, cancel });

    panel.add(buttonbar.getPanel(), cc.xyw(2, 11, 6));

    getRootPane().setDefaultButton(cancel);
    UiUtilities.registerForClosing(this);

    setSize(Sizes.dialogUnitXAsPixel(500, this), Sizes.dialogUnitYAsPixel(410, this));

    mLanguageCB.setSelectedIndex(0);

    mFilterTF.getDocument().addDocumentListener(new DocumentListener() {
        public void removeUpdate(DocumentEvent e) {
            filterChanged(mFilterTF.getText());
        }

        public void insertUpdate(DocumentEvent e) {
            filterChanged(mFilterTF.getText());
        }

        public void changedUpdate(DocumentEvent e) {
            filterChanged(mFilterTF.getText());
        }
    });

}

From source file:i18nplugin.TranslatorEditor.java

License:Open Source License

private void createGui() {
    setLayout(new FormLayout("fill:min:grow", "fill:min:grow, pref"));
    CellConstraints cc = new CellConstraints();

    // Top/*from ww w.j av a  2 s .c o m*/
    PanelBuilder topPanel = new PanelBuilder(new FormLayout("fill:10dlu:grow", "pref, 5dlu, fill:pref:grow"));
    topPanel.setBorder(Borders.DLU4_BORDER);
    topPanel.addSeparator(mLocalizer.msg("original", "Original text"), cc.xy(1, 1));

    mOriginal = new JTextArea();
    mOriginal.setWrapStyleWord(false);
    mOriginal.setEditable(false);

    topPanel.add(new JScrollPane(mOriginal), cc.xy(1, 3));

    // Bottom
    PanelBuilder bottomPanel = new PanelBuilder(
            new FormLayout("fill:10dlu:grow", "pref, 5dlu, fill:pref:grow"));
    bottomPanel.setBorder(Borders.DLU4_BORDER);
    bottomPanel.addSeparator(mLocalizer.msg("translation", "Translation"), cc.xy(1, 1));
    mTranslation = new JTextArea();
    mTranslation.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            updateState();
        }

        public void insertUpdate(DocumentEvent e) {
            updateState();
        }

        public void removeUpdate(DocumentEvent e) {
            updateState();
        }
    });
    mOriginal.setBackground(mTranslation.getBackground());
    mOriginal.setForeground(mTranslation.getForeground());

    bottomPanel.add(new JScrollPane(mTranslation), cc.xy(1, 3));

    // Splitpane

    final JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split.setBorder(null);

    split.setTopComponent(topPanel.getPanel());
    split.setBottomComponent(bottomPanel.getPanel());

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            split.setDividerLocation(0.5);
        }
    });

    add(split, cc.xy(1, 1));

    // translation state
    PanelBuilder panel = new PanelBuilder(new FormLayout("pref, 2dlu, fill:10dlu:grow", "pref, 3dlu, pref"));
    panel.setBorder(Borders.DLU4_BORDER);
    panel.addSeparator(mLocalizer.msg("state", "State"), cc.xyw(1, 1, 3));
    mIcon = new JLabel();
    panel.add(mIcon, cc.xy(1, 3));
    mState = new JLabel("-");
    panel.add(mState, cc.xy(3, 3));

    add(panel.getPanel(), cc.xy(1, 2));
}

From source file:ibm.StateExtractTab.java

JComponent build() {
    FormLayout layout = new FormLayout("right:max(50dlu;pref), 3dlu, pref, 7dlu, pref",
            "p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu,p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 2dlu, p, 5dlu, p, 2dlu, p");

    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();//from www.ja va  2s .  c  om
    builder.setOpaque(false);

    String[] srcChoices = { "oracle", "mssql", "sybase", "access", "mysql", "postgres", "zdb2", "idb2", "db2" };

    String[] dstChoices = { "DB2 With Compatibility Mode", "DB2" };

    this.scrollpane.setVerticalScrollBarPolicy(22);
    this.scrollpane.setPreferredSize(new Dimension(300, 100));

    this.comboSrcVendor = new JComboBox(srcChoices);
    this.comboDstVendor = new JComboBox(dstChoices);

    Box jdbcSrcBox = Box.createHorizontalBox();
    jdbcSrcBox.add(this.textfieldSrcJDBC);
    jdbcSrcBox.add(this.btnSrcJDBC);

    Box jdbcDstBox = Box.createHorizontalBox();
    jdbcDstBox.add(this.textfieldDstJDBC);
    jdbcDstBox.add(this.btnDstJDBC);

    Box dstBox = Box.createVerticalBox();
    dstBox.setPreferredSize(new Dimension(300, 100));
    dstBox.add(Box.createVerticalGlue());
    dstBox.add(this.lblDB2Instance);
    dstBox.add(Box.createVerticalGlue());
    dstBox.add(this.lblDB2DateCompat);
    dstBox.add(Box.createVerticalGlue());
    dstBox.add(this.lblDB2NumberCompat);
    dstBox.add(Box.createVerticalGlue());
    dstBox.add(this.lblDB2VarcharCompat);
    dstBox.add(Box.createVerticalGlue());
    dstBox.add(this.lblDB2Decflt_rounding);
    dstBox.add(Box.createVerticalGlue());
    dstBox.setBorder(new LineBorder(Color.BLUE));

    Box browseBox = Box.createHorizontalBox();
    browseBox.add(this.textfieldOutputDir);
    browseBox.add(this.btnOutputDir);

    Box migrationBox = Box.createHorizontalBox();
    migrationBox.add(this.checkboxDDL);
    migrationBox.add(this.checkboxData);
    migrationBox.add(new JLabel("| Num Threads: "));
    migrationBox.add(this.textfieldNumTreads);
    migrationBox.add(new JLabel("# Extract Rows: "));
    migrationBox.add(this.textLimitExtractRows);
    migrationBox.add(new JLabel("# Load Rows: "));
    migrationBox.add(this.textLimitLoadRows);

    Box meetBox = Box.createHorizontalBox();
    meetBox.add(this.btnCreateScript);
    meetBox.add(Box.createHorizontalGlue());
    meetBox.add(this.btnMeetScript);

    Box scriptBox = Box.createHorizontalBox();
    scriptBox.add(this.btnView);
    scriptBox.add(Box.createHorizontalGlue());
    scriptBox.add(this.btnDB2Script);

    Box deployBox = Box.createHorizontalBox();
    deployBox.add(this.btnDeploy);
    deployBox.add(Box.createHorizontalGlue());
    deployBox.add(this.btnDropObjs);

    CellConstraints cc = new CellConstraints();

    builder.addLabel("Source Database", cc.xy(3, 1));
    builder.addLabel("DB2 Database", cc.xy(5, 1));
    builder.addSeparator("", cc.xyw(1, 3, 5));
    builder.addLabel("Vendor", cc.xy(1, 5));
    builder.add(this.comboSrcVendor, cc.xy(3, 5));
    builder.add(this.comboDstVendor, cc.xy(5, 5));
    builder.addLabel("Server Name:", cc.xy(1, 7));
    builder.add(this.textfieldSrcServer, cc.xy(3, 7));
    builder.add(this.textfieldDstServer, cc.xy(5, 7));
    builder.addLabel("Port Number:", cc.xy(1, 9));
    builder.add(this.textfieldSrcPortNum, cc.xy(3, 9));
    builder.add(this.textfieldDstPortNum, cc.xy(5, 9));

    builder.add(this.lblDatabaseName, cc.xy(1, 11));
    builder.add(this.textfieldSrcDatabase, cc.xy(3, 11));
    builder.add(this.textfieldDstDatabase, cc.xy(5, 11));
    builder.addLabel("User ID:", cc.xy(1, 13));
    builder.add(this.textfieldSrcUserID, cc.xy(3, 13));
    builder.add(this.textfieldDstUserID, cc.xy(5, 13));
    builder.addLabel("Password:", cc.xy(1, 15));
    builder.add(this.textfieldSrcPassword, cc.xy(3, 15));
    builder.add(this.textfieldDstPassword, cc.xy(5, 15));
    builder.addLabel("JDBC Drivers:", cc.xy(1, 17));
    builder.add(jdbcSrcBox, cc.xy(3, 17));
    builder.add(jdbcDstBox, cc.xy(5, 17));
    builder.addLabel("Test Connections:", cc.xy(1, 19));
    builder.add(this.btnSrcTestConn, cc.xy(3, 19));
    builder.add(this.btnDstTestConn, cc.xy(5, 19));
    builder.addSeparator("", cc.xyw(1, 21, 5));
    builder.addLabel("Source Schema:", cc.xy(1, 23));
    builder.add(this.scrollpane, cc.xy(3, 23));
    builder.add(dstBox, cc.xy(5, 23));
    builder.addLabel("Output Directory:", cc.xy(1, 25));
    builder.add(browseBox, cc.xyw(3, 25, 3));
    builder.addLabel("Migration:", cc.xy(1, 27));
    builder.add(migrationBox, cc.xyw(3, 27, 3));
    builder.addSeparator("", cc.xyw(1, 29, 5));
    builder.addLabel("Extract/Deploy:", cc.xy(1, 31));
    builder.add(this.btnExtract, cc.xy(3, 31));
    builder.add(deployBox, cc.xy(5, 31));
    builder.addLabel("Create/Execute Scripts:", cc.xy(1, 33));
    builder.add(meetBox, cc.xy(3, 33));
    builder.add(scriptBox, cc.xy(5, 33));
    builder.addSeparator("", cc.xyw(1, 35, 5));
    builder.add(this.lblMessage, cc.xyw(1, 37, 5));

    addActionListeners();

    this.cfg = new IBMExtractConfig();
    this.cfg.loadConfigFile();
    this.cfg.getParamValues();

    boolean isRemote = Boolean.valueOf(this.cfg.getRemoteLoad()).booleanValue();
    if (IBMExtractUtilities.isDB2Installed(isRemote)) {
        if (!isRemote)
            SetLabelMessage(this.lblMessage, "DB2 was detected.", false);
        this.cfg.setJavaHome(IBMExtractUtilities.db2JavaPath());
        this.cfg.setDstJDBCHome(IBMExtractUtilities.db2JDBCHome());
    } else {
        SetLabelMessage(this.lblMessage, IBMExtractUtilities.Message, true);
    }
    SetTimer();
    getValues();
    return builder.getPanel();
}

From source file:idontwant2see.ExclusionTablePanel.java

License:Open Source License

protected ExclusionTablePanel(final IDontWant2SeeSettings settings) {
    Localizer mLocalizer = IDontWant2See.mLocalizer;
    mTableModel = new IDontWant2SeeSettingsTableModel(settings.getSearchList(),
            settings.getLastEnteredExclusionString());

    final IDontWant2SeeSettingsTableRenderer renderer = new IDontWant2SeeSettingsTableRenderer(
            settings.getLastUsedDate());
    mTable = new JTable(mTableModel);
    mTableModel.setTable(mTable);/*from ww  w  .jav  a2 s  . co  m*/
    mTable.setRowHeight(25);
    mTable.setPreferredScrollableViewportSize(new Dimension(200, 150));
    mTable.getColumnModel().getColumn(0).setCellRenderer(renderer);
    mTable.getColumnModel().getColumn(1).setCellRenderer(renderer);
    mTable.getColumnModel().getColumn(1)
            .setMaxWidth(Locale.getDefault().getLanguage().equals("de") ? Sizes.dialogUnitXAsPixel(80, mTable)
                    : Sizes.dialogUnitXAsPixel(55, mTable));
    mTable.getColumnModel().getColumn(1).setMinWidth(mTable.getColumnModel().getColumn(1).getMaxWidth());
    mTable.getTableHeader().setReorderingAllowed(false);
    mTable.getTableHeader().setResizingAllowed(false);

    final JScrollPane scrollPane = new JScrollPane(mTable);

    mTable.addMouseListener(new MouseAdapter() {
        public void mouseClicked(final MouseEvent e) {
            final int column = mTable.columnAtPoint(e.getPoint());

            if (column == 1) {
                final int row = mTable.rowAtPoint(e.getPoint());

                mTable.getModel().setValueAt(!((Boolean) mTable.getValueAt(row, column)), row, 1);
                mTable.repaint();
            }
        }
    });

    mTable.addKeyListener(new KeyAdapter() {
        public void keyPressed(final KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE) {
                deleteSelectedRows();
                e.consume();
            } else if (mTable.getSelectedColumn() == 1
                    && (e.getKeyCode() == KeyEvent.VK_F2 || e.getKeyCode() == KeyEvent.VK_SPACE)) {
                mTable.getModel().setValueAt(!((Boolean) mTable.getValueAt(mTable.getSelectedRow(), 1)),
                        mTable.getSelectedRow(), 1);
                mTable.repaint();
            }
        }
    });

    addAncestorListener(new AncestorListener() {
        public void ancestorAdded(final AncestorEvent event) {
            for (int row = 0; row < mTableModel.getRowCount(); row++) {
                if (mTableModel.isLastChangedRow(row)) {
                    final Rectangle rect = mTable.getCellRect(row, 0, true);
                    rect.setBounds(0, scrollPane.getVisibleRect().height + rect.y - rect.height, 0, 0);

                    mTable.scrollRectToVisible(rect);
                    break;
                }
            }
        }

        public void ancestorMoved(final AncestorEvent event) {
        }

        public void ancestorRemoved(final AncestorEvent event) {
        }
    });

    final JButton add = new JButton(mLocalizer.msg("settings.add", "Add entry"),
            IDontWant2See.getInstance().createImageIcon("actions", "document-new", 16));
    add.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            mTableModel.addRow();
            mTable.scrollRectToVisible(mTable.getCellRect(mTableModel.getRowCount() - 1, 0, true));
        }
    });

    final JButton delete = new JButton(mLocalizer.msg("settings.delete", "Delete selected entries"),
            IDontWant2See.getInstance().createImageIcon("actions", "edit-delete", 16));
    delete.setEnabled(false);
    delete.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            deleteSelectedRows();
        }
    });

    mTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                delete.setEnabled(e.getFirstIndex() >= 0);
            }
        }
    });

    final FormLayout layout = new FormLayout("default,0dlu:grow,default",
            "fill:default:grow,1dlu,default,4dlu,default,5dlu,pref");
    final PanelBuilder pb = new PanelBuilder(layout, this);
    final CellConstraints cc = new CellConstraints();

    int y = 1;

    pb.add(scrollPane, cc.xyw(1, y++, 3));

    final PanelBuilder pb2 = new PanelBuilder(
            new FormLayout("default,3dlu:grow,default,3dlu:grow,default,3dlu:grow,default", "default"));

    final ColorLabel blueLabel = new ColorLabel(IDontWant2SeeSettingsTableRenderer.LAST_CHANGED_COLOR);
    blueLabel.setText(mLocalizer.msg("changed", "Last change"));
    pb2.add(blueLabel, cc.xy(1, 1));

    final ColorLabel yellowLabel = new ColorLabel(IDontWant2SeeSettingsTableRenderer.LAST_USAGE_7_COLOR);
    yellowLabel.setText(mLocalizer.msg("unusedSince", "Not used for {0} days",
            IDontWant2SeeSettingsTableRenderer.OUTDATED_7_DAY_COUNT));
    pb2.add(yellowLabel, cc.xy(3, 1));

    final ColorLabel orangeLabel = new ColorLabel(IDontWant2SeeSettingsTableRenderer.LAST_USAGE_30_COLOR);
    orangeLabel.setText(mLocalizer.msg("unusedSince", "Not used for {0} days",
            IDontWant2SeeSettingsTableRenderer.OUTDATED_30_DAY_COUNT));
    pb2.add(orangeLabel, cc.xy(5, 1));

    final ColorLabel redLabel = new ColorLabel(IDontWant2SeeSettingsTableRenderer.NOT_VALID_COLOR);
    redLabel.setText(mLocalizer.msg("invalid", "Invalid"));
    pb2.add(redLabel, cc.xy(7, 1));

    pb.add(pb2.getPanel(), cc.xyw(1, ++y, 3));

    y++;
    pb.add(add, cc.xy(1, ++y));
    pb.add(delete, cc.xy(3, y++));
    pb.add(UiUtilities.createHelpTextArea(mLocalizer.msg("settings.help",
            "To edit a value double click a cell. You can use wildcard * to search for any text.")),
            cc.xyw(1, ++y, 3));
}

From source file:idontwant2see.IDontWant2See.java

License:Open Source License

public ActionMenu getButtonAction() {
    final ContextMenuAction baseAction = new ContextMenuAction(mLocalizer.msg("name", "I don't want to see!"),
            createImageIcon("apps", "idontwant2see", 16));

    final ContextMenuAction openExclusionList = new ContextMenuAction(
            mLocalizer.msg("editExclusionList", "Edit exclusion list"),
            createImageIcon("apps", "idontwant2see", 16));
    openExclusionList.putValue(Plugin.BIG_ICON, createImageIcon("apps", "idontwant2see", 22));
    openExclusionList.setActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            final Window w = UiUtilities.getLastModalChildOf(getParentFrame());

            JDialog temDlg = null;

            if (w instanceof JDialog) {
                temDlg = new JDialog((JDialog) w, true);
            } else {
                temDlg = new JDialog((JFrame) w, true);
            }//from  ww  w .  j a  v  a2  s .c o  m

            final JDialog exclusionListDlg = temDlg;
            exclusionListDlg.setTitle(mLocalizer.msg("name", "I don't want to see!") + " - "
                    + mLocalizer.msg("editExclusionList", "Edit exclusion list"));

            UiUtilities.registerForClosing(new WindowClosingIf() {
                public void close() {
                    exclusionListDlg.dispose();
                }

                public JRootPane getRootPane() {
                    return exclusionListDlg.getRootPane();
                }
            });

            final ExclusionTablePanel exclusionPanel = new ExclusionTablePanel(mSettings);

            final JButton ok = new JButton(Localizer.getLocalization(Localizer.I18N_OK));
            ok.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent e) {
                    exclusionPanel.saveSettings(mSettings);
                    exclusionListDlg.dispose();
                }
            });

            final JButton cancel = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL));
            cancel.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent e) {
                    exclusionListDlg.dispose();
                }
            });

            final FormLayout layout = new FormLayout("0dlu:grow,default,3dlu,default",
                    "fill:500px:grow,2dlu,default,5dlu,default");
            layout.setColumnGroups(new int[][] { { 2, 4 } });

            final CellConstraints cc = new CellConstraints();
            final PanelBuilder pb = new PanelBuilder(layout, (JPanel) exclusionListDlg.getContentPane());
            pb.setDefaultDialogBorder();

            pb.add(exclusionPanel, cc.xyw(1, 1, 4));
            pb.addSeparator("", cc.xyw(1, 3, 4));
            pb.add(ok, cc.xy(2, 5));
            pb.add(cancel, cc.xy(4, 5));

            layoutWindow("exclusionListDlg", exclusionListDlg, new Dimension(600, 450));
            exclusionListDlg.setVisible(true);
        }
    });

    final ContextMenuAction undo = new ContextMenuAction(
            mLocalizer.msg("undoLastExclusion", "Undo last exclusion"),
            createImageIcon("actions", "edit-undo", 16));
    undo.putValue(Plugin.BIG_ICON, createImageIcon("actions", "edit-undo", 22));
    undo.setActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            String lastEnteredExclusionString = mSettings.getLastEnteredExclusionString();
            if (lastEnteredExclusionString.length() > 0) {
                for (int i = mSettings.getSearchList().size() - 1; i >= 0; i--) {
                    if (mSettings.getSearchList().get(i).getSearchText().equals(lastEnteredExclusionString)) {
                        mSettings.getSearchList().remove(i);
                    }
                }

                mSettings.setLastEnteredExclusionString("");

                updateFilter(true);
            }
        }
    });

    return new ActionMenu(baseAction, new Action[] { openExclusionList, undo });
}