Java Code Examples for org.jdesktop.swingx.JXTaskPane#setTitle()

The following examples show how to use org.jdesktop.swingx.JXTaskPane#setTitle() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void addRulePane( final ElementStyleRule rule ) {
  final String selectorText = convertSelectorText( rule );
  final JTextField selector = new JTextField();
  selector.setText( selectorText );

  final JXTaskPane pane = new JXTaskPane();
  pane.setTitle( Messages.getString( "StyleDefinitionEditorDialog.RuleTitle", selectorText ) );
  pane.add( new RemoveStyleRuleAction( editorContext, rule ) );
  pane.add( selector );

  final SimpleStyleEditorPanel comp = new SimpleStyleEditorPanel( editorContext );
  comp.setReportDesignerContext( editorContext.getDesignerContext() );
  comp.setData( rule );
  pane.add( comp );

  selector.getDocument().addDocumentListener( new SelectorUpdateHandler( selector, rule, pane ) );

  taskPanes.put( rule, pane );
  taskPaneContainer.add( pane );

  taskPaneContainer.revalidate();
  taskPaneContainer.repaint();
}
 
Example 2
private ScriptGroup(String key) {
    taskGroup = new JXTaskPane();
    taskGroup.applyComponentOrientation(getComponentOrientation());
    taskGroup.setFocusable(false);
    taskGroup.setRequestFocusEnabled(false);
    taskGroup.setTitle(AppLocal.getIntString(key));
    taskGroup.setVisible(false); // Only groups with sons are visible.
}
 
Example 3
protected Component createContentPane() {
  taskPane = new JXTaskPane();
  taskPane.setSpecial( true );
  taskPane.setCollapsed( false );
  taskPane.setTitle( Messages.getString( "StyleDefinitionEditorDialog.TaskTitle" ) );
  taskPane.add( new AddStyleRuleAction( editorContext ) );

  taskPaneContainer = new JXTaskPaneContainer();
  taskPaneContainer.add( taskPane );
  return new JScrollPane( taskPaneContainer );
}
 
Example 4
Source Project: chipster   File: ToolsInternalFrame.java    License: MIT License 5 votes vote down vote up
/**
 * Creates panel for decimal separator selecting.
 * This panel is used on the first step.
 * 
 * @return panel for decimal separator selecting
 */
private JPanel createDecimalSeparatorPanel() {
	JXTaskPane decimalSeparatorPanel = createTaskPane();
	decimalSeparatorPanel.setLayout(new GridBagLayout());

	ButtonGroup separatorGroup = new ButtonGroup();

	dotAsDecimalSeparatorRadioButton = new JRadioButton("Dot .");
	dotAsDecimalSeparatorRadioButton.setActionCommand(".");
	dotAsDecimalSeparatorRadioButton.addActionListener(this);
	dotAsDecimalSeparatorRadioButton.setOpaque(false);
	separatorGroup.add(dotAsDecimalSeparatorRadioButton);

	commaAsDecimalSeparatorRadioButton = new JRadioButton("Comma ,");
	commaAsDecimalSeparatorRadioButton.setActionCommand(",");
	commaAsDecimalSeparatorRadioButton.addActionListener(this);
	commaAsDecimalSeparatorRadioButton.setOpaque(false);
	separatorGroup.add(commaAsDecimalSeparatorRadioButton);

	dotAsDecimalSeparatorRadioButton.setSelected(true);
	screen.getConversionModel().setDecimalSeparator('.');

	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0; c.gridy = 0;
	c.anchor = GridBagConstraints.WEST;
	c.weightx = 1.0;
	c.fill = GridBagConstraints.HORIZONTAL;

	decimalSeparatorPanel.add(dotAsDecimalSeparatorRadioButton, c);
	c.gridy++;
	decimalSeparatorPanel.add(commaAsDecimalSeparatorRadioButton, c);

	decimalSeparatorPanel.setTitle("Decimal Separator");

	return decimalSeparatorPanel;
}
 
Example 5
Source Project: chipster   File: ToolsInternalFrame.java    License: MIT License 5 votes vote down vote up
private Component createGuessTheRestPanel() {
	JXTaskPane guessTheRestPanel = createTaskPane();
	guessTheRestPanel.setLayout(new BorderLayout());
	fillTheRestButton = new JButton("Complete the rest");
	guessTheRestPanel.add(fillTheRestButton, BorderLayout.WEST);
	fillTheRestButton.addActionListener(this);
	guessTheRestPanel.setTitle("Complete with pattern");
	undoGuessButton = new JButton("Undo");
	undoGuessButton.addActionListener(this);
	undoGuessButton.setEnabled(false);
	guessTheRestPanel.add(undoGuessButton, BorderLayout.EAST);
	return guessTheRestPanel;
}
 
Example 6
/**
 * Updates the function panel
 */
