org.jdesktop.swingx.JXTaskPane Java Examples

The following examples show how to use org.jdesktop.swingx.JXTaskPane. 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
Source File: StyleDefinitionEditorDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 6 votes vote down vote up
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
Source File: FlatTaskPaneUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void paintTitleBackground( JXTaskPane group, Graphics g ) {
	int width = group.getWidth();
	int height = getTitleHeight( group ) ;
	float arc = UIScale.scale( (float) roundHeight );
	float lineWidth = UIScale.scale( 1f );

	// paint background
	g.setColor( group.isSpecial() ? specialTitleBackground : titleBackgroundGradientStart );
	((Graphics2D)g).fill( FlatUIUtils.createRoundRectanglePath( lineWidth, lineWidth,
		width - (lineWidth * 2), height - (lineWidth * 2), arc - lineWidth, arc - lineWidth, 0, 0 ) );

	// paint border
	if( borderColor != null ) {
		g.setColor( borderColor );
		((Graphics2D)g).fill( FlatUIUtils.createRoundRectangle( 0, 0, width, height, lineWidth, arc, arc, 0, 0 ) );
	}
}
 
Example #3
Source File: MaterialTaskPaneUI.java    From material-ui-swing with MIT License 5 votes vote down vote up
@Override
public Dimension getPreferredSize(JXTaskPane group) {
    this.configureLabel(group);
    Dimension dim = this.label.getPreferredSize();
    dim.width += getTitleHeight(group);
    dim.height = getTitleHeight(group);
    return dim;
}
 
Example #4
Source File: StyleDefinitionEditorDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void removeRulePane( final ElementStyleRule rule ) {
  final JXTaskPane jxTaskPane = taskPanes.get( rule );
  if ( jxTaskPane != null ) {
    this.taskPaneContainer.remove( jxTaskPane );
    this.taskPanes.remove( rule );

    this.taskPaneContainer.revalidate();
    this.taskPaneContainer.repaint();
  }
}
 
Example #5
Source File: StyleDefinitionEditorDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #6
Source File: StyleDefinitionEditorDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void init( final ReportDesignerContext designerContext ) {
  this.taskPanes = new HashMap<ElementStyleRule, JXTaskPane>();
  this.editorContext = new StyleDefinitionEditorContext( designerContext, this, new ElementStyleDefinition() );
  this.editorContext.addPropertyChangeListener( "source", new FileSourceChangeHandler() );

  setTitle( Messages.getString( "StyleDefinitionEditorDialog.InlineTitle" ) );

  final JMenu fileMenu = new JMenu( Messages.getString( "StyleDefinitionEditorDialog.Menu.File.Label" ) );
  fileMenu.setMnemonic( Messages.getMnemonic( "StyleDefinitionEditorDialog.Menu.File.Mnemonic" ) );
  fileMenu.add( new OpenAction( editorContext ) );
  fileMenu.add( new SaveAction( editorContext ) );
  fileMenu.add( new SaveAsAction( editorContext ) );
  fileMenu.addSeparator();
  fileMenu.add( new CloseAction() );

  standaloneMenuBar = new JMenuBar();
  standaloneMenuBar.add( fileMenu );

  final JMenu inlineMenu = new JMenu( Messages.getString( "StyleDefinitionEditorDialog.Menu.File.Label" ) );
  inlineMenu.setMnemonic( Messages.getMnemonic( "StyleDefinitionEditorDialog.Menu.File.Mnemonic" ) );
  inlineMenu.add( new OpenAction( editorContext ) );
  inlineMenu.add( new SaveAction( editorContext ) );
  inlineMenu.add( new SaveAsAction( editorContext ) );

  inlineMenuBar = new JMenuBar();
  inlineMenuBar.add( inlineMenu );

  setJMenuBar( inlineMenuBar );

  super.init();

  editorContext.addElementStyleDefinitionChangeListener( new ElementStyleDefinitionChangeHandler() );
}
 
