private void makeUI() { JComponent[] variableComponents = createComponents(PROPERTY_VARIABLE_NAME, TextFieldEditor.class); final TableLayout layout = new TableLayout(2); layout.setTablePadding(4, 3); layout.setCellWeightX(0, 1, 1.0); layout.setCellWeightX(1, 1, 1.0); layout.setCellWeightX(2, 0, 1.0); layout.setCellColspan(2, 0, 2); layout.setTableFill(TableLayout.Fill.HORIZONTAL); final JPanel panel = new JPanel(layout); panel.add(variableComponents[1]); panel.add(variableComponents[0]); JLabel expressionLabel = new JLabel("Variable expression:"); JTextArea expressionArea = new JTextArea(); expressionArea.setRows(3); TextComponentAdapter textComponentAdapter = new TextComponentAdapter(expressionArea); bindingContext.bind(PROPERTY_EXPRESSION, textComponentAdapter); panel.add(expressionLabel); panel.add(layout.createHorizontalSpacer()); panel.add(expressionArea); JButton editExpressionButton = new JButton("Edit Expression..."); editExpressionButton.setName("editExpressionButton"); editExpressionButton.addActionListener(createEditExpressionButtonListener()); panel.add(layout.createHorizontalSpacer()); panel.add(editExpressionButton); setContent(panel); }
public JPanel createDefaultPanel() { final JPanel subPanel1 = new JPanel(new BorderLayout(3, 3)); subPanel1.add(getProductNameLabel(), BorderLayout.NORTH); subPanel1.add(getProductNameTextField(), BorderLayout.CENTER); final JPanel subPanel2 = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); subPanel2.add(getSaveToFileCheckBox()); subPanel2.add(getFormatNameComboBox()); final JPanel subPanel3 = new JPanel(new BorderLayout(3, 3)); subPanel3.add(getProductDirLabel(), BorderLayout.NORTH); subPanel3.add(getProductDirTextField(), BorderLayout.CENTER); subPanel3.add(getProductDirChooserButton(), BorderLayout.EAST); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTableAnchor(TableLayout.Anchor.WEST); tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayout.setTableWeightX(1.0); tableLayout.setCellPadding(0, 0, new Insets(3, 3, 3, 3)); tableLayout.setCellPadding(1, 0, new Insets(3, 3, 3, 3)); tableLayout.setCellPadding(2, 0, new Insets(0, 24, 3, 3)); tableLayout.setCellPadding(3, 0, new Insets(3, 3, 3, 3)); final JPanel panel = new JPanel(tableLayout); panel.setBorder(BorderFactory.createTitledBorder("Target Product")); panel.add(subPanel1); panel.add(subPanel2); panel.add(subPanel3); panel.add(getOpenInAppCheckBox()); return panel; }
@Override public Component createPageComponent() { final AppContext appContext = getContext().getAppContext(); final ProductCrsForm productCrsForm = new ProductCrsForm(appContext, appContext.getSelectedProduct()); final CustomCrsForm customCrsForm = new CustomCrsForm(appContext); final PredefinedCrsForm predefinedCrsForm = new PredefinedCrsForm(appContext); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTablePadding(4, 4); tableLayout.setTableWeightX(1.0); tableLayout.setTableWeightY(1.0); tableLayout.setTableFill(TableLayout.Fill.BOTH); final JPanel pageComponent = new JPanel(tableLayout); final JLabel label = new JLabel("<html><b>No CRS found for ESRI Shapefile. Please specify.</b>"); crsSelectionPanel = new CrsSelectionPanel(productCrsForm, customCrsForm, predefinedCrsForm); pageComponent.add(label); pageComponent.add(crsSelectionPanel); return pageComponent; }
@Override protected Component createPageComponent() { final TableLayout tableLayout = new TableLayout(2); tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTableFill(TableLayout.Fill.HORIZONTAL); tableLayout.setTablePadding(4, 4); tableLayout.setTableWeightY(1.0); tableLayout.setColumnWeightX(0, 0.0); tableLayout.setColumnWeightX(1, 1.0); final JPanel panel = new JPanel(tableLayout); final JLabel label = new JLabel("Time Series Name:"); field = new JTextField(getAssistantModel().getTimeSeriesName()); panel.add(label); panel.add(field); return panel; }
/** * Creates the UI component. The enable state of the UI is controlled via the parameter <code> * disableUIProperty</code>. If it matches the value of the property provided in the constructor, * the UI will be disabled. * * @param disableUIProperty Controls the enable state of the UI. * @return The UI component. */ public JPanel createBoundsInputPanel(boolean disableUIProperty) { final TableLayout layout = new TableLayout(9); layout.setTableAnchor(TableLayout.Anchor.WEST); layout.setTableFill(TableLayout.Fill.BOTH); layout.setTableWeightX(1.0); layout.setTableWeightY(1.0); layout.setTablePadding(3, 3); layout.setColumnWeightX(0, 0.0); layout.setColumnWeightX(1, 1.0); layout.setColumnWeightX(2, 0.0); layout.setColumnWeightX(3, 0.0); layout.setColumnWeightX(4, 1.0); layout.setColumnWeightX(5, 0.0); layout.setColumnWeightX(6, 0.0); layout.setColumnWeightX(7, 1.0); layout.setColumnWeightX(8, 0.0); layout.setColumnPadding(2, new Insets(3, 0, 3, 12)); layout.setColumnPadding(5, new Insets(3, 0, 3, 12)); final JPanel panel = new JPanel(layout); final DoubleFormatter doubleFormatter = new DoubleFormatter("###0.0##"); pixelXUnit = new JLabel(NonSI.DEGREE_ANGLE.toString()); pixelYUnit = new JLabel(NonSI.DEGREE_ANGLE.toString()); panel.add(new JLabel("West:")); final JFormattedTextField westLonField = new JFormattedTextField(doubleFormatter); westLonField.setHorizontalAlignment(JTextField.RIGHT); bindingContext.bind(PROPERTY_WEST_BOUND, westLonField); bindingContext.bindEnabledState( PROPERTY_WEST_BOUND, false, enablePropertyKey, disableUIProperty); panel.add(westLonField); panel.add(new JLabel(NonSI.DEGREE_ANGLE.toString())); panel.add(new JLabel("East:")); final JFormattedTextField eastLonField = new JFormattedTextField(doubleFormatter); eastLonField.setHorizontalAlignment(JTextField.RIGHT); bindingContext.bind(PROPERTY_EAST_BOUND, eastLonField); bindingContext.bindEnabledState( PROPERTY_EAST_BOUND, false, enablePropertyKey, disableUIProperty); panel.add(eastLonField); panel.add(new JLabel(NonSI.DEGREE_ANGLE.toString())); panel.add(new JLabel("Pixel size X:")); pixelSizeXField = new JFormattedTextField(doubleFormatter); pixelSizeXField.setHorizontalAlignment(JTextField.RIGHT); bindingContext.bind(PROPERTY_PIXEL_SIZE_X, pixelSizeXField); bindingContext.bindEnabledState( PROPERTY_PIXEL_SIZE_X, false, enablePropertyKey, disableUIProperty); panel.add(pixelSizeXField); panel.add(pixelXUnit); panel.add(new JLabel("North:")); final JFormattedTextField northLatField = new JFormattedTextField(doubleFormatter); northLatField.setHorizontalAlignment(JTextField.RIGHT); bindingContext.bind(PROPERTY_NORTH_BOUND, northLatField); bindingContext.bindEnabledState( PROPERTY_NORTH_BOUND, false, enablePropertyKey, disableUIProperty); panel.add(northLatField); panel.add(new JLabel(NonSI.DEGREE_ANGLE.toString())); panel.add(new JLabel("South:")); final JFormattedTextField southLatField = new JFormattedTextField(doubleFormatter); southLatField.setHorizontalAlignment(JTextField.RIGHT); bindingContext.bind(PROPERTY_SOUTH_BOUND, southLatField); bindingContext.bindEnabledState( PROPERTY_SOUTH_BOUND, false, enablePropertyKey, disableUIProperty); panel.add(southLatField); panel.add(new JLabel(NonSI.DEGREE_ANGLE.toString())); panel.add(new JLabel("Pixel size Y:")); pixelSizeYField = new JFormattedTextField(doubleFormatter); pixelSizeYField.setHorizontalAlignment(JTextField.RIGHT); bindingContext.bind(PROPERTY_PIXEL_SIZE_Y, pixelSizeYField); bindingContext.bindEnabledState( PROPERTY_PIXEL_SIZE_Y, false, enablePropertyKey, disableUIProperty); panel.add(pixelSizeYField); panel.add(pixelYUnit); bindingContext.addProblemListener( new BindingProblemListener() { @Override public void problemReported(BindingProblem problem, BindingProblem ignored) { final String propertyName = problem.getBinding().getPropertyName(); final boolean invalidBoundSet = propertyName.equals(PROPERTY_NORTH_BOUND) || propertyName.equals(PROPERTY_EAST_BOUND) || propertyName.equals(PROPERTY_SOUTH_BOUND) || propertyName.equals(PROPERTY_WEST_BOUND); if (invalidBoundSet) { resetTextField(problem); } } private void resetTextField(BindingProblem problem) { problem.getBinding().getComponentAdapter().adjustComponents(); } @Override public void problemCleared(BindingProblem ignored) { // do nothing } }); return panel; }
@Override protected JPanel createPanel(BindingContext context) { TableLayout tableLayout = new TableLayout(2); tableLayout.setTableAnchor(TableLayout.Anchor.NORTHWEST); tableLayout.setTablePadding(new Insets(4, 10, 0, 0)); tableLayout.setTableFill(TableLayout.Fill.BOTH); tableLayout.setColumnWeightX(1, 1.0); tableLayout.setCellColspan(0, 0, 2); tableLayout.setCellColspan(1, 0, 2); tableLayout.setCellColspan(8, 0, 2); JPanel pageUI = new JPanel(tableLayout); PropertyEditorRegistry registry = PropertyEditorRegistry.getInstance(); Property computeLatLonSteps = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_RES_AUTO); Property avgGridSize = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_RES_PIXELS); Property latStep = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_RES_LAT); Property lonStep = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_RES_LON); Property lineColor = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_LINE_COLOR); Property lineWidth = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_LINE_WIDTH); Property lineTransparency = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_LINE_TRANSPARENCY); Property showTextLabels = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_TEXT_ENABLED); Property textFgColor = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_TEXT_FG_COLOR); Property textBgColor = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_TEXT_BG_COLOR); Property textBgTransparency = context.getPropertySet().getProperty(GraticuleLayerType.PROPERTY_NAME_TEXT_BG_TRANSPARENCY); JComponent[] computeLatLonStepsComponents = registry .findPropertyEditor(computeLatLonSteps.getDescriptor()) .createComponents(computeLatLonSteps.getDescriptor(), context); JComponent[] avgGridSizeComponents = registry .findPropertyEditor(avgGridSize.getDescriptor()) .createComponents(avgGridSize.getDescriptor(), context); JComponent[] latStepComponents = registry .findPropertyEditor(latStep.getDescriptor()) .createComponents(latStep.getDescriptor(), context); JComponent[] lonStepComponents = registry .findPropertyEditor(lonStep.getDescriptor()) .createComponents(lonStep.getDescriptor(), context); JComponent[] lineColorComponents = PreferenceUtils.createColorComponents(lineColor); JComponent[] lineWidthComponents = registry .findPropertyEditor(lineWidth.getDescriptor()) .createComponents(lineWidth.getDescriptor(), context); JComponent[] lineTransparencyComponents = registry .findPropertyEditor(lineTransparency.getDescriptor()) .createComponents(lineTransparency.getDescriptor(), context); JComponent[] showTextLabelsComponents = registry .findPropertyEditor(showTextLabels.getDescriptor()) .createComponents(showTextLabels.getDescriptor(), context); textFgColorComponents = PreferenceUtils.createColorComponents(textFgColor); textBgColorComponents = PreferenceUtils.createColorComponents(textBgColor); JComponent[] textBgTransparencyComponents = registry .findPropertyEditor(textBgTransparency.getDescriptor()) .createComponents(textBgTransparency.getDescriptor(), context); pageUI.add(computeLatLonStepsComponents[0]); addNote( pageUI, "<html>Note: Deselect this option only very carefully. The latitude and longitude<br>" + "steps you enter will be used for low and high resolution products.</html>"); pageUI.add(avgGridSizeComponents[1]); pageUI.add(avgGridSizeComponents[0]); pageUI.add(latStepComponents[1]); pageUI.add(latStepComponents[0]); pageUI.add(lonStepComponents[1]); pageUI.add(lonStepComponents[0]); pageUI.add(lineColorComponents[0]); pageUI.add(lineColorComponents[1]); pageUI.add(lineWidthComponents[1]); pageUI.add(lineWidthComponents[0]); pageUI.add(lineTransparencyComponents[1]); pageUI.add(lineTransparencyComponents[0]); pageUI.add(showTextLabelsComponents[0]); pageUI.add(textFgColorComponents[0]); pageUI.add(textFgColorComponents[1]); pageUI.add(textBgColorComponents[0]); pageUI.add(textBgColorComponents[1]); pageUI.add(textBgTransparencyComponents[1]); pageUI.add(textBgTransparencyComponents[0]); pageUI.add(tableLayout.createVerticalSpacer()); JPanel parent = new JPanel(new BorderLayout()); parent.add(pageUI, BorderLayout.CENTER); parent.add(Box.createHorizontalStrut(100), BorderLayout.EAST); return parent; }