private void updateFunctions() {

	// remove all content
	functionsPanel.removeAll();
	functionsPanel.setLayout(functionButtonsLayout);
	functionCategoryTaskPanes = new HashMap<>();
	GridBagConstraints gbc = new GridBagConstraints();
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.weightx = 1;
	gbc.gridx = 0;
	gbc.gridy = 0;
	int totalFunctionCount = 0;

	// get the filtered model (the FunctionDescriptions we want to display)
	Map<String, List<FunctionDescription>> filteredModel = functionModel.getFilteredModel();
	String filterName = functionModel.getFilterNameString();
	boolean searchStringGiven = !filterName.isEmpty();

	for (String functionGroup : filteredModel.keySet()) {

		boolean perfectMatch = false;
		JXTaskPane functionCategoryTaskPane = new JXTaskPane();
		functionCategoryTaskPane.setName(functionGroup);
		List<FunctionDescription> list = functionModel.getFilteredModel(functionGroup);
		totalFunctionCount += list.size();

		for (FunctionDescription function : list) {
			// create the panels for the functions, register the observer and add them to the
			// related category
			final FunctionDescriptionPanel funcDescPanel = new FunctionDescriptionPanel(function);
			funcDescPanel.registerObserver(functionObserver);
			functionCategoryTaskPane.add(funcDescPanel);
			if (!perfectMatch && searchStringGiven) {
				// check for function name equality without brackets and with brackets
				String functionName = function.getDisplayName().split("\\(")[0];
				if (filterName.toLowerCase(Locale.ENGLISH).equals(functionName.toLowerCase(Locale.ENGLISH)) || filterName
						.toLowerCase(Locale.ENGLISH).equals(function.getDisplayName().toLowerCase(Locale.ENGLISH))) {
					perfectMatch = true;
				}
			}
		}

		functionCategoryTaskPane.setTitle(functionGroup);
		functionCategoryTaskPane.setAnimated(false);

		// if there is only one category in the filtered model, open the task pane
		if (filteredModel.keySet().size() == 1) {
			functionCategoryTaskPane.setCollapsed(false);
		} else {
			functionCategoryTaskPane.setCollapsed(true);
		}

		if (perfectMatch) {
			functionCategoryTaskPane.setCollapsed(false);
		}

		functionCategoryTaskPanes.put(functionGroup, functionCategoryTaskPane);

		gbc.ipady = 10;
		functionsPanel.add(functionCategoryTaskPane, gbc);
		gbc.gridy += 1;
	}

	// if the number of result functions is clear, open the task panes
	// (if you can see all categories even if they are opened)
	if (totalFunctionCount <= MAX_NMBR_FUNCTIONS_SHOWN) {
		for (JXTaskPane taskPane : functionCategoryTaskPanes.values()) {
			taskPane.setCollapsed(false);
		}
	}

	// if there are no results, show a simple message
	if (filteredModel.isEmpty()) {
		gbc.ipady = 10;
		functionsPanel.add(new JLabel(MESSAGE_NO_RESULTS), gbc);
	}

	functionsPanel.revalidate();
}
 
Example 7
Source Project: chipster   File: ToolsInternalFrame.java    License: MIT License 4 votes vote down vote up
/**
 * Creates panel for delimeter selection. 
 * This panel is used on the first step
 * 
 * @return JPanel delimeter selection panel
 */
private JPanel createDelimSelectorPanel() {
	JXTaskPane delimPanel = createTaskPane();
	delimPanel.setLayout(new GridBagLayout());

	delimRadioButtons = new ArrayList<JRadioButton>();
	Map<String, JRadioButton>delimRadioButtonsByDelims = new HashMap<String, JRadioButton>();
	ButtonGroup delimGroup = new ButtonGroup();
	
	String[] selectorLabels = new String[Delimiter.values().length];
	String[] delimiters = new String[Delimiter.values().length];
	for(int i = 0; i < Delimiter.values().length; i++){
		selectorLabels[i] = Delimiter.values()[i].getName();
		delimiters[i] = Delimiter.values()[i].toString();
	}

	for (int i = 0; i < selectorLabels.length; i++) {
		JRadioButton selector = new JRadioButton(selectorLabels[i]);
		selector.setActionCommand(delimiters[i]);
		selector.addActionListener(this);
		selector.setOpaque(false);
		delimGroup.add(selector);
		delimRadioButtons.add(selector);
		delimRadioButtonsByDelims.put(delimiters[i], selector);
	}

	customDelimRadioButton = new JRadioButton("Other:");
	customDelimRadioButton.addActionListener(this);
	customDelimRadioButton.setOpaque(false);
	delimGroup.add(customDelimRadioButton);
	delimRadioButtons.add(customDelimRadioButton);

	delimRadioButtons.get(0).setSelected(true);

	customDelimField = new JTextField(3);
	customDelimField.addCaretListener(this);
	//customDelimField.setPreferredSize(new Dimension(25, 20));
	customDelimField.setMargin(new Insets(2, 2, 2, 2));
	
	useCustomDelimButton = new JButton("Use");
	useCustomDelimButton.addActionListener(this);
	useCustomDelimButton.setEnabled(false);

	GridBagConstraints c = new GridBagConstraints();
	c.gridx = 0; c.gridy = 0;
	c.gridwidth = 2;
	c.anchor = GridBagConstraints.WEST;
	c.weightx = 1.0;
	c.fill = GridBagConstraints.HORIZONTAL;

	for (int i = 0; i < delimRadioButtons.size()-1; i++) {
		delimPanel.add(delimRadioButtons.get(i), c);
		c.gridy++;			
	}

	c.gridx = 0;
	c.gridwidth = 1;
	c.weightx = 0.0;
	c.fill = GridBagConstraints.NONE;
	delimPanel.add(customDelimRadioButton, c);
	c.gridx = 1;
	delimPanel.add(customDelimField, c);
	c.gridx++;
	delimPanel.add(useCustomDelimButton, c);

	delimPanel.setTitle("Column Delimiter");

	return delimPanel;
}