private JTextField createField(final String text) { final JTextField field = new JTextField(text) { public Dimension getPreferredSize() { Dimension preferredSize = super.getPreferredSize(); return new Dimension(preferredSize.width, myTextHeight); } }; field.setBackground(UIUtil.getPanelBackground()); field.setEditable(false); final Border lineBorder = BorderFactory.createLineBorder(UIUtil.getPanelBackground()); final DottedBorder dotted = new DottedBorder(UIUtil.getActiveTextColor()); field.setBorder(lineBorder); // field.setFocusable(false); field.setHorizontalAlignment(JTextField.RIGHT); field.setCaretPosition(0); field.addFocusListener( new FocusAdapter() { public void focusGained(FocusEvent e) { field.setBorder(dotted); } public void focusLost(FocusEvent e) { field.setBorder(lineBorder); } }); return field; }
private void updateComponents() { boolean archetypesEnabled = myUseArchetypeCheckBox.isSelected(); myAddArchetypeButton.setEnabled(archetypesEnabled); myArchetypesTree.setEnabled(archetypesEnabled); myArchetypesTree.setBackground( archetypesEnabled ? UIUtil.getListBackground() : UIUtil.getPanelBackground()); }
public void setEnabled(boolean enabled) { super.setEnabled(enabled); if (myToggleHistoryLabel != null) { final Color bg = enabled ? UIUtil.getTextFieldBackground() : UIUtil.getPanelBackground(); myToggleHistoryLabel.setBackground(bg); myClearFieldLabel.setBackground(bg); } }
public AwtPopupWrapper(Popup popup) { myPopup = popup; if (SystemInfo.isMac && UIUtil.isUnderAquaLookAndFeel()) { final Component c = (Component) ReflectionUtil.getField(Popup.class, myPopup, Component.class, "component"); c.setBackground(UIUtil.getPanelBackground()); } }
@Override protected void init() { super.init(); myPanel.setLayout(new GridBagLayout()); initTables(); myTreeTable = createOptionsTree(getSettings()); myTreeTable.setBackground(UIUtil.getPanelBackground()); myTreeTable.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); JBScrollPane scrollPane = new JBScrollPane(myTreeTable) { @Override public Dimension getMinimumSize() { return super.getPreferredSize(); } }; myPanel.add( scrollPane, new GridBagConstraints( 0, 0, 1, 1, 0, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); final JPanel previewPanel = createPreviewPanel(); myPanel.add( previewPanel, new GridBagConstraints( 1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); installPreviewPanel(previewPanel); addPanelToWatch(myPanel); isFirstUpdate = false; customizeSettings(); }
@Nullable protected final JComponent createTitlePane() { final String description = myChooserDescriptor.getDescription(); if (StringUtil.isEmptyOrSpaces(description)) return null; final JLabel label = new JLabel(description); label.setBorder( BorderFactory.createCompoundBorder( new SideBorder(UIUtil.getPanelBackground().darker(), SideBorder.BOTTOM), JBUI.Borders.empty(0, 5, 10, 5))); return label; }
protected void setup( final AnAction action, JPanel root, final JLabel name, final JLabel description, JLabel icon) { name.setText(action.getTemplatePresentation().getText()); name.setUI(DarculaWelcomeScreenLabelUI.createUI(name)); name.setForeground(UIUtil.getPanelBackground()); description.setUI(DarculaWelcomeScreenLabelUI.createUI(description)); // icon.setIcon(action.getTemplatePresentation().getIcon()); final String text = action.getTemplatePresentation().getDescription(); final String html = XmlStringUtil.wrapInHtml( MessageFormat.format(text, ApplicationNamesInfo.getInstance().getFullProductName())); root.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); description.setText(html); description.setForeground(Gray._200); description.setEnabled(false); root.addMouseListener( new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { description.setEnabled(true); name.setForeground(new Color(0xE09600)); } @Override public void mouseExited(MouseEvent e) { description.setEnabled(false); name.setForeground(UIUtil.getPanelBackground()); } @Override public void mouseClicked(MouseEvent e) { final ActionManager actionManager = ActionManager.getInstance(); AnActionEvent evt = new AnActionEvent( null, DataManager.getInstance().getDataContext(e.getComponent()), ActionPlaces.WELCOME_SCREEN, action.getTemplatePresentation(), actionManager, 0); action.beforeActionPerformedUpdate(evt); if (evt.getPresentation().isEnabled()) { action.actionPerformed(evt); } } }); }
/** * @param shortcut dialog will be initialized with this <code>shortcut</code>. It can be <code> * null</code> if dialog is used to create new mouse shortcut. */ public MouseShortcutDialog( JComponent parentComponent, MouseShortcut shortcut, @NotNull Keymap keymap, @NotNull String actiondId, @NotNull Group mainGroup) { super(parentComponent, true); setTitle(KeyMapBundle.message("mouse.shortcut.dialog.title")); myKeymap = keymap; myActionId = actiondId; myMainGroup = mainGroup; myRbSingleClick = new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.single.click.radio")); myRbDoubleClick = new JRadioButton(KeyMapBundle.message("mouse.shortcut.dialog.double.click.radio")); ButtonGroup buttonGroup = new ButtonGroup(); buttonGroup.add(myRbSingleClick); buttonGroup.add(myRbDoubleClick); myLblPreview = new JLabel(" "); myClickPad = new MyClickPad(); myTarConflicts = new JTextArea(); myTarConflicts.setFocusable(false); myTarConflicts.setEditable(false); myTarConflicts.setBackground(UIUtil.getPanelBackground()); myTarConflicts.setLineWrap(true); myTarConflicts.setWrapStyleWord(true); if (shortcut != null) { if (shortcut.getClickCount() == 1) { myRbSingleClick.setSelected(true); } else { myRbDoubleClick.setSelected(true); } myButton = shortcut.getButton(); myModifiers = shortcut.getModifiers(); } else { myRbSingleClick.setSelected(true); myButton = -1; myModifiers = -1; } updatePreviewAndConflicts(); init(); }
@Override protected void paintComponent(final Graphics g) { String s = getText(); final Rectangle bounds = getBounds(); if (UIUtil.isUnderDarcula()) { g.setColor(UIUtil.getPanelBackground()); g.fillRect(bounds.x, bounds.y, bounds.width, bounds.height); } if (s == null) return; final Insets insets = getInsets(); final Graphics2D g2 = (Graphics2D) g; g2.setFont(getFont()); UIUtil.applyRenderingHints(g2); final FontMetrics fm = g2.getFontMetrics(); final int sWidth = fm.stringWidth(s); int x = insets.left; if (myAlignment == Component.CENTER_ALIGNMENT || myAlignment == Component.RIGHT_ALIGNMENT) { x = myAlignment == Component.CENTER_ALIGNMENT ? (bounds.width - sWidth) / 2 : bounds.width - insets.right - sWidth; } final Rectangle textR = new Rectangle(); final Rectangle iconR = new Rectangle(); final Rectangle viewR = new Rectangle(bounds); textR.x = textR.y = textR.width = textR.height = 0; viewR.width -= insets.left; viewR.width -= insets.right; final int maxWidth = bounds.width - insets.left - insets.right; if (sWidth > maxWidth) { s = truncateText(s, bounds, fm, textR, iconR, maxWidth); } final int y = UIUtil.getStringY(s, bounds, g2); if (SystemInfo.isMac && !UIUtil.isUnderDarcula() && myDecorate) { g2.setColor(myCustomColor == null ? Gray._215 : myCustomColor); g2.drawString(s, x, y + 1); } g2.setColor(myCustomColor == null ? getForeground() : myCustomColor); g2.drawString(s, x, y); }
/** * Updates LAF of all windows. The method also updates font of components as it's configured in * <code>UISettings</code>. */ @Override public void updateUI() { final UIDefaults uiDefaults = UIManager.getLookAndFeelDefaults(); fixPopupWeight(); fixGtkPopupStyle(); fixTreeWideSelection(uiDefaults); fixMenuIssues(uiDefaults); if (UIUtil.isUnderAquaLookAndFeel()) { uiDefaults.put("Panel.opaque", Boolean.TRUE); } else if (UIUtil.isWinLafOnVista()) { uiDefaults.put("ComboBox.border", null); } initInputMapDefaults(uiDefaults); uiDefaults.put("Button.defaultButtonFollowsFocus", Boolean.FALSE); patchFileChooserStrings(uiDefaults); patchLafFonts(uiDefaults); patchHiDPI(uiDefaults); patchGtkDefaults(uiDefaults); fixSeparatorColor(uiDefaults); updateToolWindows(); for (Frame frame : Frame.getFrames()) { // OSX/Aqua fix: Some image caching components like ToolWindowHeader use // com.apple.laf.AquaNativeResources$CColorPaintUIResource // a Java wrapper for ObjC MagicBackgroundColor class (Java RGB values ignored). // MagicBackgroundColor always reports current Frame background. // So we need to set frames background to exact and correct value. if (SystemInfo.isMac) { //noinspection UseJBColor frame.setBackground(new Color(UIUtil.getPanelBackground().getRGB())); } updateUI(frame); } fireLookAndFeelChanged(); }
@Override public void paintBorder( final Component c, final Graphics g, final int x, final int y, final int width, final int height) { if (UIUtil.isUnderDarcula()) { g.setColor(Gray._40); doPaintBorder(c, g, x, y, width, height); } else { g.setColor(UIUtil.getPanelBackground()); doPaintBorder(c, g, x, y, width, height); g.setColor(Gray._155); doPaintBorder(c, g, x, y, width, height); } }
@SuppressWarnings("MethodMayBeStatic") private String formatWc( @NotNull WCInfo info, @NotNull Collection<WorkingCopyFormat> upgradeFormats) { final StringBuilder sb = new StringBuilder() .append("<html><head>") .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())) .append("</head><body><table bgColor=\"") .append(ColorUtil.toHex(UIUtil.getPanelBackground())) .append("\">"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><b>") .append(info.getPath()) .append("</b></td></tr>"); if (info.hasError()) { sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\" color=\"") .append(ColorUtil.toHex(JBColor.red)) .append("\">") .append(info.getErrorMessage()) .append("</td></tr>"); } else { sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\">") .append(info.getRootUrl()) .append("</td></tr>"); } if (upgradeFormats.size() > 1) { sb.append("<tr valign=\"top\"><td>Format:</td><td>") .append(info.getFormat().getName()) .append("</td><td><a href=\"") .append(CHANGE_FORMAT) .append("\">Change</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">") .append(info.getFormat().getName()) .append("</td></tr>"); } if (!Depth.INFINITY.equals(info.getStickyDepth()) && !info.hasError()) { // can fix sb.append("<tr valign=\"top\"><td>Depth:</td><td>") .append(info.getStickyDepth().getName()) .append("</td><td><a href=\"") .append(FIX_DEPTH) .append("\">Fix</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Depth:</td><td colspan=\"2\">") .append(info.getStickyDepth().getName()) .append("</td></tr>"); } final NestedCopyType type = info.getType(); if (NestedCopyType.external.equals(type) || NestedCopyType.switched.equals(type)) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append(type.getName()) .append("</i></td></tr>"); } if (info.isIsWcRoot()) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append("Working copy root</i></td></tr>"); } if (!info.hasError()) { if (info.getFormat().isOrGreater(WorkingCopyFormat.ONE_DOT_SEVEN)) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(CLEANUP) .append("\">Cleanup</a></td></tr>"); } sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(CONFIGURE_BRANCHES) .append("\">Configure Branches</a></td></tr>"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(MERGE_FROM) .append("\"><b>Merge From...</b></a></i></td></tr>"); sb.append("</table></body></html>"); } return sb.toString(); }
@Override @SuppressWarnings("deprecation") public void show() { myFocusTrackback = new FocusTrackback(getDialogWrapper(), getParent(), true); final DialogWrapper dialogWrapper = getDialogWrapper(); boolean isAutoAdjustable = dialogWrapper.isAutoAdjustable(); Point location = null; if (isAutoAdjustable) { pack(); Dimension packedSize = getSize(); Dimension minSize = getMinimumSize(); setSize( Math.max(packedSize.width, minSize.width), Math.max(packedSize.height, minSize.height)); setSize( (int) (getWidth() * dialogWrapper.getHorizontalStretch()), (int) (getHeight() * dialogWrapper.getVerticalStretch())); // Restore dialog's size and location myDimensionServiceKey = dialogWrapper.getDimensionKey(); if (myDimensionServiceKey != null) { final Project projectGuess = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(this)); location = DimensionService.getInstance().getLocation(myDimensionServiceKey, projectGuess); Dimension size = DimensionService.getInstance().getSize(myDimensionServiceKey, projectGuess); if (size != null) { myInitialSize = new Dimension(size); _setSizeForLocation(myInitialSize.width, myInitialSize.height, location); } } if (myInitialSize == null) { myInitialSize = getSize(); } } if (location == null) { location = dialogWrapper.getInitialLocation(); } if (location != null) { setLocation(location); } else { setLocationRelativeTo(getOwner()); } if (isAutoAdjustable) { final Rectangle bounds = getBounds(); ScreenUtil.fitToScreen(bounds); setBounds(bounds); } addWindowListener( new WindowAdapter() { @Override public void windowActivated(WindowEvent e) { final DialogWrapper wrapper = getDialogWrapper(); if (wrapper != null && myFocusTrackback != null) { myFocusTrackback.cleanParentWindow(); myFocusTrackback.registerFocusComponent( new FocusTrackback.ComponentQuery() { @Override public Component getComponent() { return wrapper.getPreferredFocusedComponent(); } }); } } @Override public void windowDeactivated(WindowEvent e) { if (!isModal()) { final Ref<IdeFocusManager> focusManager = new Ref<IdeFocusManager>(null); Project project = getProject(); if (project != null && !project.isDisposed()) { focusManager.set(getFocusManager()); focusManager .get() .doWhenFocusSettlesDown( new Runnable() { @Override public void run() { disposeFocusTrackbackIfNoChildWindowFocused(focusManager.get()); } }); } else { disposeFocusTrackbackIfNoChildWindowFocused(focusManager.get()); } } } @Override public void windowOpened(WindowEvent e) { if (!SystemInfo.isMacOSLion) return; Window window = e.getWindow(); if (window instanceof Dialog) { ID _native = MacUtil.findWindowForTitle(((Dialog) window).getTitle()); if (_native != null && _native.intValue() > 0) { // see MacMainFrameDecorator // NSCollectionBehaviorFullScreenAuxiliary = 1 << 8 Foundation.invoke(_native, "setCollectionBehavior:", 1 << 8); } } } }); if (Registry.is("actionSystem.fixLostTyping")) { final IdeEventQueue queue = IdeEventQueue.getInstance(); if (queue != null) { queue.getKeyEventDispatcher().resetState(); } // if (myProject != null) { // Project project = myProject.get(); // if (project != null && !project.isDisposed() && project.isInitialized()) { // // IdeFocusManager.findInstanceByComponent(this).requestFocus(new // MyFocusCommand(dialogWrapper), true); // } // } } if (SystemInfo.isMac && myProject != null && Registry.is("ide.mac.fix.dialog.showing") && !dialogWrapper.isModalProgress()) { final IdeFrame frame = WindowManager.getInstance().getIdeFrame(myProject.get()); AppIcon.getInstance().requestFocus(frame); } setBackground(UIUtil.getPanelBackground()); final ApplicationEx app = ApplicationManagerEx.getApplicationEx(); if (app != null && !app.isLoaded() && Splash.BOUNDS != null) { final Point loc = getLocation(); loc.y = Splash.BOUNDS.y + Splash.BOUNDS.height; setLocation(loc); } super.show(); }
public void paintComponent(Graphics g) { if (getFrame() != null) { setState(getFrame().getExtendedState()); } JRootPane rootPane = getRootPane(); Window window = getWindow(); boolean leftToRight = (window == null) ? rootPane.getComponentOrientation().isLeftToRight() : window.getComponentOrientation().isLeftToRight(); boolean isSelected = (window == null) ? true : window.isActive(); int width = getWidth(); int height = getHeight(); Color background; Color foreground; Color darkShadow; if (isSelected) { background = UIUtil.getPanelBackground(); // myActiveBackground; foreground = myActiveForeground; darkShadow = Gray._73; // myActiveShadow; } else { background = UIUtil.getPanelBackground(); // myInactiveBackground; foreground = myInactiveForeground; darkShadow = myInactiveShadow; } g.setColor(background); g.fillRect(0, 0, width, height); // g.setColor(darkShadow); // g.drawLine(0, height - 1, width, height - 1); // g.drawLine(0, 0, 0, 0); // g.drawLine(width - 1, 0, width - 1, 0); int xOffset = leftToRight ? 5 : width - 5; if (getWindowDecorationStyle() == JRootPane.FRAME) { xOffset += leftToRight ? IMAGE_WIDTH + 5 : -IMAGE_WIDTH - 5; } String theTitle = getTitle(); if (theTitle != null) { FontMetrics fm = SwingUtilities2.getFontMetrics(rootPane, g); g.setColor(foreground); int yOffset = ((height - fm.getHeight()) / 2) + fm.getAscent(); Rectangle rect = new Rectangle(0, 0, 0, 0); if (myIconifyButton != null && myIconifyButton.getParent() != null) { rect = myIconifyButton.getBounds(); } int titleW; if (leftToRight) { if (rect.x == 0) { rect.x = window.getWidth() - window.getInsets().right - 2; } titleW = rect.x - xOffset - 4; theTitle = SwingUtilities2.clipStringIfNecessary(rootPane, fm, theTitle, titleW); } else { titleW = xOffset - rect.x - rect.width - 4; theTitle = SwingUtilities2.clipStringIfNecessary(rootPane, fm, theTitle, titleW); xOffset -= SwingUtilities2.stringWidth(rootPane, fm, theTitle); } int titleLength = SwingUtilities2.stringWidth(rootPane, fm, theTitle); if (myIdeMenu == null) { SwingUtilities2.drawString(rootPane, g, theTitle, xOffset, yOffset); xOffset += leftToRight ? titleLength + 5 : -5; } } int w = width; int h = height; h--; g.setColor(UIManager.getColor("MenuBar.darcula.borderColor")); g.drawLine(0, h, w, h); h--; g.setColor(UIManager.getColor("MenuBar.darcula.borderShadowColor")); g.drawLine(0, h, w, h); }
public Color getHighlightColor() { return UIUtil.isUnderDarcula() ? UIUtil.getPanelBackground().brighter() : UIUtil.getTreeBackground().brighter(); }
public MavenArchetypesStep(MavenModuleBuilder builder, @Nullable StepAdapter step) { myBuilder = builder; myStep = step; Disposer.register(this, myLoadingIcon); myArchetypesTree = new Tree(); myArchetypesTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode())); JScrollPane archetypesScrollPane = ScrollPaneFactory.createScrollPane(myArchetypesTree); myArchetypesPanel.add(archetypesScrollPane, "archetypes"); JPanel loadingPanel = new JPanel(new GridBagLayout()); JPanel bp = new JPanel(new BorderLayout(10, 10)); bp.add(new JLabel("Loading archetype list..."), BorderLayout.NORTH); bp.add(myLoadingIcon, BorderLayout.CENTER); loadingPanel.add(bp, new GridBagConstraints()); myArchetypesPanel.add(ScrollPaneFactory.createScrollPane(loadingPanel), "loading"); ((CardLayout) myArchetypesPanel.getLayout()).show(myArchetypesPanel, "archetypes"); myUseArchetypeCheckBox.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateComponents(); archetypeMayBeChanged(); } }); myAddArchetypeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { doAddArchetype(); } }); myArchetypesTree.setRootVisible(false); myArchetypesTree.setShowsRootHandles(true); myArchetypesTree.setCellRenderer(new MyRenderer()); myArchetypesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myArchetypesTree .getSelectionModel() .addTreeSelectionListener( new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { updateArchetypeDescription(); archetypeMayBeChanged(); } }); new TreeSpeedSearch( myArchetypesTree, new Convertor<TreePath, String>() { public String convert(TreePath path) { MavenArchetype info = getArchetypeInfoFromPathComponent(path.getLastPathComponent()); return info.groupId + ":" + info.artifactId + ":" + info.version; } }) .setComparator(new SpeedSearchComparator(false)); myArchetypeDescriptionField.setEditable(false); myArchetypeDescriptionField.setBackground(UIUtil.getPanelBackground()); requestUpdate(); updateComponents(); }
private void updateList(final List<WCInfo> infoList) { myPanel.removeAll(); final Insets nullIndent = new Insets(1, 3, 1, 0); final GridBagConstraints gb = new GridBagConstraints( 0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(2, 2, 0, 0), 0, 0); gb.insets.left = 4; myPanel.add(myRefreshLabel, gb); gb.insets.left = 1; final LocalFileSystem lfs = LocalFileSystem.getInstance(); final Insets topIndent = new Insets(10, 3, 0, 0); for (final WCInfo wcInfo : infoList) { final VirtualFile vf = lfs.refreshAndFindFileByIoFile(new File(wcInfo.getPath())); final VirtualFile root = (vf == null) ? wcInfo.getVcsRoot() : vf; final JEditorPane editorPane = new JEditorPane(UIUtil.HTML_MIME, ""); editorPane.setEditable(false); editorPane.setFocusable(true); editorPane.setBackground(UIUtil.getPanelBackground()); editorPane.addHyperlinkListener( new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { if (CONFIGURE_BRANCHES.equals(e.getDescription())) { if (!checkRoot(root, wcInfo.getPath(), " invoke Configure Branches")) return; BranchConfigurationDialog.configureBranches(myProject, root, true); } else if (FIX_DEPTH.equals(e.getDescription())) { final int result = Messages.showOkCancelDialog( myVcs.getProject(), "You are going to checkout into '" + wcInfo.getPath() + "' with 'infinity' depth.\n" + "This will update your working copy to HEAD revision as well.", "Set working copy infinity depth", Messages.getWarningIcon()); if (result == 0) { // update of view will be triggered by roots changed event SvnCheckoutProvider.checkout( myVcs.getProject(), new File(wcInfo.getPath()), wcInfo.getRootUrl(), SVNRevision.HEAD, SVNDepth.INFINITY, false, null, wcInfo.getFormat()); } } else if (CHANGE_FORMAT.equals(e.getDescription())) { changeFormat(wcInfo); } else if (MERGE_FROM.equals(e.getDescription())) { if (!checkRoot(root, wcInfo.getPath(), " invoke Merge From")) return; mergeFrom(wcInfo, root, editorPane); } } } private boolean checkRoot( VirtualFile root, final String path, final String actionName) { if (root == null) { Messages.showWarningDialog( myProject, "Invalid working copy root: " + path, "Can not " + actionName); return false; } return true; } }); editorPane.setBorder(null); editorPane.setText(formatWc(wcInfo)); final JPanel copyPanel = new JPanel(new GridBagLayout()); final GridBagConstraints gb1 = new GridBagConstraints( 0, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, nullIndent, 0, 0); gb1.insets.top = 1; gb1.gridwidth = 3; gb.insets = topIndent; gb.fill = GridBagConstraints.HORIZONTAL; ++gb.gridy; final JPanel contForCopy = new JPanel(new BorderLayout()); contForCopy.add(copyPanel, BorderLayout.WEST); myPanel.add(contForCopy, gb); copyPanel.add(editorPane, gb1); gb1.insets = nullIndent; } myPanel.revalidate(); myPanel.repaint(); }
private String formatWc(WCInfo info) { final StringBuilder sb = new StringBuilder() .append("<html><head>") .append(UIUtil.getCssFontDeclaration(UIUtil.getLabelFont())) .append("</head><body><table bgColor=\"") .append(ColorUtil.toHex(UIUtil.getPanelBackground())) .append("\">"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><b>") .append(info.getPath()) .append("</b></td></tr>"); sb.append("<tr valign=\"top\"><td>URL:</td><td colspan=\"2\">") .append(info.getRootUrl()) .append("</td></tr>"); if (!WorkingCopyFormat.ONE_DOT_SEVEN.equals(info.getFormat())) { // can convert sb.append("<tr valign=\"top\"><td>Format:</td><td>") .append(info.getFormat().getName()) .append("</td><td><a href=\"") .append(CHANGE_FORMAT) .append("\">Change</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Format:</td><td colspan=\"2\">") .append(info.getFormat().getName()) .append("</td></tr>"); } if (!SVNDepth.INFINITY.equals(info.getStickyDepth())) { // can fix sb.append("<tr valign=\"top\"><td>Depth:</td><td>") .append(info.getStickyDepth().getName()) .append("</td><td><a href=\"") .append(FIX_DEPTH) .append("\">Fix</a></td></tr>"); } else { sb.append("<tr valign=\"top\"><td>Depth:</td><td colspan=\"2\">") .append(info.getStickyDepth().getName()) .append("</td></tr>"); } final NestedCopyType type = info.getType(); if (NestedCopyType.external.equals(type) || NestedCopyType.switched.equals(type)) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append(type.getName()) .append("</i></td></tr>"); } if (info.isIsWcRoot()) { sb.append("<tr valign=\"top\"><td colspan=\"3\"><i>") .append("Working copy root</i></td></tr>"); } sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(CONFIGURE_BRANCHES) .append("\">Configure Branches</a></td></tr>"); sb.append("<tr valign=\"top\"><td colspan=\"3\"><a href=\"") .append(MERGE_FROM) .append("\"><b>Merge From...</b></a></i></td></tr>"); sb.append("</table></body></html>"); return sb.toString(); }