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); }
@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; }