/** * Styles a font. * * @param font * @return styled font data */ public static FontData[] styleFont(Font font, int fontStyle) { FontData[] datas = font.getFontData(); for (FontData data : datas) { data.setStyle(data.getStyle() | fontStyle); } return datas; }
private void initFontAndColors() { final Font defaultFont; final FontData[] fontData = getFont().getFontData(); if (fontData != null && fontData.length > 0) { final FontData fd = fontData[0]; fd.setStyle(SWT.BOLD); fd.setHeight(fd.getHeight() + 2); defaultFont = new Font(getDisplay(), fd); } else { defaultFont = null; } this.titleFont = defaultFont; SWTGraphicUtil.addDisposer(this, defaultFont); final Color defaultTitleColor = new Color(getDisplay(), 0, 88, 150); this.titleColor = defaultTitleColor; SWTGraphicUtil.addDisposer(this, defaultTitleColor); final Color defaultGradientEndColor = new Color(this.getDisplay(), 239, 239, 239); this.gradientEnd = defaultGradientEndColor; SWTGraphicUtil.addDisposer(this, defaultGradientEndColor); final Color defaultGradientStartColor = new Color(this.getDisplay(), 255, 255, 255); this.gradientStart = defaultGradientStartColor; SWTGraphicUtil.addDisposer(this, defaultGradientStartColor); final Color defaultSeparatorColor = new Color(this.getDisplay(), 229, 229, 229); this.separatorColor = defaultSeparatorColor; SWTGraphicUtil.addDisposer(this, defaultSeparatorColor); }
protected int addLabelBox( String text, int xPos, int yPos, int labelWidth, int labelHeight, int fontSize, float scaleFactor) { Box labelBox = ModelFactory.eINSTANCE.createBox(); labelBox.setSize(new Dimension(labelWidth, labelHeight)); labelBox.setLocation(new Point(xPos, yPos)); LabelBoxPrinter labelBoxPrinter = new LabelBoxPrinter(scaleFactor); labelBox.setBoxPrinter(labelBoxPrinter); labelBox.setID("Standard Label"); // $NON-NLS-1$ labelBoxPrinter.setText(text); labelBoxPrinter.setHorizontalAlignment(SWT.CENTER); try { FontData data = Display.getDefault().getSystemFont().getFontData()[0]; data.setHeight(fontSize); data.setStyle(SWT.BOLD); Font font = AWTSWTImageUtils.swtFontToAwt(data); labelBoxPrinter.setFont(font); } catch (Exception e) { // oh well don't have that font type } boxes.add(labelBox); return labelHeight; }
/** * Takes a font and gives it a bold typeface. * * @param font Font to modify * @return Font with bold typeface */ public static Font applyBoldFont(Font font) { if (font == null) return null; FontData[] fontDataArray = font.getFontData(); if (fontDataArray == null) { return null; } for (int index = 0; index < fontDataArray.length; index++) { FontData fData = fontDataArray[index]; fData.setStyle(SWT.BOLD); } return new Font(Display.getDefault(), fontDataArray); }
@Override public Font getFont(Object element) { if (fVMList.getChecked(element)) { if (bold == null) { Font dialogFont = JFaceResources.getDialogFont(); FontData[] fontData = dialogFont.getFontData(); for (int i = 0; i < fontData.length; i++) { FontData data = fontData[i]; data.setStyle(SWT.BOLD); } Display display = JDIDebugUIPlugin.getStandardDisplay(); bold = new Font(display, fontData); } return bold; } return null; }
public TableViewerBuilder(TableViewer viewer, Composite tableContainer) { this.viewer = viewer; viewer.setComparer(new EqualityComparer()); this.tableLayout = new TableColumnLayout(); tableContainer.setLayout(tableLayout); normalFont = viewer.getTable().getFont(); FontData fd = normalFont.getFontData()[0]; fd.setStyle(SWT.ITALIC); italicFont = new Font(null, fd); viewer .getTable() .addDisposeListener( new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { italicFont.dispose(); } }); }
/* (non-Javadoc) * @see gov.redhawk.sca.ui.compatibility.ICompatibilityUtil#setFontDataStyle(org.eclipse.swt.graphics.FontData, int) */ @Override public void setFontDataStyle(FontData fontData, int style) { fontData.setStyle(style); }
private void initializeItalicBold() { FontData italicBoldData = createFontDataFromNormal(); italicBoldData.setStyle(SWT.BOLD | SWT.ITALIC); ITALIC_BOLD = new Font(NORMAL.getDevice(), italicBoldData); }
private void initializeBold() { FontData boldData = createFontDataFromNormal(); boldData.setStyle(SWT.BOLD); BOLD = new Font(NORMAL.getDevice(), boldData); }
protected void copyFontData(FontData src, FontData dst) { dst.setName(src.getName()); dst.setStyle(src.getStyle()); dst.setHeight(src.getHeight()); }
protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(3, false)); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalIndent = 15; gd.verticalIndent = 15; composite.setLayoutData(gd); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 2; FontData fd = parent.getFont().getFontData()[0]; fd.setStyle(SWT.BOLD); fd.setHeight(11); Font font = new Font(parent.getDisplay(), fd); Label l = new Label(composite, SWT.NONE); l.setText("jAnrufmonitor"); l.setFont(font); l.setLayoutData(gd); gd = new GridData(GridData.FILL_BOTH); gd.verticalSpan = 8; // check for edition String edition = getI18nManager().getString(NAMESPACE, "edition", "label", getLanguage()); if (edition != null && edition.trim().length() > 0 && !edition.equalsIgnoreCase("edition")) l.setText(l.getText() + " " + edition); l = new Label(composite, SWT.NONE); l.setImage(SWTImageManager.getInstance(this.getRuntime()).get(IJAMConst.IMAGE_KEY_TELEFON_JPG)); l.setLayoutData(gd); fd = parent.getFont().getFontData()[0]; fd.setStyle(SWT.BOLD); font = new Font(parent.getDisplay(), fd); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "license", "label", getLanguage())); l.setFont(font); new Label(composite, SWT.NONE) .setText(getI18nManager().getString(NAMESPACE, "freeware", "label", getLanguage())); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "version", "label", getLanguage())); l.setFont(font); new Label(composite, SWT.NONE).setText(IJAMConst.VERSION_DISPLAY); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "build", "label", getLanguage())); l.setFont(font); new Label(composite, SWT.NONE).setText(IJAMConst.VERSION_BUILD); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "rkey", "label", getLanguage())); l.setFont(font); String key = getRuntime() .getConfigManagerFactory() .getConfigManager() .getProperty("service.update.UpdateManager", "regkey"); if (key == null || key.length() == 0) { key = new UUID().toString(); getRuntime() .getConfigManagerFactory() .getConfigManager() .setProperty("service.update.UpdateManager", "regkey", key); getRuntime().getConfigManagerFactory().getConfigManager().saveConfiguration(); } HyperLink hl = new HyperLink(composite, SWT.NONE); hl.setText(key); final String rkey = key; hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) Program.launch("http://www.janrufmonitor.de/registry.php?k=" + rkey); } }); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "homepage", "label", getLanguage())); l.setFont(font); hl = new HyperLink(composite, SWT.NONE); hl.setText("http://www.janrufmonitor.de/"); hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) Program.launch("http://www.janrufmonitor.de/"); } }); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "mail", "label", getLanguage())); l.setFont(font); hl = new HyperLink(composite, SWT.NONE); hl.setText("*****@*****.**"); hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) Program.launch("http://www.janrufmonitor.de/support-request.php?k=" + rkey); } }); l = new Label(composite, SWT.NONE); l.setText(getI18nManager().getString(NAMESPACE, "donation", "label", getLanguage())); l.setFont(font); hl = new HyperLink(composite, SWT.NONE); hl.setText("http://www.janrufmonitor.de/donation/"); hl.addMouseListener( new MouseAdapter() { public void mouseDown(MouseEvent e) { if (e.button == 1) Program.launch("http://www.janrufmonitor.de/donation/"); } }); new Label(composite, SWT.NONE); new Label(composite, SWT.NONE); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 3; gd.widthHint = 300; l = new Label(composite, SWT.RIGHT); l.setText("(c) 2008 - 2011 by Thilo Brandt "); l.setLayoutData(gd); return super.createDialogArea(parent); }
/** * 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); }
protected void modifyFontData(TextStyle textStyle, int height, int style) { FontData fd = textStyle.getFontData()[0]; fd.setHeight(height); fd.setStyle(style); textStyle.setFontData(fd); }
{ this.defaultHAlign = HorizontalAlignmentEnum.LEFT; this.defaultCellPainter = new BackgroundPainter( new PaddingDecorator(new TextPainter(false, false), 0, 5, 0, 5, false)); // column header styling this.cHeaderHAlign = HorizontalAlignmentEnum.LEFT; this.cHeaderFont = GUIHelper.DEFAULT_FONT; this.cHeaderCellPainter = new PaddingDecorator(new TextPainter(), 0, 5, 0, 5); // column header selection style this.cHeaderSelectionFont = GUIHelper.DEFAULT_FONT; this.cHeaderSelectionCellPainter = new BackgroundPainter( new PaddingDecorator(new TextPainter(false, false), 0, 5, 0, 5, false)); // row header styling this.rHeaderFont = GUIHelper.DEFAULT_FONT; // row header selection style this.rHeaderSelectionFont = GUIHelper.DEFAULT_FONT; this.rHeaderSelectionCellPainter = new TextPainter(); // no alternate row styling this.evenRowBgColor = GUIHelper.COLOR_WHITE; this.oddRowBgColor = GUIHelper.COLOR_WHITE; // default selection style this.defaultSelectionBgColor = GUIHelper.COLOR_LIST_SELECTION; this.defaultSelectionFgColor = GUIHelper.COLOR_WHITE; this.defaultSelectionFont = GUIHelper.DEFAULT_FONT; // selection anchor this.selectionAnchorSelectionBgColor = GUIHelper.COLOR_LIST_SELECTION; this.selectionAnchorSelectionFgColor = GUIHelper.COLOR_WHITE; this.selectionAnchorBorderStyle = new BorderStyle(1, GUIHelper.COLOR_BLUE, LineStyleEnum.SOLID); // column/row group header style this.cGroupHeaderHAlign = HorizontalAlignmentEnum.CENTER; this.cGroupHeaderCellPainter = new ColumnGroupHeaderTextPainter(); this.rGroupHeaderCellPainter = new BackgroundPainter( new PaddingDecorator( new RowGroupHeaderTextPainter( new VerticalTextPainter(false, false), CellEdgeEnum.BOTTOM, false, 2, true), 0, 0, 2, 0, false)); // sort header styling this.sortHeaderCellPainter = new BackgroundPainter( new PaddingDecorator( new SortableHeaderTextPainter( new TextPainter(false, false), CellEdgeEnum.RIGHT, new SortIconPainter(false), false, 0, false), 0, 2, 0, 5, false)); this.selectedSortHeaderCellPainter = new BackgroundPainter( new PaddingDecorator( new SortableHeaderTextPainter( new TextPainter(false, false), CellEdgeEnum.RIGHT, new SortIconPainter(false, true), false, 0, false), 0, 2, 0, 5, false)); TreeImagePainter treeImagePainter = new TreeImagePainter( false, GUIHelper.getImage("right"), GUIHelper.getImage("right_down"), null); //$NON-NLS-1$//$NON-NLS-2$ this.treeStructurePainter = new BackgroundPainter( new PaddingDecorator( new IndentedTreeImagePainter( 10, null, CellEdgeEnum.LEFT, treeImagePainter, false, 2, true), 0, 5, 0, 5, false)); TreeImagePainter treeSelectionImagePainter = new TreeImagePainter( false, GUIHelper.getImage("right_inv"), GUIHelper.getImage("right_down_inv"), null); //$NON-NLS-1$//$NON-NLS-2$ this.treeStructureSelectionPainter = new BackgroundPainter( new PaddingDecorator( new IndentedTreeImagePainter( 10, null, CellEdgeEnum.LEFT, treeSelectionImagePainter, false, 2, true), 0, 5, 0, 5, false)); FontData summaryRowFontData = GUIHelper.DEFAULT_FONT.getFontData()[0]; summaryRowFontData.setStyle(SWT.BOLD); this.summaryRowFont = GUIHelper.getFont(summaryRowFontData); this.summaryRowHAlign = HorizontalAlignmentEnum.RIGHT; this.summaryRowBgColor = GUIHelper.COLOR_WIDGET_LIGHT_SHADOW; this.summaryRowSelectionFont = GUIHelper.getFont(summaryRowFontData); this.summaryRowSelectionBgColor = GUIHelper.COLOR_WIDGET_DARK_SHADOW; this.renderCornerGridLines = true; this.renderColumnHeaderGridLines = true; }