Example #7
Source File: StyleDefinitionEditorDialog.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private SelectorUpdateHandler( final JTextField textField,
                               final ElementStyleRule styleRule,
                               final JXTaskPane pane ) {
  this.textField = textField;
  this.styleRule = styleRule;
  this.pane = pane;
  this.color = textField.getBackground();
  this.errorColor = new Color( 1f, 0.75f, 0.75f );
}
 
Example #8
Source File: JPrincipalApp.java    From nordpos with GNU General Public License v3.0 5 votes vote down vote up
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 #9
Source File: DarkTaskPaneUI.java    From darklaf with MIT License 5 votes vote down vote up
@Override
protected void paintTitleBackground(final JXTaskPane group, final Graphics g2) {
    Graphics2D g = (Graphics2D) g2;
    int w = group.getWidth();
    int h = group.getHeight();
    if (group.isSpecial()) {
        g.setColor(specialTitleBackground);
    } else {
        g.setColor(titleBackgroundGradientStart);
    }
    if (isCollapsed()) {
        PaintUtil.fillRoundRect(g, 0, 0, w, h, getRoundHeight());
        g.setColor(borderColor);
        PaintUtil.paintLineBorder(g, 0, 0, w, h, getRoundHeight());
    } else {
        Rectangle clip = g.getClip().getBounds();
        g.setClip(0, 0, w, h / 2 + 1);

        PaintUtil.fillRoundRect(g, 0, 0, w, h, getRoundHeight());
        g.setClip(0, h / 2, w, h / 2);
        g.fillRect(0, 0, w, h);

        g.setColor(borderColor);
        g.setClip(0, 0, w, h / 2);
        PaintUtil.paintLineBorder(g, 0, 0, w, h, getRoundHeight());

        g.setClip(0, h / 2, w, h / 2);
        PaintUtil.drawRect(g, 0, 0, w, h, 1);
        g.setClip(clip);
    }
}
 
Example #10
Source File: MaterialTaskPaneUI.java    From material-ui-swing with MIT License 5 votes vote down vote up
protected void paintTitleBackground(JXTaskPane group, Graphics g) {
    MaterialDrawingUtils.getAliasedGraphics(g);
    this.label.setBackground(UIManager.getColor("TaskPane.background"));
    if (group.isSpecial()) {
        g.setColor(specialTitleBackground);
    } else {
        g.setColor(titleBackgroundGradientStart);
    }
    Graphics2D graphics2D = (Graphics2D) g;
    graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g = graphics2D;
    g.fillRoundRect( -2, 0, group.getWidth(), group.getHeight(), 15, 15);
}
 
Example #11
Source File: MaterialTaskPaneUI.java    From material-ui-swing with MIT License 5 votes vote down vote up
@Override
public void update(Graphics g, JComponent c) {
    super.update(g, c);
    JXTaskPane jxTaskPane = (JXTaskPane) c;
    jxTaskPane.setIcon(jxTaskPane.isCollapsed() ? UIManager.getIcon("TaskPane.yesCollapsed") : UIManager.getIcon("TaskPane.noCollapsed"));
    jxTaskPane.getContentPane().setBackground(UIManager.getColor("TaskPane.contentBackground"));
}
 
Example #12
Source File: MaterialTaskPaneUI.java    From material-ui-swing with MIT License 5 votes vote down vote up
@Override
public void installUI(JComponent c) {
    super.installUI(c);
    JXTaskPane jxTaskPane = (JXTaskPane) c;
    jxTaskPane.addMouseListener(changeIcon);
    jxTaskPane.setIcon(jxTaskPane.isCollapsed() ? UIManager.getIcon("TaskPane.yesCollapsed") : UIManager.getIcon("TaskPane.noCollapsed"));
    jxTaskPane.getContentPane().setBackground(UIManager.getColor("TaskPane.contentBackground"));

    this.taskPane = jxTaskPane;
}
 
Example #13
Source File: FlatTaskPaneUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void paintTitle( JXTaskPane group, Graphics g, Color textColor,
	int x, int y, int width, int height )
{
	// scale title position
	int titleX = UIScale.scale( 3 );
	int titleWidth = group.getWidth() - getTitleHeight(group) - titleX;
	if( !group.getComponentOrientation().isLeftToRight() ) {
		// right-to-left
		titleX = group.getWidth() - titleX - titleWidth;
	}

	super.paintTitle( group, g, textColor, titleX, y, titleWidth, height );
}
 
