List of usage examples for javax.swing JComponent putClientProperty
public final void putClientProperty(Object key, Object value)
From source file:net.sf.firemox.tools.MToolKit.java
/** * Specifies that a component should have overlay functionality. * //w ww . j av a 2 s . c o m * @param superPanel * the panel to overlay. */ public static void addOverlay(JComponent superPanel) { /* * superPanel.putClientProperty(SubstanceLookAndFeel.OVERLAY_PROPERTY, * Boolean.TRUE); */ superPanel.putClientProperty(SubstanceLookAndFeel.BACKGROUND_COMPOSITE, new AlphaControlBackgroundComposite(0.3f, 0.5f)); superPanel.putClientProperty(SubstanceLookAndFeel.GRIP_PAINTER, new DragBumpsGripPainter()); }
From source file:it.unibas.spicygui.controllo.file.ActionNewMappingTask.java
/** * Initialize panels representing individual wizard's steps and sets * various properties for them influencing wizard appearance. *///from ww w .j a v a 2 s. co m private WizardDescriptor.Panel[] getPanels() { // if (panels == null) { panels = new WizardDescriptor.Panel[] { new NewMappingTaskWizardPanel1(), new NewMappingTaskWizardPanel2() }; String[] steps = new String[panels.length]; for (int i = 0; i < panels.length; i++) { Component c = panels[i].getComponent(); // Default step name to component name of panel. Mainly useful // for getting the name of the target chooser to appear in the // list of steps. steps[i] = c.getName(); if (c instanceof JComponent) { // assume Swing components JComponent jc = (JComponent) c; // Sets step number of a component jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i)); // Sets steps names for a panel jc.putClientProperty("WizardPanel_contentData", steps); // Turn on subtitle creation on each step jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // Show steps on the left side with the image on the background jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // Turn on numbering of all steps jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); } } // } return panels; }
From source file:com.github.alexfalappa.nbspringboot.projects.initializr.InitializrProjectWizardIterator.java
@Override public void initialize(WizardDescriptor wiz) { this.wiz = wiz; wiz.putProperty("NewProjectWizard_Title", NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_WizardTitle")); //NOI18N index = 0;/*from ww w . ja v a 2 s. c o m*/ // set other defaults this.wiz.putProperty(WIZ_USE_SB_MVN_PLUGIN, true); this.wiz.putProperty(WIZ_REMOVE_MVN_WRAPPER, true); // create the wizard panels panels = new WizardDescriptor.Panel[] { new InitializrProjectWizardPanel1(), new InitializrProjectWizardPanel2(), new InitializrProjectWizardPanel3() }; // Make sure list of steps is accurate. String[] steps = new String[] { NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_BasePropsStep"), NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_DependenciesStep"), NbBundle.getMessage(InitializrProjectWizardIterator.class, "LBL_CreateProjectStep") }; // create wizard steps gui components for (int i = 0; i < panels.length; i++) { Component c = panels[i].getComponent(); if (steps[i] == null) { // Default step name to component name of panel. // Mainly useful for getting the name of the target // chooser to appear in the list of steps. steps[i] = c.getName(); } if (c instanceof JComponent) { // assume Swing components JComponent jc = (JComponent) c; // Step #. jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i); // Step name (actually the whole list for reference). jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); } } // schedule async retrieval of initializr metadata in panel visual 1 Utilities.attachInitJob(panels[0].getComponent(), (AsyncGUIJob) panels[0].getComponent()); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractComponent.java
protected void assignClassDebugProperty(JComponent c) { c.putClientProperty(SWING_PROPERTY_CLASS, getClass().getSimpleName()); }
From source file:com.aw.swing.mvp.view.IPView.java
private Object getComponentFullScan(String attributeName, Object source) { List<Field> forms = new ArrayList(); Class cls = source.getClass(); Field[] fields = cls.getFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName().equals(attributeName)) { JComponent jComponemt; try { jComponemt = (JComponent) fields[i].get(source); if (jComponemt != null) { jComponemt.putClientProperty("Field", fields[i]); return jComponemt; } else { System.out.println("Null:<" + source.getClass() + ">- <" + fields[i].getName() + ">"); }// w w w . j ava 2 s . c om } catch (IllegalAccessException e) { e.printStackTrace(); throw new AWSystemException("Error getting teh value of:<" + fields[i].getName() + ">", e); } } if ((fields[i].getType().getSimpleName().startsWith("Frm"))) { forms.add(fields[i]); } } if (forms.size() > 0) { for (Field field : forms) { try { Object formToBeChecked = field.get(source); if (formToBeChecked != null) { Object cmp = getComponentFullScan(attributeName, formToBeChecked); if (cmp != null) { return cmp; } } else { throw new IllegalStateException("FRM NULL:" + field.getName()); } } catch (IllegalAccessException e) { e.printStackTrace(); throw new AWSystemException("Problems getting value for:<" + field.getName() + ">", e); } } } logger.debug("Searching - Component " + attributeName + " does not exist in:" + source); return null; }
From source file:com.limegroup.gnutella.gui.GUIUtils.java
public static void restrictSize(JComponent component, SizePolicy sizePolicy, boolean addClientProperty) { switch (sizePolicy) { case RESTRICT_HEIGHT: int height = component.getPreferredSize().height; int width = component.getPreferredSize().width; component.setMinimumSize(new Dimension(width, height)); //component.setPreferredSize(new Dimension(width, height)); component.setMaximumSize(new Dimension(Integer.MAX_VALUE, height)); break;/* w w w . j av a 2 s . com*/ case RESTRICT_BOTH: height = component.getPreferredSize().height; width = component.getPreferredSize().width; component.setMinimumSize(new Dimension(width, height)); //component.setPreferredSize(STANDARD_DIMENSION); component.setMaximumSize(new Dimension(width, height)); break; case RESTRICT_NONE: component.setMinimumSize(null); component.setMaximumSize(null); } if (addClientProperty) { component.putClientProperty(SizePolicy.class, sizePolicy); } }
From source file:edu.ku.brc.ui.UIHelper.java
/** * @param comp//from w w w . j ava2s .co m */ public static void setControlSize(final JComponent comp) { if (isMacOS_10_5_X && comp != null) { comp.putClientProperty("JComponent.sizeVariant", controlSize.toString()); } }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopFieldGroup.java
protected void reattachColumnFields(int colIndex) { fields.values().stream().filter(FieldConfig::isBound).map(fieldConfig -> ((FieldConfigImpl) fieldConfig)) .filter(fci -> fci.getColumn() == colIndex).forEach(fci -> { impl.remove(fci.getCompositionNN().getComposition()); if (fci.getLabel() != null) { impl.remove(fci.getLabel()); }//from w w w . ja v a 2 s . co m if (fci.getToolTipButton() != null) { impl.remove(fci.getToolTipButton()); } }); List<FieldConfig> columnFCs = columnFieldMapping.get(colIndex); int insertRowIndex = 0; for (FieldConfig fc : columnFCs) { if (fc.isBound()) { FieldConfigImpl fci = (FieldConfigImpl) fc; Component fieldComponent = fci.getComponentNN(); JComponent composition = fieldComponent.unwrapComposition(JComponent.class); JLabel label = fci.getLabel(); if (label != null) { int preferredCaptionWidth = getPreferredCaptionWidth(colIndex); if (preferredCaptionWidth > 0) { label.setPreferredSize(new Dimension(preferredCaptionWidth, 25)); label.setMaximumSize(new Dimension(preferredCaptionWidth, 25)); label.setMinimumSize(new Dimension(preferredCaptionWidth, 25)); } else { label.setPreferredSize(new Dimension(label.getPreferredSize().width, 25)); } label.setVisible(fieldComponent.isVisible()); CC labelCc = new CC(); MigLayoutHelper.applyAlignment(labelCc, Alignment.TOP_LEFT); impl.add(label, labelCc.cell(colIndex * 3, insertRowIndex, 1, 1)); } ToolTipButton toolTipButton = fci.getToolTipButton(); if (fci.getToolTipButton() != null) { updateTooltipButton(fci, fieldComponent); DesktopToolTipManager.getInstance().registerTooltip(toolTipButton); impl.add(toolTipButton, new CC().cell(colIndex * 3 + 2, insertRowIndex, 1, 1).alignY("top")); } CC cell = new CC().cell(colIndex * 3 + 1, insertRowIndex, 1, 1); MigLayoutHelper.applyWidth(cell, (int) fieldComponent.getWidth(), fieldComponent.getWidthUnits(), false); MigLayoutHelper.applyHeight(cell, (int) fieldComponent.getHeight(), fieldComponent.getHeightUnits(), false); MigLayoutHelper.applyAlignment(cell, fieldComponent.getAlignment()); composition.putClientProperty(getSwingPropertyId(), fci.getId()); impl.add(composition, cell); insertRowIndex++; } } impl.validate(); impl.repaint(); }
From source file:org.nuclos.client.genericobject.GenericObjectCollectController.java
private void markFieldInHistoricalView(CollectableGenericObjectWithDependants clctlowdCurrent, String sFieldName, CollectableField clctfShown) { if (clctlowdCurrent != null) { final CollectableField clctf = clctlowdCurrent.getField(sFieldName); if (!clctfShown.equals(clctf)) { final Collection<CollectableComponent> collclctcomp = layoutrootDetails .getCollectableComponentsFor(sFieldName); if (!collclctcomp.isEmpty()) { final CollectableComponent clctcomp = collclctcomp.iterator().next(); final JComponent compFocussable = clctcomp.getFocusableComponent(); String initialToolTip = (String) compFocussable.getClientProperty("initialToolTip"); if (initialToolTip == null) { initialToolTip = StringUtils.emptyIfNull(compFocussable.getToolTipText()); compFocussable.putClientProperty("initialToolTip", initialToolTip); }//from ww w . j av a2 s .c o m if (clctcomp instanceof CollectableComboBox) { CollectableComboBox clctcmbx = (CollectableComboBox) clctcomp; clctcmbx.getJComboBox().setRenderer(clctcmbx.new CollectableFieldRenderer() { @Override protected void paintComponent(Graphics g) { setBackground(colorHistoricalChanged); super.paintComponent(g); } }); } else compFocussable.setBackground(colorHistoricalChanged); final String sToolTip = getSpringLocaleDelegate().getMessage("GenericObjectCollectController.4", "{0} [Ge\u00e4ndert; aktueller Wert: \"{1}\"]", initialToolTip, clctf.toString()); compFocussable.setToolTipText(sToolTip); clctcomp.getJComponent().setToolTipText(sToolTip); // todo: mark fields which are not tracked in logbook? } } } }
From source file:org.springframework.richclient.form.binding.support.AbstractBinder.java
public Binding bind(JComponent control, FormModel formModel, String formPropertyPath, Map context) { // Ensure that this component has not already been bound Binding binding = (Binding) control.getClientProperty(BINDING_CLIENT_PROPERTY_KEY); if (binding != null) { throw new IllegalStateException("Component is already bound to property: " + binding.getProperty()); }/*from w w w . j a v a 2s .c o m*/ validateContextKeys(context); binding = doBind(control, formModel, formPropertyPath, context); control.putClientProperty(BINDING_CLIENT_PROPERTY_KEY, binding); return binding; }