/** Method for creating Stream Direction Group */ protected void createStreamDirectionGroup( int horizontalSpan, int verticalSpan, boolean isBothButton) { streamDirectionGroup = new Group(shell, SWT.NONE); streamDirectionGroup.setText("Stream direction"); GridData gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false); gridData.horizontalSpan = horizontalSpan; gridData.verticalSpan = verticalSpan; streamDirectionGroup.setLayoutData(gridData); streamDirectionGroup.setLayout(new GridLayout()); // Downstream Radio Button downstreamButton = new Button(streamDirectionGroup, SWT.RADIO); downstreamButton.setText("Downstream"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); downstreamButton.setLayoutData(gridData); // Upstream Radio Button upstreamButton = new Button(streamDirectionGroup, SWT.RADIO); upstreamButton.setText("Upstream"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); upstreamButton.setLayoutData(gridData); // Downstream & Upstream Radio Button if (isBothButton) { bothButton = new Button(streamDirectionGroup, SWT.RADIO); bothButton.setText("Both"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); bothButton.setLayoutData(gridData); } }
private void updateSIFTypeButtonText() { if (selectedTypes.isEmpty()) { sifTypeButton.setText("Select interaction type"); } else { sifTypeButton.setText( selectedTypes.size() + " type" + (selectedTypes.size() > 1 ? "s" : "") + " selected"); } }
private void UpdateStartDateTimeView() { btnStartDate.setText(AnCalDateUtils.formatMediumDate(this, dateStart)); if (chkAllDay.isChecked()) { btnStartTime.setText(utils.GetResStr(R.string.labNoTime)); } else { btnStartTime.setText(AnCalDateUtils.formatTime(this, dateStart)); } }
protected void createLimitTypesGroup() { GridData gridData; // Group for lengthLimitButton and shortestPlusKButton Group limitTypeGroup = new Group(shell, SWT.NONE); limitTypeGroup.setText("Stop distance"); gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false); gridData.horizontalSpan = 2; gridData.verticalSpan = 2; limitTypeGroup.setLayoutData(gridData); limitTypeGroup.setLayout(new GridLayout(2, true)); // Length limit radio button lengthLimitLabel = new Label(limitTypeGroup, SWT.NONE); lengthLimitLabel.setText("Length limit"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); lengthLimitLabel.setLayoutData(gridData); // Length limit text lengthLimit = new Text(limitTypeGroup, SWT.BORDER); lengthLimit.addKeyListener(keyAdapter); gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); lengthLimit.setLayoutData(gridData); // Shortest+k radio button shortestPlusKButton = new Button(limitTypeGroup, SWT.CHECK); shortestPlusKButton.setText("Shortest+k"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); shortestPlusKButton.setLayoutData(gridData); shortestPlusKButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { shortestPlusK.setEnabled(shortestPlusKButton.getSelection()); } }); // Shortest+k text shortestPlusK = new Text(limitTypeGroup, SWT.BORDER); shortestPlusK.addKeyListener(keyAdapter); gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); shortestPlusK.setLayoutData(gridData); // Strict check box strictButton = new Button(shell, SWT.CHECK | SWT.WRAP); strictButton.setText("Ignore source-source/target-target paths"); gridData = new GridData(GridData.CENTER, GridData.CENTER, false, false); gridData.verticalSpan = 2; gridData.horizontalSpan = 4; strictButton.setLayoutData(gridData); }
private void createOptionalDependenciesButton(Composite container) { if (isEditable()) { fIncludeOptionalButton = new Button(container, SWT.CHECK); fIncludeOptionalButton.setText(PDEUIMessages.PluginSection_includeOptional); // initialize value IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { fIncludeOptionalButton.setSelection( "true".equals(file.getPersistentProperty(OPTIONAL_PROPERTY))); // $NON-NLS-1$ } catch (CoreException e) { } } // create listener to save value when the checkbox is changed fIncludeOptionalButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { file.setPersistentProperty( OPTIONAL_PROPERTY, fIncludeOptionalButton.getSelection() ? "true" : null); // $NON-NLS-1$ } catch (CoreException e1) { } } } }); } }
/** Experimental. Switching themes at runtime does not yet work properly. */ protected void createThemeSwitcher(final Composite parent) { final Button button = new Button(parent, SWT.PUSH); button.setText("Theme Switcher"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { Shell shell = new Shell(parent.getShell(), SWT.DIALOG_TRIM); shell.setText("Theme Switcher"); shell.setLayout(new GridLayout()); Button themeButton = new Button(shell, SWT.PUSH); themeButton.setText("Switch Theme"); themeButton.addSelectionListener( new SelectionAdapter() { String[] availableThemeIds = ThemeUtil.getAvailableThemeIds(); public void widgetSelected(final SelectionEvent e) { int index = 0; String currThemeId = ThemeUtil.getCurrentThemeId(); for (int i = 0; i < availableThemeIds.length; i++) { if (currThemeId.equals(availableThemeIds[i])) { index = (i + 1) % availableThemeIds.length; } } String newThemeId = availableThemeIds[index]; ThemeUtil.setCurrentThemeId(newThemeId); } }); shell.pack(); shell.open(); } }); }
private void setPickerFragmentSettingsFromBundle(Bundle inState) { // We do this in a separate non-overridable method so it is safe to call from the constructor. if (inState != null) { showPictures = inState.getBoolean(SHOW_PICTURES_BUNDLE_KEY, showPictures); String extraFieldsString = inState.getString(EXTRA_FIELDS_BUNDLE_KEY); if (extraFieldsString != null) { String[] strings = extraFieldsString.split(","); setExtraFields(Arrays.asList(strings)); } showTitleBar = inState.getBoolean(SHOW_TITLE_BAR_BUNDLE_KEY, showTitleBar); String titleTextString = inState.getString(TITLE_TEXT_BUNDLE_KEY); if (titleTextString != null) { titleText = titleTextString; if (titleTextView != null) { titleTextView.setText(titleText); } } String doneButtonTextString = inState.getString(DONE_BUTTON_TEXT_BUNDLE_KEY); if (doneButtonTextString != null) { doneButtonText = doneButtonTextString; if (doneButton != null) { doneButton.setText(doneButtonText); } } } }
private void createButtonPanel(Composite pageContent) { Composite buttonPanel = new Composite(pageContent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; buttonPanel.setLayout(layout); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = false; gridData.grabExcessVerticalSpace = true; gridData.verticalAlignment = GridData.CENTER; gridData.horizontalAlignment = GridData.CENTER; buttonPanel.setLayoutData(gridData); addButton = new Button(buttonPanel, SWT.PUSH); addButton.setText(Messages._UI_ADD_BUTTON); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; addButton.setLayoutData(gridData); addButton.addSelectionListener(new ButtonSelectListener()); addButton.setToolTipText(Messages._UI_ADD_BUTTON_TOOL_TIP); addButton.setEnabled(false); removeButton = new Button(buttonPanel, SWT.PUSH); removeButton.setText(Messages._UI_REMOVE_BUTTON); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; removeButton.setLayoutData(gridData); removeButton.addSelectionListener(new ButtonSelectListener()); removeButton.setToolTipText(Messages._UI_REMOVE_BUTTON_TOOL_TIP); removeButton.setEnabled(false); removeAllButton = new Button(buttonPanel, SWT.PUSH); removeAllButton.setText(Messages._UI_REMOVE_ALL_BUTTON); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; removeAllButton.setLayoutData(gridData); removeAllButton.addSelectionListener(new ButtonSelectListener()); removeAllButton.setToolTipText(Messages._UI_REMOVE_ALL_BUTTON_TOOL_TIP); removeAllButton.setEnabled(false); }
/** Method to create cancel button */ protected void createCancelButton(GridData gridData) { cancelButton.setText("Cancel"); cancelButton.setLayoutData(gridData); cancelButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { shell.close(); } }); }
/** Creates a text that controls whether a border radius is set on the registered controls. */ protected void cteateRoundedBorderGroup() { Group group = new Group(styleComp, SWT.NONE); group.setText("Rounded Border"); group.setLayout(new GridLayout(2, false)); new Label(group, SWT.NONE).setText("Width"); final Text textWidth = new Text(group, SWT.SINGLE | SWT.BORDER); textWidth.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(group, SWT.NONE).setText("Color"); final Button buttonColor = new Button(group, SWT.PUSH); buttonColor.setLayoutData(new GridData(20, 20)); buttonColor.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { rbIndex = (rbIndex + 1) % bgColors.length; if (bgColors[rbIndex] == null) { buttonColor.setText(""); } else { buttonColor.setText("\u2588"); } buttonColor.setForeground(bgColors[rbIndex]); } }); new Label(group, SWT.NONE).setText("Radius "); Composite radiusGroup = new Composite(group, SWT.NONE); radiusGroup.setLayout(new GridLayout(4, false)); new Label(radiusGroup, SWT.NONE).setText("T-L"); final Text textTopLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textTopLeft.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("T-R"); final Text textTopRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textTopRight.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("B-L"); final Text textBottomLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textBottomLeft.setLayoutData(new GridData(20, SWT.DEFAULT)); new Label(radiusGroup, SWT.NONE).setText("B-R"); final Text textBottomRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER); textBottomRight.setLayoutData(new GridData(20, SWT.DEFAULT)); Button button = new Button(group, SWT.PUSH); button.setText("Set"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { int width = parseInt(textWidth.getText()); Color color = buttonColor.getBackground(); int topLeft = parseInt(textTopLeft.getText()); int topRight = parseInt(textTopRight.getText()); int bottomRight = parseInt(textBottomRight.getText()); int bottomLeft = parseInt(textBottomLeft.getText()); updateRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft); } }); }
/** * Creates a checkbox that controls whether a background image is set on the registered controls. * * @return the created checkbox */ protected Button createBgImageButton() { final Button button = new Button(styleComp, SWT.CHECK); button.setText("Background Image"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showBgImage = button.getSelection(); updateBgImage(); } }); return button; }
/** * Creates a button to change the background color of all registered controls. * * @return the created button */ protected Button createBgColorButton() { bgColorChooser = new ColorChooser(); final Button button = new Button(styleComp, SWT.PUSH); button.setText("Background"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { bgIndex = (bgIndex + 1) % fgColors.length; updateBgColor(); } }); return button; }
/** * Creates a checkbutton to enable / disabled the registered controls. * * @return the created checkbutton. */ protected Button createEnablementButton() { final Button button = new Button(styleComp, SWT.CHECK); button.setText("Enabled"); button.setSelection(enabled); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { enabled = button.getSelection(); updateEnabled(); } }); return button; }
/** * Creates a checkbutton to show / hide the registered controls. * * @return the created checkbutton */ protected Button createVisibilityButton() { final Button button = new Button(styleComp, SWT.CHECK); button.setText("Visible"); button.setSelection(visible); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { visible = button.getSelection(); updateVisible(); } }); return button; }
protected Button createStyleButton(final String name, final int style, final boolean checked) { Button button = new Button(styleComp, SWT.CHECK); button.setText(name); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { createNew(); } }); button.setData("style", new Integer(style)); button.setSelection(checked); return button; }
/** Method for creating Result View Group */ protected void createResultViewGroup(int horizontalSpan, int verticalSpan) { resultViewGroup = new Group(shell, SWT.NONE); resultViewGroup.setText("Show result in"); GridData gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false); gridData.horizontalSpan = horizontalSpan; gridData.verticalSpan = verticalSpan; resultViewGroup.setLayoutData(gridData); resultViewGroup.setLayout(new GridLayout()); // Current View Radio Button currentViewButton = new Button(resultViewGroup, SWT.RADIO); currentViewButton.setText("Current view"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); currentViewButton.setLayoutData(gridData); // New View Radio Button newViewButton = new Button(resultViewGroup, SWT.RADIO); newViewButton.setText("New view"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false); newViewButton.setLayoutData(gridData); }
@SuppressWarnings("deprecation") private void inflateTitleBar(ViewGroup view) { ViewStub stub = (ViewStub) view.findViewById(R.id.com_facebook_picker_title_bar_stub); if (stub != null) { View titleBar = stub.inflate(); final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.BELOW, R.id.com_facebook_picker_title_bar); listView.setLayoutParams(layoutParams); if (titleBarBackground != null) { titleBar.setBackgroundDrawable(titleBarBackground); } doneButton = (Button) view.findViewById(R.id.com_facebook_picker_done_button); if (doneButton != null) { doneButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { logAppEvents(true); appEventsLogged = true; if (onDoneButtonClickedListener != null) { onDoneButtonClickedListener.onDoneButtonClicked(PickerFragment.this); } } }); if (getDoneButtonText() != null) { doneButton.setText(getDoneButtonText()); } if (doneButtonBackground != null) { doneButton.setBackgroundDrawable(doneButtonBackground); } } titleTextView = (TextView) view.findViewById(R.id.com_facebook_picker_title); if (titleTextView != null) { if (getTitleText() != null) { titleTextView.setText(getTitleText()); } } } }
protected Button createPropertyCheckbox( final String text, final String prop, final boolean checked) { final Button button = new Button(styleComp, SWT.CHECK); button.setText(text); button.setSelection(checked); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { if (button.getSelection()) { properties.add(prop); } else { properties.remove(prop); } createNew(); } }); return button; }
protected Button createFontChooser() { final Button button = new Button(styleComp, SWT.PUSH); button.setText("Font"); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { fontChooser = new SimpleFontDialog(getShell()); Control control = (Control) controls.get(0); fontChooser.setFont(control.getFont()); fontChooser.open( new Runnable() { public void run() { font = fontChooser.getFont(); updateFont(); } }); } }); return button; }
void createImportButton(Composite parent) { importButton = new Button(parent, SWT.PUSH); importButton.setText(Messages._UI_IMPORT_BUTTON); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.CENTER; importButton.setLayoutData(gridData); importButton.addSelectionListener( new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) {} public void widgetSelected(SelectionEvent e) { FileSystemImportWizard importWizard = new FileSystemImportWizard(); importWizard.init(workbench, selection); Shell shell = Display.getCurrent().getActiveShell(); WizardDialog wizardDialog = new WizardDialog(shell, importWizard); wizardDialog.create(); wizardDialog.open(); sourceFileViewer.refresh(); } }); importButton.setToolTipText(Messages._UI_IMPORT_BUTTON_TOOL_TIP); }
private Composite createButtonArea(Composite parent) { ScrolledComposite comp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); GridLayout layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; comp.setLayoutData(new GridData(GridData.FILL_VERTICAL)); Composite container = new Composite(comp, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_VERTICAL); gd.verticalIndent = 15; container.setLayoutData(gd); Button button = new Button(container, SWT.PUSH); button.setText(PDEUIMessages.ImportWizard_DetailedPage_existing); button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleExistingProjects(); } }); SWTUtil.setButtonDimensionHint(button); button = new Button(container, SWT.PUSH); button.setText(PDEUIMessages.ImportWizard_DetailedPage_existingUnshared); button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleExistingUnshared(); } }); SWTUtil.setButtonDimensionHint(button); fAddButton = new Button(container, SWT.PUSH); fAddButton.setText(PDEUIMessages.ImportWizard_DetailedPage_add); fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAdd(); } }); SWTUtil.setButtonDimensionHint(fAddButton); fAddAllButton = new Button(container, SWT.PUSH); fAddAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addAll); fAddAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddAllButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAddAll(); } }); SWTUtil.setButtonDimensionHint(fAddAllButton); fRemoveButton = new Button(container, SWT.PUSH); fRemoveButton.setText(PDEUIMessages.ImportWizard_DetailedPage_remove); fRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fRemoveButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleRemove(); } }); SWTUtil.setButtonDimensionHint(fRemoveButton); fRemoveAllButton = new Button(container, SWT.PUSH); fRemoveAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_removeAll); fRemoveAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fRemoveAllButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleRemoveAll(); } }); SWTUtil.setButtonDimensionHint(fRemoveAllButton); button = new Button(container, SWT.PUSH); button.setText(PDEUIMessages.ImportWizard_DetailedPage_swap); button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleSwap(); } }); SWTUtil.setButtonDimensionHint(button); fAddRequiredButton = new Button(container, SWT.PUSH); fAddRequiredButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addRequired); fAddRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddRequiredButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAddRequiredPlugins(); } }); SWTUtil.setButtonDimensionHint(fAddRequiredButton); fCountLabel = new Label(container, SWT.NONE); fCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); comp.setContent(container); comp.setMinHeight(250); comp.setExpandHorizontal(true); comp.setExpandVertical(true); return container; }
public static void setJar(final Tile node) { node.data.put("type", "Jar"); List<Node> toRemove = new ArrayList<>(); for (Node n : node.node.getChildren()) { if (!n.getId().equals("delete")) { if (n.getId().equals("typeLabel")) { Label l = (Label) n; l.setText("jar"); l.setTranslateY(l.getTranslateY() - 1); } else { toRemove.add(n); } } } VBox leftPadding = new VBox(); leftPadding.setPrefWidth(14); VBox buttons = new VBox(); VBox textBoxes = new VBox(); VBox extra = new VBox(); buttons.setSpacing(5); textBoxes.setSpacing(5); extra.setSpacing(5); buttons.setPadding(new Insets(7, 0, 0, 0)); textBoxes.setPadding(new Insets(7, 0, 0, 0)); extra.setPadding(new Insets(7, 0, 0, 0)); textBoxes.setTranslateX(17); extra.setTranslateX(32); node.node.getChildren().removeAll(toRemove); final String name = "Package Name"; final String name2 = "Jar Name"; Button findPkg = new Button(); final TextField pkgText = new TextField(); final TextField jarName = new TextField(); findPkg.getStyleClass().add("defaultButton"); findPkg.setText("Find Package Name"); findPkg.setPrefHeight(25); findPkg.setTranslateX(12); findPkg.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { String mainClassName = Util.packageNameFromTile(); if (mainClassName != null) { pkgText.setText(mainClassName); } } }); pkgText.setText(name); pkgText.setPrefSize(150, 27); pkgText.setFont(Font.font("Segoe UI")); pkgText.setId("textBox"); pkgText .textProperty() .addListener( new ChangeListener<String>() { @Override public void changed( ObservableValue<? extends String> observable, String oldValue, String newValue) { node.data.put("package", pkgText.getText().trim()); } }); pkgText .focusedProperty() .addListener( new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue == true && pkgText.getText().equals(name)) { pkgText.setText(""); } else if (newValue == false && pkgText.getText().trim().equals("")) { pkgText.setText(name); } } }); jarName.setText(name2); jarName.setPrefSize(150, 27); jarName.setFont(Font.font("Segoe UI")); jarName.setId("textBox"); jarName .textProperty() .addListener( new ChangeListener<String>() { @Override public void changed( ObservableValue<? extends String> observable, String oldValue, String newValue) { node.data.put("jarname", jarName.getText().trim()); } }); jarName .focusedProperty() .addListener( new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue == true && jarName.getText().equals(name2)) { jarName.setText(""); } else if (newValue == false && jarName.getText().trim().equals("")) { jarName.setText(name2); } } }); final String defTxt = "Additional Flags"; final TextField flags = new TextField(); flags.setText(defTxt); flags.setPrefSize(150, 27); flags.setFont(Font.font("Segoe UI")); flags.setId("textBox"); flags .focusedProperty() .addListener( new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue == true && flags.getText().equals(defTxt)) { flags.setText(""); } else if (newValue == false && flags.getText().trim().equals("")) { flags.setText(defTxt); } } }); flags .textProperty() .addListener( new ChangeListener<String>() { @Override public void changed( ObservableValue<? extends String> observable, String oldValue, String newValue) { node.data.put("flags", flags.getText().trim()); } }); final String defTxt2 = "Output Directory"; final TextField outputDir = new TextField(); outputDir.setText(defTxt2); outputDir.setPrefSize(150, 27); outputDir.setFont(Font.font("Segoe UI")); outputDir.setId("textBox"); outputDir .focusedProperty() .addListener( new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue == true && outputDir.getText().equals(defTxt2)) { outputDir.setText(""); } else if (newValue == false && outputDir.getText().trim().equals("")) { outputDir.setText(defTxt2); } } }); outputDir .textProperty() .addListener( new ChangeListener<String>() { @Override public void changed( ObservableValue<? extends String> observable, String oldValue, String newValue) { node.data.put("output", outputDir.getText().trim()); } }); buttons.getChildren().addAll(findPkg); textBoxes.getChildren().addAll(pkgText, jarName); extra.getChildren().addAll(flags, outputDir); node.node.getChildren().addAll(leftPadding, buttons, textBoxes, extra); }
private void UpdateRepeatInfo() { btnRepeatSelect.setText(GetRepeatInfo()); }
private void UpdateStartDateTimeView() { btnStartTime.setText( utils.GetWeekDay(dateStart) + ", " + utils.GetLongTime(dateStart, prefs.b24HourMode)); }
/** * Creates the dialog's contents * * @param shell the dialog window */ private void createContents(final Shell shell) { final Config config = controller.getConfig(); // Create the ScrolledComposite to scroll horizontally and vertically ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL); // Create the parent Composite container for the three child containers Composite container = new Composite(sc, SWT.NONE); GridLayout containerLayout = new GridLayout(1, false); container.setLayout(containerLayout); shell.setLayout(new FillLayout()); GridData data; data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 50; data.widthHint = 400; // START TOP COMPONENT Composite topComp = new Composite(container, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; layout.verticalSpacing = 0; topComp.setLayout(layout); topComp.setLayoutData(data); Label blank = new Label(topComp, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 10; blank.setLayoutData(data); blank.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); // Show the message Label label = new Label(topComp, SWT.NONE); label.setText(message); data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 30; data.widthHint = 370; Font f = label.getFont(); FontData[] farr = f.getFontData(); FontData fd = farr[0]; fd.setStyle(SWT.BOLD); label.setFont(new Font(Display.getCurrent(), fd)); label.setLayoutData(data); label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL); labelSeparator.setLayoutData(data); // END TOP COMPONENT // START MIDDLE COMPONENT Composite restComp = new Composite(container, SWT.NONE); data = new GridData(GridData.FILL_BOTH); restComp.setLayoutData(data); layout = new GridLayout(2, false); layout.verticalSpacing = 10; restComp.setLayout(layout); // Hide welecome screen Label labelHideWelcomeScreen = new Label(restComp, SWT.RIGHT); labelHideWelcomeScreen.setText( Labels.getString("AdvancedSettingsDialog.hideWelcomeScreen")); // $NON-NLS-1$ labelHideWelcomeScreen.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); buttonHideWelcomeScreen = new Button(restComp, SWT.CHECK); buttonHideWelcomeScreen.setSelection(config.getBoolean(Config.HIDE_WELCOME_SCREEN)); // batch size Label labelBatch = new Label(restComp, SWT.RIGHT); labelBatch.setText(Labels.getString("AdvancedSettingsDialog.batchSize")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelBatch.setLayoutData(data); textBatch = new Text(restComp, SWT.BORDER); textBatch.setText(config.getString(Config.LOAD_BATCH_SIZE)); textBatch.setTextLimit(8); textBatch.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 50; textBatch.setLayoutData(data); // insert Nulls Label labelNulls = new Label(restComp, SWT.RIGHT); labelNulls.setText(Labels.getString("AdvancedSettingsDialog.insertNulls")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelNulls.setLayoutData(data); buttonNulls = new Button(restComp, SWT.CHECK); buttonNulls.setSelection(config.getBoolean(Config.INSERT_NULLS)); // assignment rules Label labelRule = new Label(restComp, SWT.RIGHT); labelRule.setText(Labels.getString("AdvancedSettingsDialog.assignmentRule")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelRule.setLayoutData(data); textRule = new Text(restComp, SWT.BORDER); textRule.setTextLimit(18); data = new GridData(); data.widthHint = 115; textRule.setLayoutData(data); textRule.setText(config.getString(Config.ASSIGNMENT_RULE)); // endpoint Label labelEndpoint = new Label(restComp, SWT.RIGHT); labelEndpoint.setText(Labels.getString("AdvancedSettingsDialog.serverURL")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelEndpoint.setLayoutData(data); textEndpoint = new Text(restComp, SWT.BORDER); data = new GridData(); data.widthHint = 250; textEndpoint.setLayoutData(data); String endpoint = config.getString(Config.ENDPOINT); if ("".equals(endpoint)) { // $NON-NLS-1$ endpoint = defaultServer; } textEndpoint.setText(endpoint); // reset url on login Label labelResetUrl = new Label(restComp, SWT.RIGHT); labelResetUrl.setText( Labels.getString("AdvancedSettingsDialog.resetUrlOnLogin")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelResetUrl.setLayoutData(data); buttonResetUrl = new Button(restComp, SWT.CHECK); buttonResetUrl.setSelection(config.getBoolean(Config.RESET_URL_ON_LOGIN)); // insert compression Label labelCompression = new Label(restComp, SWT.RIGHT); labelCompression.setText(Labels.getString("AdvancedSettingsDialog.compression")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelCompression.setLayoutData(data); buttonCompression = new Button(restComp, SWT.CHECK); buttonCompression.setSelection(config.getBoolean(Config.NO_COMPRESSION)); // timeout size Label labelTimeout = new Label(restComp, SWT.RIGHT); labelTimeout.setText(Labels.getString("AdvancedSettingsDialog.timeout")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelTimeout.setLayoutData(data); textTimeout = new Text(restComp, SWT.BORDER); textTimeout.setTextLimit(4); textTimeout.setText(config.getString(Config.TIMEOUT_SECS)); textTimeout.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 30; textTimeout.setLayoutData(data); // extraction batch size Label labelQueryBatch = new Label(restComp, SWT.RIGHT); labelQueryBatch.setText(Labels.getString("ExtractionInputDialog.querySize")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelQueryBatch.setLayoutData(data); textQueryBatch = new Text(restComp, SWT.BORDER); textQueryBatch.setText(config.getString(Config.EXTRACT_REQUEST_SIZE)); textQueryBatch.setTextLimit(4); textQueryBatch.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 30; textQueryBatch.setLayoutData(data); // enable/disable output of success file for extracts Label labelOutputExtractStatus = new Label(restComp, SWT.RIGHT); labelOutputExtractStatus.setText( Labels.getString("AdvancedSettingsDialog.outputExtractStatus")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelOutputExtractStatus.setLayoutData(data); buttonOutputExtractStatus = new Button(restComp, SWT.CHECK); buttonOutputExtractStatus.setSelection(config.getBoolean(Config.ENABLE_EXTRACT_STATUS_OUTPUT)); // utf-8 for loading Label labelReadUTF8 = new Label(restComp, SWT.RIGHT); labelReadUTF8.setText(Labels.getString("AdvancedSettingsDialog.readUTF8")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelReadUTF8.setLayoutData(data); buttonReadUtf8 = new Button(restComp, SWT.CHECK); buttonReadUtf8.setSelection(config.getBoolean(Config.READ_UTF8)); // utf-8 for extraction Label labelWriteUTF8 = new Label(restComp, SWT.RIGHT); labelWriteUTF8.setText(Labels.getString("AdvancedSettingsDialog.writeUTF8")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelWriteUTF8.setLayoutData(data); buttonWriteUtf8 = new Button(restComp, SWT.CHECK); buttonWriteUtf8.setSelection(config.getBoolean(Config.WRITE_UTF8)); // European Dates Label labelEuropeanDates = new Label(restComp, SWT.RIGHT); labelEuropeanDates.setText( Labels.getString("AdvancedSettingsDialog.useEuropeanDateFormat")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelEuropeanDates.setLayoutData(data); buttonEuroDates = new Button(restComp, SWT.CHECK); buttonEuroDates.setSelection(config.getBoolean(Config.EURO_DATES)); // Field truncation Label labelTruncateFields = new Label(restComp, SWT.RIGHT); labelTruncateFields.setText(Labels.getString("AdvancedSettingsDialog.allowFieldTruncation")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelTruncateFields.setLayoutData(data); buttonTruncateFields = new Button(restComp, SWT.CHECK); buttonTruncateFields.setSelection(config.getBoolean(Config.TRUNCATE_FIELDS)); Label labelCsvCommand = new Label(restComp, SWT.RIGHT); labelCsvCommand.setText(Labels.getString("AdvancedSettingsDialog.useCommaAsCsvDelimiter")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelCsvCommand.setLayoutData(data); buttonCsvComma = new Button(restComp, SWT.CHECK); buttonCsvComma.setSelection(config.getBoolean(Config.CSV_DELIMETER_COMMA)); Label labelTabCommand = new Label(restComp, SWT.RIGHT); labelTabCommand.setText(Labels.getString("AdvancedSettingsDialog.useTabAsCsvDelimiter")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelTabCommand.setLayoutData(data); buttonCsvTab = new Button(restComp, SWT.CHECK); buttonCsvTab.setSelection(config.getBoolean(Config.CSV_DELIMETER_TAB)); Label labelOtherCommand = new Label(restComp, SWT.RIGHT); labelOtherCommand.setText(Labels.getString("AdvancedSettingsDialog.useOtherAsCsvDelimiter")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelOtherCommand.setLayoutData(data); buttonCsvOther = new Button(restComp, SWT.CHECK); buttonCsvOther.setSelection(config.getBoolean(Config.CSV_DELIMETER_OTHER)); Label labelOtherDelimiterValue = new Label(restComp, SWT.RIGHT); labelOtherDelimiterValue.setText( Labels.getString("AdvancedSettingsDialog.csvOtherDelimiterValue")); data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelOtherDelimiterValue.setLayoutData(data); textSplitterValue = new Text(restComp, SWT.BORDER); textSplitterValue.setText(config.getString(Config.CSV_DELIMETER_OTHER_VALUE)); data = new GridData(); data.widthHint = 25; textSplitterValue.setLayoutData(data); // Enable Bulk API Setting Label labelUseBulkApi = new Label(restComp, SWT.RIGHT); labelUseBulkApi.setText(Labels.getString("AdvancedSettingsDialog.useBulkApi")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelUseBulkApi.setLayoutData(data); boolean useBulkAPI = config.getBoolean(Config.BULK_API_ENABLED); buttonUseBulkApi = new Button(restComp, SWT.CHECK); buttonUseBulkApi.setSelection(useBulkAPI); buttonUseBulkApi.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); boolean enabled = buttonUseBulkApi.getSelection(); // update batch size when this setting changes int newDefaultBatchSize = controller.getConfig().getDefaultBatchSize(enabled); logger.info("Setting batch size to " + newDefaultBatchSize); textBatch.setText(String.valueOf(newDefaultBatchSize)); // make sure the appropriate check boxes are enabled or disabled initBulkApiSetting(enabled); } }); // Bulk API serial concurrency mode setting Label labelBulkApiSerialMode = new Label(restComp, SWT.RIGHT); labelBulkApiSerialMode.setText( Labels.getString("AdvancedSettingsDialog.bulkApiSerialMode")); // $NON-NLS-1$ labelBulkApiSerialMode.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); buttonBulkApiSerialMode = new Button(restComp, SWT.CHECK); buttonBulkApiSerialMode.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE)); buttonBulkApiSerialMode.setEnabled(useBulkAPI); // Bulk API serial concurrency mode setting Label labelBulkApiZipContent = new Label(restComp, SWT.RIGHT); labelBulkApiZipContent.setText( Labels.getString("AdvancedSettingsDialog.bulkApiZipContent")); // $NON-NLS-1$ labelBulkApiZipContent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); buttonBulkApiZipContent = new Button(restComp, SWT.CHECK); buttonBulkApiZipContent.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE)); buttonBulkApiZipContent.setEnabled(useBulkAPI); // timezone textTimezone = createTextInput( restComp, "AdvancedSettingsDialog.timezone", Config.TIMEZONE, TimeZone.getDefault().getID(), 200); // proxy Host Label labelProxyHost = new Label(restComp, SWT.RIGHT); labelProxyHost.setText(Labels.getString("AdvancedSettingsDialog.proxyHost")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyHost.setLayoutData(data); textProxyHost = new Text(restComp, SWT.BORDER); textProxyHost.setText(config.getString(Config.PROXY_HOST)); data = new GridData(); data.widthHint = 250; textProxyHost.setLayoutData(data); // Proxy Port Label labelProxyPort = new Label(restComp, SWT.RIGHT); labelProxyPort.setText(Labels.getString("AdvancedSettingsDialog.proxyPort")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyPort.setLayoutData(data); textProxyPort = new Text(restComp, SWT.BORDER); textProxyPort.setText(config.getString(Config.PROXY_PORT)); textProxyPort.setTextLimit(4); textProxyPort.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); data = new GridData(); data.widthHint = 25; textProxyPort.setLayoutData(data); // Proxy Username Label labelProxyUsername = new Label(restComp, SWT.RIGHT); labelProxyUsername.setText(Labels.getString("AdvancedSettingsDialog.proxyUser")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyUsername.setLayoutData(data); textProxyUsername = new Text(restComp, SWT.BORDER); textProxyUsername.setText(config.getString(Config.PROXY_USERNAME)); data = new GridData(); data.widthHint = 120; textProxyUsername.setLayoutData(data); // Proxy Password Label labelProxyPassword = new Label(restComp, SWT.RIGHT); labelProxyPassword.setText( Labels.getString("AdvancedSettingsDialog.proxyPassword")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyPassword.setLayoutData(data); textProxyPassword = new Text(restComp, SWT.BORDER | SWT.PASSWORD); textProxyPassword.setText(config.getString(Config.PROXY_PASSWORD)); data = new GridData(); data.widthHint = 120; textProxyPassword.setLayoutData(data); // proxy NTLM domain Label labelProxyNtlmDomain = new Label(restComp, SWT.RIGHT); labelProxyNtlmDomain.setText( Labels.getString("AdvancedSettingsDialog.proxyNtlmDomain")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelProxyNtlmDomain.setLayoutData(data); textProxyNtlmDomain = new Text(restComp, SWT.BORDER); textProxyNtlmDomain.setText(config.getString(Config.PROXY_NTLM_DOMAIN)); data = new GridData(); data.widthHint = 250; textProxyNtlmDomain.setLayoutData(data); ////////////////////////////////////////////////// // Row to start At Label blankAgain = new Label(restComp, SWT.NONE); data = new GridData(); data.horizontalSpan = 2; blankAgain.setLayoutData(data); // Row to start AT Label labelLastRow = new Label(restComp, SWT.NONE); String lastBatch = controller.getConfig().getString(LastRun.LAST_LOAD_BATCH_ROW); if (lastBatch.equals("")) { // $NON-NLS-1$ lastBatch = "0"; // $NON-NLS-1$ } labelLastRow.setText( Labels.getFormattedString("AdvancedSettingsDialog.lastBatch", lastBatch)); // $NON-NLS-1$ data = new GridData(); data.horizontalSpan = 2; labelLastRow.setLayoutData(data); Label labelRowToStart = new Label(restComp, SWT.RIGHT); labelRowToStart.setText(Labels.getString("AdvancedSettingsDialog.startRow")); // $NON-NLS-1$ data = new GridData(GridData.HORIZONTAL_ALIGN_END); labelRowToStart.setLayoutData(data); textRowToStart = new Text(restComp, SWT.BORDER); textRowToStart.setText(config.getString(Config.LOAD_ROW_TO_START_AT)); data = new GridData(); data.widthHint = 75; textRowToStart.setLayoutData(data); textRowToStart.addVerifyListener( new VerifyListener() { @Override public void verifyText(VerifyEvent event) { event.doit = Character.isISOControl(event.character) || Character.isDigit(event.character); } }); // now that we've created all the buttons, make sure that buttons dependent on the bulk api // setting are enabled or disabled appropriately initBulkApiSetting(useBulkAPI); // the bottow separator Label labelSeparatorBottom = new Label(restComp, SWT.SEPARATOR | SWT.HORIZONTAL); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; labelSeparatorBottom.setLayoutData(data); // ok cancel buttons new Label(restComp, SWT.NONE); // END MIDDLE COMPONENT // START BOTTOM COMPONENT Composite buttonComp = new Composite(restComp, SWT.NONE); data = new GridData(GridData.HORIZONTAL_ALIGN_END); buttonComp.setLayoutData(data); buttonComp.setLayout(new GridLayout(2, false)); // Create the OK button and add a handler // so that pressing it will set input // to the entered value Button ok = new Button(buttonComp, SWT.PUSH | SWT.FLAT); ok.setText(Labels.getString("UI.ok")); // $NON-NLS-1$ ok.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { Config config = controller.getConfig(); // set the configValues config.setValue(Config.HIDE_WELCOME_SCREEN, buttonHideWelcomeScreen.getSelection()); config.setValue(Config.INSERT_NULLS, buttonNulls.getSelection()); config.setValue(Config.LOAD_BATCH_SIZE, textBatch.getText()); if (!buttonCsvComma.getSelection() && !buttonCsvTab.getSelection() && (!buttonCsvOther.getSelection() || textSplitterValue.getText() == null || textSplitterValue.getText().length() == 0)) { return; } config.setValue(Config.CSV_DELIMETER_OTHER_VALUE, textSplitterValue.getText()); config.setValue(Config.CSV_DELIMETER_COMMA, buttonCsvComma.getSelection()); config.setValue(Config.CSV_DELIMETER_TAB, buttonCsvTab.getSelection()); config.setValue(Config.CSV_DELIMETER_OTHER, buttonCsvOther.getSelection()); config.setValue(Config.EXTRACT_REQUEST_SIZE, textQueryBatch.getText()); config.setValue(Config.ENDPOINT, textEndpoint.getText()); config.setValue(Config.ASSIGNMENT_RULE, textRule.getText()); config.setValue(Config.LOAD_ROW_TO_START_AT, textRowToStart.getText()); config.setValue(Config.RESET_URL_ON_LOGIN, buttonResetUrl.getSelection()); config.setValue(Config.NO_COMPRESSION, buttonCompression.getSelection()); config.setValue(Config.TRUNCATE_FIELDS, buttonTruncateFields.getSelection()); config.setValue(Config.TIMEOUT_SECS, textTimeout.getText()); config.setValue( Config.ENABLE_EXTRACT_STATUS_OUTPUT, buttonOutputExtractStatus.getSelection()); config.setValue(Config.READ_UTF8, buttonReadUtf8.getSelection()); config.setValue(Config.WRITE_UTF8, buttonWriteUtf8.getSelection()); config.setValue(Config.EURO_DATES, buttonEuroDates.getSelection()); config.setValue(Config.TIMEZONE, textTimezone.getText()); config.setValue(Config.PROXY_HOST, textProxyHost.getText()); config.setValue(Config.PROXY_PASSWORD, textProxyPassword.getText()); config.setValue(Config.PROXY_PORT, textProxyPort.getText()); config.setValue(Config.PROXY_USERNAME, textProxyUsername.getText()); config.setValue(Config.PROXY_NTLM_DOMAIN, textProxyNtlmDomain.getText()); config.setValue(Config.BULK_API_ENABLED, buttonUseBulkApi.getSelection()); config.setValue(Config.BULK_API_SERIAL_MODE, buttonBulkApiSerialMode.getSelection()); config.setValue(Config.BULK_API_ZIP_CONTENT, buttonBulkApiZipContent.getSelection()); controller.saveConfig(); controller.logout(); input = Labels.getString("UI.ok"); // $NON-NLS-1$ shell.close(); } }); data = new GridData(); data.widthHint = 75; ok.setLayoutData(data); // Create the cancel button and add a handler // so that pressing it will set input to null Button cancel = new Button(buttonComp, SWT.PUSH | SWT.FLAT); cancel.setText(Labels.getString("UI.cancel")); // $NON-NLS-1$ cancel.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { input = null; shell.close(); } }); // END BOTTOM COMPONENT data = new GridData(); data.widthHint = 75; cancel.setLayoutData(data); // Set the OK button as the default, so // user can type input and press Enter // to dismiss shell.setDefaultButton(ok); // Set the child as the scrolled content of the ScrolledComposite sc.setContent(container); // Set the minimum size sc.setMinSize(768, 1024); // Expand both horizontally and vertically sc.setExpandHorizontal(true); sc.setExpandVertical(true); }
public void init() { GridLayout lay = new GridLayout(); lay.numColumns = 2; lay.makeColumnsEqualWidth = true; this.setLayout(lay); addedEntities = new ArrayList<EntityHolder>(); entityList = new List(this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.HORIZONTAL); GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true); gridData.verticalSpan = 1; gridData.horizontalSpan = 2; entityList.setLayoutData(gridData); // Add Entity Button addButton = new Button(this, SWT.NONE); addButton.setText("Add..."); gridData = new GridData(GridData.END, GridData.BEGINNING, true, false); gridData.minimumWidth = 50; gridData.horizontalIndent = 5; addButton.setLayoutData(gridData); addButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { // new addEntityDialog AddEntityDialog addEntityDialog = new AddEntityDialog(new Shell(), allEntities); // open dialog boolean addPressed = addEntityDialog.open(); // if add button is pressed if (addPressed) { // for each selected entity for (EntityHolder entity : addEntityDialog.getSelectedEntities()) { // check if entity has been added before if (!addedEntities.contains(entity)) { // add entity keyName to List entityList.add(entity.getName()); // add entity to addedEntities ArrayList addedEntities.add(entity); } } } } }); // Remove Entity Button removeButton = new Button(this, SWT.NONE); removeButton.setText("Remove"); gridData = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false); gridData.horizontalIndent = 5; gridData.minimumWidth = 50; removeButton.setLayoutData(gridData); removeButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { String[] selectionResult = entityList.getSelection(); // for each selected string for (String selected : selectionResult) { // search among all addedEntities for (int j = 0; j < addedEntities.size(); j++) { EntityHolder entity = addedEntities.get(j); // if corresponding entity is found if (selected != null && selected.equals(entity.getName())) { // remove entity from addedEntities ArrayList addedEntities.remove(j); // remove entity keyName from from List entityList.remove(selected); } } } } }); }
@Override public void createControl(Composite composite) { ModifyListener textListener = new ModifyListener() { @Override public void modifyText(ModifyEvent e) { if (activated) { saveAndUpdate(); } } }; settingsGroup = new Composite(composite, SWT.NONE); GridLayout gl = new GridLayout(4, false); gl.marginHeight = 10; gl.marginWidth = 10; settingsGroup.setLayout(gl); GridData gd = new GridData(GridData.FILL_BOTH); settingsGroup.setLayoutData(gd); { Label urlLabel = new Label(settingsGroup, SWT.NONE); urlLabel.setText(GenericMessages.dialog_connection_jdbc_url_); gd = new GridData(GridData.HORIZONTAL_ALIGN_END); urlLabel.setLayoutData(gd); urlText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 3; gd.grabExcessHorizontalSpace = true; // gd.widthHint = 355; urlText.setLayoutData(gd); urlText.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { site.updateButtons(); } }); addControlToGroup(GROUP_URL, urlLabel); addControlToGroup(GROUP_URL, urlText); } { Label hostLabel = new Label(settingsGroup, SWT.NONE); hostLabel.setText(GenericMessages.dialog_connection_host_label); hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); hostText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.grabExcessHorizontalSpace = true; hostText.setLayoutData(gd); hostText.addModifyListener(textListener); Label portLabel = new Label(settingsGroup, SWT.NONE); portLabel.setText(GenericMessages.dialog_connection_port_label); portLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); portText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.CENTER); gd.widthHint = 60; portText.setLayoutData(gd); // portText.addVerifyListener(UIUtils.INTEGER_VERIFY_LISTENER); portText.addModifyListener(textListener); addControlToGroup(GROUP_HOST, hostLabel); addControlToGroup(GROUP_HOST, hostText); addControlToGroup(GROUP_HOST, portLabel); addControlToGroup(GROUP_HOST, portText); } { Label serverLabel = new Label(settingsGroup, SWT.NONE); serverLabel.setText(GenericMessages.dialog_connection_server_label); serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); serverText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.grabExcessHorizontalSpace = true; // gd.widthHint = 270; serverText.setLayoutData(gd); serverText.addModifyListener(textListener); Control emptyLabel = createEmptyLabel(settingsGroup, 1); addControlToGroup(GROUP_SERVER, serverLabel); addControlToGroup(GROUP_SERVER, serverText); addControlToGroup(GROUP_SERVER, emptyLabel); } { Label dbLabel = new Label(settingsGroup, SWT.NONE); dbLabel.setText(GenericMessages.dialog_connection_database_schema_label); dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); dbText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.grabExcessHorizontalSpace = true; // gd.widthHint = 270; // gd.horizontalSpan = 3; dbText.setLayoutData(gd); dbText.addModifyListener(textListener); Control emptyLabel = createEmptyLabel(settingsGroup, 1); addControlToGroup(GROUP_DB, dbLabel); addControlToGroup(GROUP_DB, dbText); addControlToGroup(GROUP_DB, emptyLabel); } // Path { Label pathLabel = new Label(settingsGroup, SWT.NONE); pathLabel.setText(GenericMessages.dialog_connection_path_label); pathLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); pathText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); // gd.grabExcessHorizontalSpace = true; // gd.widthHint = 200; gd.horizontalSpan = 2; pathText.setLayoutData(gd); pathText.addModifyListener(textListener); pathText.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { updateCreateButton(site.getDriver()); } }); Composite buttonsPanel = new Composite(settingsGroup, SWT.NONE); gl = new GridLayout(2, true); gl.marginHeight = 0; gl.marginWidth = 0; buttonsPanel.setLayout(gl); gd = new GridData(GridData.HORIZONTAL_ALIGN_END); gd.widthHint = 150; buttonsPanel.setLayoutData(gd); Button browseButton = new Button(buttonsPanel, SWT.PUSH); browseButton.setText(GenericMessages.dialog_connection_browse_button); gd = new GridData(GridData.FILL_HORIZONTAL); browseButton.setLayoutData(gd); browseButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (metaURL.getAvailableProperties().contains(DriverDescriptor.PROP_FILE)) { FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SINGLE); dialog.setFileName(pathText.getText()); dialog.setText(GenericMessages.dialog_connection_db_file_chooser_text); String file = dialog.open(); if (file != null) { pathText.setText(file); } } else { DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE); final String curPath = pathText.getText(); File curFolder = new File(curPath); if (curFolder.exists()) { if (curFolder.isDirectory()) { dialog.setFilterPath(curFolder.getAbsolutePath()); } else { dialog.setFilterPath(curFolder.getParentFile().getAbsolutePath()); } } dialog.setText(GenericMessages.dialog_connection_db_folder_chooser_text); dialog.setMessage(GenericMessages.dialog_connection_db_folder_chooser_message); String folder = dialog.open(); if (folder != null) { pathText.setText(folder); } } } }); createButton = new Button(buttonsPanel, SWT.PUSH); createButton.setText("Create"); createButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createButton.setEnabled(false); createButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { createEmbeddedDatabase(); } }); addControlToGroup(GROUP_PATH, pathLabel); addControlToGroup(GROUP_PATH, pathText); addControlToGroup(GROUP_PATH, buttonsPanel); } { Label userNameLabel = new Label(settingsGroup, SWT.NONE); userNameLabel.setText(GenericMessages.dialog_connection_user_name_label); userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); userNameText = new Text(settingsGroup, SWT.BORDER); gd = new GridData(GridData.FILL_HORIZONTAL); gd.grabExcessHorizontalSpace = true; userNameText.setLayoutData(gd); userNameText.addModifyListener(textListener); Control emptyLabel = createEmptyLabel(settingsGroup, 2); Label passwordLabel = new Label(settingsGroup, SWT.NONE); passwordLabel.setText(GenericMessages.dialog_connection_password_label); passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); passwordText = new Text(settingsGroup, SWT.BORDER | SWT.PASSWORD); gd = new GridData(GridData.FILL_HORIZONTAL); gd.grabExcessHorizontalSpace = true; passwordText.setLayoutData(gd); passwordText.addModifyListener(textListener); addControlToGroup(GROUP_LOGIN, userNameLabel); addControlToGroup(GROUP_LOGIN, userNameText); addControlToGroup(GROUP_LOGIN, emptyLabel); addControlToGroup(GROUP_LOGIN, passwordLabel); addControlToGroup(GROUP_LOGIN, passwordText); } createDriverPanel(settingsGroup); setControl(settingsGroup); }
protected authDialog( AESemaphore _sem, Display display, String realm, boolean is_tracker, String target, String details) { sem = _sem; if (display.isDisposed()) { sem.releaseForever(); return; } final String ignore_key = "IgnoreAuth:" + realm + ":" + target + ":" + details; if (RememberedDecisionsManager.getRememberedDecision(ignore_key) == 1) { Debug.out( "Authentication for " + realm + "/" + target + "/" + details + " ignored as told not to ask again"); sem.releaseForever(); return; } shell = ShellFactory.createMainShell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); Utils.setShellIcon(shell); Messages.setLanguageText(shell, "authenticator.title"); GridLayout layout = new GridLayout(); layout.numColumns = 3; shell.setLayout(layout); GridData gridData; // realm Label realm_label = new Label(shell, SWT.NULL); Messages.setLanguageText(realm_label, "authenticator.realm"); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; realm_label.setLayoutData(gridData); Label realm_value = new Label(shell, SWT.NULL); realm_value.setText(realm.replaceAll("&", "&&")); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; realm_value.setLayoutData(gridData); // target Label target_label = new Label(shell, SWT.NULL); Messages.setLanguageText( target_label, is_tracker ? "authenticator.tracker" : "authenticator.location"); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; target_label.setLayoutData(gridData); Label target_value = new Label(shell, SWT.NULL); target_value.setText(target.replaceAll("&", "&&")); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; target_value.setLayoutData(gridData); if (details != null) { Label details_label = new Label(shell, SWT.NULL); Messages.setLanguageText( details_label, is_tracker ? "authenticator.torrent" : "authenticator.details"); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; details_label.setLayoutData(gridData); Label details_value = new Label(shell, SWT.NULL); details_value.setText(details.replaceAll("&", "&&")); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; details_value.setLayoutData(gridData); } // user Label user_label = new Label(shell, SWT.NULL); Messages.setLanguageText(user_label, "authenticator.user"); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; user_label.setLayoutData(gridData); final Text user_value = new Text(shell, SWT.BORDER); user_value.setText(""); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; user_value.setLayoutData(gridData); user_value.addListener( SWT.Modify, new Listener() { public void handleEvent(Event event) { username = user_value.getText(); } }); // password Label password_label = new Label(shell, SWT.NULL); Messages.setLanguageText(password_label, "authenticator.password"); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; password_label.setLayoutData(gridData); final Text password_value = new Text(shell, SWT.BORDER); password_value.setEchoChar('*'); password_value.setText(""); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 2; password_value.setLayoutData(gridData); password_value.addListener( SWT.Modify, new Listener() { public void handleEvent(Event event) { password = password_value.getText(); } }); // persist Label blank_label = new Label(shell, SWT.NULL); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; blank_label.setLayoutData(gridData); final Button checkBox = new Button(shell, SWT.CHECK); checkBox.setText(MessageText.getString("authenticator.savepassword")); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; checkBox.setLayoutData(gridData); checkBox.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { persist = checkBox.getSelection(); } }); final Button dontAsk = new Button(shell, SWT.CHECK); dontAsk.setText(MessageText.getString("general.dont.ask.again")); gridData = new GridData(GridData.FILL_BOTH); gridData.horizontalSpan = 1; dontAsk.setLayoutData(gridData); dontAsk.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { RememberedDecisionsManager.setRemembered(ignore_key, dontAsk.getSelection() ? 1 : 0); } }); // line Label labelSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; labelSeparator.setLayoutData(gridData); // buttons new Label(shell, SWT.NULL); Button bOk = new Button(shell, SWT.PUSH); Messages.setLanguageText(bOk, "Button.ok"); gridData = new GridData( GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL); gridData.grabExcessHorizontalSpace = true; gridData.widthHint = 70; bOk.setLayoutData(gridData); bOk.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { close(true); } }); Button bCancel = new Button(shell, SWT.PUSH); Messages.setLanguageText(bCancel, "Button.cancel"); gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); gridData.grabExcessHorizontalSpace = false; gridData.widthHint = 70; bCancel.setLayoutData(gridData); bCancel.addListener( SWT.Selection, new Listener() { public void handleEvent(Event e) { close(false); } }); shell.setDefaultButton(bOk); shell.addListener( SWT.Traverse, new Listener() { public void handleEvent(Event e) { if (e.character == SWT.ESC) { close(false); } } }); shell.pack(); Utils.centreWindow(shell); shell.open(); }
/** @see PreferencePage#createContents(Composite) */ protected Control createContents(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NULL); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 0; layout.marginWidth = 0; parent.setLayout(layout); // layout the top table & its buttons Label label = new Label(parent, SWT.LEFT); label.setText(XMLCompareMessages.XMLComparePreference_topTableLabel); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 2; label.setLayoutData(data); fIdMapsTable = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); fIdMapsTable.setHeaderVisible(true); data = new GridData(GridData.FILL_BOTH); data.heightHint = fIdMapsTable.getItemHeight() * 4; fIdMapsTable.setLayoutData(data); fIdMapsTable.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { selectionChanged(); } }); String column2Text = XMLCompareMessages.XMLComparePreference_topTableColumn2; String column3Text = XMLCompareMessages.XMLComparePreference_topTableColumn3; ColumnLayoutData columnLayouts[] = { new ColumnWeightData(1), new ColumnPixelData(convertWidthInCharsToPixels(column2Text.length() + 2), true), new ColumnPixelData(convertWidthInCharsToPixels(column3Text.length() + 5), true) }; TableLayout tablelayout = new TableLayout(); fIdMapsTable.setLayout(tablelayout); for (int i = 0; i < 3; i++) tablelayout.addColumnData(columnLayouts[i]); TableColumn column = new TableColumn(fIdMapsTable, SWT.NONE); column.setText(XMLCompareMessages.XMLComparePreference_topTableColumn1); column = new TableColumn(fIdMapsTable, SWT.NONE); column.setText(column2Text); column = new TableColumn(fIdMapsTable, SWT.NONE); column.setText(column3Text); fillIdMapsTable(); Composite buttons = new Composite(parent, SWT.NULL); buttons.setLayout(new GridLayout()); data = new GridData(); data.verticalAlignment = GridData.FILL; data.horizontalAlignment = GridData.FILL; buttons.setLayoutData(data); fAddIdMapButton = new Button(buttons, SWT.PUSH); fAddIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topAdd); fAddIdMapButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addIdMap(fAddIdMapButton.getShell()); } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fAddIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fAddIdMapButton.setLayoutData(data); fRenameIdMapButton = new Button(buttons, SWT.PUSH); fRenameIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topRename); fRenameIdMapButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { renameIdMap(fRenameIdMapButton.getShell()); } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fAddIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fRenameIdMapButton.setLayoutData(data); fRemoveIdMapButton = new Button(buttons, SWT.PUSH); fRemoveIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topRemove); fRemoveIdMapButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeIdMap(fRemoveIdMapButton.getShell()); } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fRemoveIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fRemoveIdMapButton.setLayoutData(data); createSpacer(buttons); fEditIdMapButton = new Button(buttons, SWT.PUSH); fEditIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topEdit); fEditIdMapButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { editIdMap(fEditIdMapButton.getShell()); } }); data = new GridData(); data.horizontalAlignment = GridData.FILL; // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fEditIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fEditIdMapButton.setLayoutData(data); // Spacer label = new Label(parent, SWT.LEFT); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 2; label.setLayoutData(data); // layout the middle table & its buttons label = new Label(parent, SWT.LEFT); label.setText(XMLCompareMessages.XMLComparePreference_middleTableLabel); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 2; label.setLayoutData(data); fMappingsTable = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); fMappingsTable.setHeaderVisible(true); data = new GridData(GridData.FILL_BOTH); data.heightHint = fMappingsTable.getItemHeight() * 4; data.widthHint = convertWidthInCharsToPixels(70); fMappingsTable.setLayoutData(data); column3Text = XMLCompareMessages.XMLComparePreference_middleTableColumn3; String column4Text = XMLCompareMessages.XMLComparePreference_middleTableColumn4; columnLayouts = new ColumnLayoutData[] { new ColumnWeightData(10), new ColumnWeightData(18), new ColumnPixelData(convertWidthInCharsToPixels(column3Text.length() + 1), true), new ColumnPixelData(convertWidthInCharsToPixels(column4Text.length() + 3), true) }; tablelayout = new TableLayout(); fMappingsTable.setLayout(tablelayout); for (int i = 0; i < 4; i++) tablelayout.addColumnData(columnLayouts[i]); column = new TableColumn(fMappingsTable, SWT.NONE); column.setText(XMLCompareMessages.XMLComparePreference_middleTableColumn1); column = new TableColumn(fMappingsTable, SWT.NONE); column.setText(XMLCompareMessages.XMLComparePreference_middleTableColumn2); column = new TableColumn(fMappingsTable, SWT.NONE); column.setText(column3Text); column = new TableColumn(fMappingsTable, SWT.NONE); column.setText(column4Text); buttons = new Composite(parent, SWT.NULL); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttons.setLayout(layout); fNewMappingsButton = new Button(buttons, SWT.PUSH); fNewMappingsButton.setLayoutData(getButtonGridData(fNewMappingsButton)); fNewMappingsButton.setText(XMLCompareMessages.XMLComparePreference_middleNew); fNewMappingsButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addMapping(fAddIdMapButton.getShell()); } }); fEditMappingsButton = new Button(buttons, SWT.PUSH); fEditMappingsButton.setLayoutData(getButtonGridData(fEditMappingsButton)); fEditMappingsButton.setText(XMLCompareMessages.XMLComparePreference_middleEdit); fEditMappingsButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { editMapping(fEditMappingsButton.getShell()); } }); fRemoveMappingsButton = new Button(buttons, SWT.PUSH); fRemoveMappingsButton.setLayoutData(getButtonGridData(fRemoveMappingsButton)); fRemoveMappingsButton.setText(XMLCompareMessages.XMLComparePreference_middleRemove); fRemoveMappingsButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeMapping(fRemoveMappingsButton.getShell()); } }); createSpacer(buttons); // layout the botton table & its buttons label = new Label(parent, SWT.LEFT); label.setText(XMLCompareMessages.XMLComparePreference_bottomTableLabel); data = new GridData(); data.horizontalAlignment = GridData.FILL; data.horizontalSpan = 2; label.setLayoutData(data); fOrderedTable = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION); fOrderedTable.setHeaderVisible(true); data = new GridData(GridData.FILL_BOTH); data.heightHint = fOrderedTable.getItemHeight() * 2; data.widthHint = convertWidthInCharsToPixels(70); fOrderedTable.setLayoutData(data); columnLayouts = new ColumnLayoutData[] {new ColumnWeightData(1), new ColumnWeightData(1)}; tablelayout = new TableLayout(); fOrderedTable.setLayout(tablelayout); for (int i = 0; i < 2; i++) tablelayout.addColumnData(columnLayouts[i]); column = new TableColumn(fOrderedTable, SWT.NONE); column.setText(XMLCompareMessages.XMLComparePreference_bottomTableColumn1); column = new TableColumn(fOrderedTable, SWT.NONE); column.setText(XMLCompareMessages.XMLComparePreference_bottomTableColumn2); buttons = new Composite(parent, SWT.NULL); buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; buttons.setLayout(layout); fNewOrderedButton = new Button(buttons, SWT.PUSH); fNewOrderedButton.setLayoutData(getButtonGridData(fNewOrderedButton)); fNewOrderedButton.setText(XMLCompareMessages.XMLComparePreference_bottomNew); fNewOrderedButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addOrdered(fNewOrderedButton.getShell()); } }); fEditOrderedButton = new Button(buttons, SWT.PUSH); fEditOrderedButton.setLayoutData(getButtonGridData(fEditOrderedButton)); fEditOrderedButton.setText(XMLCompareMessages.XMLComparePreference_bottomEdit); fEditOrderedButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { editOrdered(fEditOrderedButton.getShell()); } }); fRemoveOrderedButton = new Button(buttons, SWT.PUSH); fRemoveOrderedButton.setLayoutData(getButtonGridData(fRemoveOrderedButton)); fRemoveOrderedButton.setText(XMLCompareMessages.XMLComparePreference_bottomRemove); fRemoveOrderedButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeOrdered(fRemoveOrderedButton.getShell()); } }); createSpacer(buttons); fIdMapsTable.setSelection(0); fIdMapsTable.setFocus(); selectionChanged(); return parent; }
protected void createExeCancDefGroup(final QueryOptionsPack opt, int horizontalSpan) { // Group for execute, cancel and default buttons exeCancelDefaultGroup = new Group(shell, SWT.NONE); GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); gridData.horizontalSpan = horizontalSpan; exeCancelDefaultGroup.setLayoutData(gridData); exeCancelDefaultGroup.setLayout(new GridLayout(4, true)); if (forSIF) { sifTypeButton = new Button(exeCancelDefaultGroup, SWT.NONE); sifTypeButton.setBackground(new Color(null, 255, 255, 255)); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); sifTypeButton.setLayoutData(gridData); sifTypeButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { ArrayList<SIFType> selection = new ArrayList<SIFType>(selectedTypes); ExportToSIFL3Dialog dialog = new ExportToSIFL3Dialog( main.getShell(), org.gvt.model.sifl3.SIFGraph.getPossibleRuleTypes(), selection); if (dialog.open()) { selectedTypes.clear(); selectedTypes.addAll(selection); updateSIFTypeButtonText(); } } }); if (selectedTypes == null) selectedTypes = new ArrayList<SIFType>(); updateSIFTypeButtonText(); } // Execute Button executeButton = new Button(exeCancelDefaultGroup, SWT.NONE); executeButton.setText("Execute"); gridData = new GridData(GridData.END, GridData.CENTER, true, false); executeButton.setLayoutData(gridData); executeButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { // if no entity is added, show error if ((sourceElg != null && getAddedSourceEntities().isEmpty()) || (sourceST != null && sourceST.getSymbols().isEmpty())) { MessageDialog.openError(main.getShell(), "Error!", "Add Source Molecule!"); return; } if ((targetElg != null && getAddedTargetEntities().isEmpty()) || (targetST != null && targetST.getSymbols().isEmpty())) { MessageDialog.openError(main.getShell(), "Error!", "Add Target Molecule!"); return; } if (forSIF && selectedTypes.isEmpty()) { MessageDialog.openError( main.getShell(), "Error!", "Please select at least one interaction type."); return; } // Check for unknown gene symbols java.util.List<String> unkwn = getUnknownSymbols(); if (!unkwn.isEmpty()) { String s = ""; for (String us : unkwn) s += " " + us; MessageDialog.openError( main.getShell(), "Error!", "Unknown symbol" + (unkwn.size() > 1 ? "s" : "") + ": " + s); return; } // store values in dialog to optionsPack storeValuesToOptionsPack(opt); // execute is selected opt.setCancel(false); shell.close(); } }); // Cancel Button cancelButton = new Button(exeCancelDefaultGroup, SWT.NONE); gridData = new GridData(GridData.CENTER, GridData.CENTER, true, false); createCancelButton(gridData); // Default Button defaultButton = new Button(exeCancelDefaultGroup, SWT.NONE); defaultButton.setText("Default"); gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false); defaultButton.setLayoutData(gridData); defaultButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { // set default values of dialog setDefaultQueryDialogOptions(); } }); }