Example #14
Source File: FlatTaskPaneUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void paintChevronControls( JXTaskPane group, Graphics g, int x, int y, int width, int height ) {
	Graphics2D g2 = (Graphics2D) g;

	// scale chevron size
	float cw = scale( 6f );
	float ch = scale( 3f );

	// create arrow shape
	int direction = group.isCollapsed() ? SwingConstants.SOUTH : SwingConstants.NORTH;
	Shape arrowShape = FlatArrowButton.createArrowShape( direction, true, cw, ch );

	// fix position of controls
	x = group.getComponentOrientation().isLeftToRight() ? (group.getWidth() - width - y) : y;

	// compute chevron position
	int cx = (int) (x + width / 2 - cw / 2);
	int cy = (int) (y + (height / 2 - ch));
	float offset = ch + UIScale.scale( 1f );

	// set stroke with scaled width
	g2.setStroke( new BasicStroke( scale( 1f ) ) );

	// paint
	g2.translate( cx, cy );
	g2.draw( arrowShape );
	g2.translate( 0, offset );
	g2.draw( arrowShape );
	g2.translate( -cx, -(cy + offset) );
}
 
Example #15
Source File: ToolsInternalFrame.java    From chipster with 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 #16
Source File: DarkTaskPaneUI.java    From darklaf with MIT License 5 votes vote down vote up
@Override
protected void paintExpandedControls(final JXTaskPane group, final Graphics g, final int x,
                                     final int y, final int width, final int height) {
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setColor(getPaintColor(group));
    if (group.isCollapsed()) {
        collapsedIcon.paintIcon(group, g, x, y);
    } else {
        openIcon.paintIcon(group, g, x, y);
    }
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
 
Example #17
Source File: ToolsInternalFrame.java    From chipster with 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 #18
Source File: MainGui.java    From OpenID-Attacker with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void actionPerformed(ActionEvent e) {
    JButton pressedButton = (JButton) e.getSource();
    //System.out.println("pressed button: " + pressedButton.getText());
    
    if (pressedButton == lastPressedButton) {
        // do nothing
        return;
    }        
    
    // remove selection from LAST pressed button
    lastPressedButton.setFont(defaultFont);
    lastPressedButton = pressedButton;
    
    // add selection to pressed button
    pressedButton.setFont(boldUnderline);
    
    JXTaskPane taskPaneOfPressedButton = (JXTaskPane) SwingUtilities.getAncestorOfClass(JXTaskPane.class, pressedButton);
    
    if (taskPaneOfPressedButton.getTitle().equals("Attacker IdP")) {

        switch (pressedButton.getText()) {
            case "Server Configuration":
                splitPane.setRightComponent(attackerIdpServerConfigurationGui);
                
                break;
            case "HTML Discovery":
                splitPane.setRightComponent(attackerIdpHtmlConfigurationGui);
                break;
            case "XRDS Discovery":
                splitPane.setRightComponent(attackerIdpXrdsConfigurationGui);
                break;
            case "Valid Data":
                splitPane.setRightComponent(attackerIdpValidDataGui);
                break;
            case "Attack Data":
                splitPane.setRightComponent(attackerIdpAttackDataGui);
                break;
            case "Attack Overview":
                splitPane.setRightComponent(attackerIdpAttackOverviewGui);
                break;
        }
    } else {
        switch (pressedButton.getText()) {
            case "Server Configuration":
                splitPane.setRightComponent(analyzerIdpServerConfigurationGui);
                
                break;
            case "HTML Discovery":
                splitPane.setRightComponent(analyzerIdpHtmlConfigurationGui);
                break;
            case "XRDS Discovery":
                splitPane.setRightComponent(analyzerIdpXrdsConfigurationGui);
                break;
            case "Valid Data":
                splitPane.setRightComponent(analyzerIdpValidDataGui);
                break;
            case "Attack Data":
                splitPane.setRightComponent(analyzerIdpAttackDataGui);
                break;
            case "Parameter Overview":
                splitPane.setRightComponent(analyzerIdpAttackOverviewGui);
                break;
            case "Automated Analysis":
                splitPane.setRightComponent(evaluationGui);
                break;
            case "Reports":
                splitPane.setRightComponent(reportGui);
                break;
            case "Log":
                splitPane.setRightComponent(logGui);
                break;
        }
    }
}
 
Example #19
Source File: ToolsInternalFrame.java    From chipster with MIT License 4 votes vote down vote up
public static void setUpTaskPane(JXTaskPane pane) {
	pane.getContentPane().setBackground(new JPanel().getBackground());
	((JXPanel)pane.getContentPane()).setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
}
 
Example #20
Source File: ToolsInternalFrame.java    From chipster with MIT License 4 votes vote down vote up
private JXTaskPane createTaskPane() {
	JXTaskPane pane = new JXTaskPane();
	setUpTaskPane(pane);
	return pane;
}
 
Example #21
Source File: ToolsInternalFrame.java    From chipster with 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;
}
 
