protected ReturnMessage handleException(UniqueConstraintsException exception) { String title = getMessages() .getMessage( GeneralProperties.class.getName() + "." + GeneralProperties.getGeneralTitle(ReturnMessageEnum.ERROR)); String message = applicationMessages.getMessage(exception.getKey()); return new ReturnMessage(ReturnMessageEnum.ERROR, title, message); }
protected ReturnMessage handleException(ServiceException exception) { String title = getMessages() .getMessage( GeneralProperties.class.getName() + "." + GeneralProperties.getGeneralTitle(exception.getType()).name()); String message = applicationMessages.getMessage(exception.getClass().getName()); return new ReturnMessage(exception.getType(), title, message); }
public AttributedString getCursorAttributedString(Image image) { // Calculate position in blocks Dimension blockSize = GeneralProperties.getInstance().getBlockSize(); int blockX = cx / blockSize.width; int blockY = cy / blockSize.height; int remX = cx % blockSize.width; int remY = cy % blockSize.height; // Generate attributed string // <b>BX</b>+[PX % BW]<b>,BY</b>+[PC % BH]</b> / BW,BH / PX,PY // B = Block, P = Pixel // X = x, Y = y, W = Width, H = Height (BW/BH in Pixels) AttributedString as = new AttributedString( blockX + "+" + remX + "," + blockY + "+" + remY + " / " + blockSize.width + "," + blockSize.height + " / " + cx + "," + cy); int start = 0; int end = Integer.toString(blockX).length(); as.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, start, end); start = end + 2 + Integer.toString(remX).length(); end = start + Integer.toString(blockY).length(); as.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, start, end); return as; }