Example #22
Source File: JPrincipalApp.java    From nordpos with GNU General Public License v3.0 4 votes vote down vote up
public JXTaskPane getTaskGroup() {
    return taskGroup;
}
 
Example #23
Source File: ExpressionPropertyDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * 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 #24
Source File: ConfigurableDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Reloads configurables for the given source and task pane.
 *
 * @param source
 * @param remoteTaskPane
 */
private void updateConfigurables(final String source, final JXTaskPane remoteTaskPane) {

	if (remoteConfigListModels.get(source).isEmpty()) {
		boolean notFetching = configurablesFetching.get(source) == null
				|| !configurablesFetching.get(source).booleanValue();

		if (notFetching) {

			ProgressThread pt = new ProgressThread("refresh_configurables") {

				@Override
				public void run() {

					configurablesFetching.put(source, true);
					getProgressListener().setTotal(100);
					getProgressListener().setCompleted(10);
					for (ConfigurableController controller : remoteControllers.values()) {
						RemoteRepository repository = controller.getModel().getSource();
						if (repository.getName().equals(source)) {
							addingConfigurablesFirstTime.put(source, true);
							remoteInfoLabelListModels.get(source).removeAllElements();
							remoteInfoLabelListModels.get(source)
									.addElement(ConfigurableInfoLabelType.LOADING.toString());
							remoteTaskPane.repaint();

							// try to connect
							try {
								repository.setPasswortInputCanceled(false);
								getProgressListener().setCompleted(30);
								remoteControllers.get(source).getModel().resetConnection();
								getProgressListener().setCompleted(80);

							} catch (RepositoryException e1) {

								// timeout or connection failed
								remoteInfoLabelListModels.get(source).removeAllElements();
								remoteInfoLabelListModels.get(source)
										.addElement(ConfigurableInfoLabelType.FAILED.toString());
								addingConfigurablesFirstTime.remove(source);
								configurablesFetching.remove(source);
							}
							remoteControllers.get(source).getModel().isEditingPossible();

							// update UI
							remoteTaskPane.repaint();

							break;
						}
					}
					getProgressListener().setCompleted(100);
					getProgressListener().complete();
					configurablesFetching.remove(source);
					remoteTaskPane.repaint();
				}
			};
			pt.start();
		}
	}
}
 
Example #25
Source File: FlatTaskPaneUI.java    From FlatLaf with Apache License 2.0 4 votes vote down vote up
@Override
protected void paintExpandedControls( JXTaskPane group, Graphics g, int x, int y, int width, int height ) {
	g.setColor( getPaintColor( group ) );
	paintChevronControls( group, g, x, y, width, height );
}
 
Example #26
Source File: DarkTaskPaneUI.java    From darklaf with MIT License 4 votes vote down vote up
@Override
protected void configureLabel(final JXTaskPane group) {
    super.configureLabel(group);
    label.setFont(label.getFont().deriveFont(Font.PLAIN));
}